OpenAI-Compatible API
Writingmate exposes an OpenAI-compatible API so you can use your Writingmate workspace from external tools and SDKs.
Requests made through this API are billed against your current Writingmate workspace using the same token-to-message counting logic as Writingmate chat.
Before you start
- Open Profile Settings in Writingmate.
- Go to API Keys.
- Create a Writingmate Developer Key.
- Copy the key when it is shown. The full value is only displayed once.
Base URL
https://writingmate.ai/api/openai/v1
Authentication
Use your Writingmate developer key as a Bearer token:
Authorization: Bearer YOUR_WRITINGMATE_DEVELOPER_KEY
Supported endpoints
Writingmate currently supports these OpenAI-compatible endpoints:
GET /modelsGET /models/{id}POST /chat/completionsPOST /completionsPOST /responsesPOST /audio/transcriptions
Model names
Use Writingmate model slugs such as:
openai/gpt-5-miniopenai/gpt-5anthropic/claude-sonnet-4.5google/gemini-2.5-pro
Fetch the live list from:
curl https://writingmate.ai/api/openai/v1/models \
-H "Authorization: Bearer YOUR_WRITINGMATE_DEVELOPER_KEY"
Chat Completions example
curl https://writingmate.ai/api/openai/v1/chat/completions \
-H "Authorization: Bearer YOUR_WRITINGMATE_DEVELOPER_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5-mini",
"messages": [
{ "role": "system", "content": "Be concise." },
{ "role": "user", "content": "Summarize Writingmate in one sentence." }
]
}'
Responses API example
curl https://writingmate.ai/api/openai/v1/responses \
-H "Authorization: Bearer YOUR_WRITINGMATE_DEVELOPER_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5-mini",
"input": "Write a short launch announcement for a new developer API."
}'
OpenAI SDK example
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.WRITINGMATE_API_KEY,
baseURL: "https://writingmate.ai/api/openai/v1",
});
const response = await client.responses.create({
model: "openai/gpt-5-mini",
input: "Say hello from Writingmate.",
});
console.log(response.output_text);
OpenCode and other OpenAI-compatible CLIs
If your client supports a custom OpenAI base URL, point it to Writingmate:
export OPENAI_API_KEY=YOUR_WRITINGMATE_DEVELOPER_KEY
export OPENAI_BASE_URL=https://writingmate.ai/api/openai/v1
Then choose a Writingmate model slug, for example openai/gpt-5-mini.
Most OpenAI-compatible CLIs and libraries only need:
- a Bearer API key
- a custom base URL
- a model name returned by
/models
Workspace selection
By default, the API uses your current workspace.
If your client lets you send custom headers, you can target a specific workspace with:
x-writingmate-workspace: WORKSPACE_ID
The workspace must belong to the authenticated user.
Usage and limits
Writingmate applies the same access rules and usage accounting as the app:
- model availability still depends on your Writingmate plan
- daily and AppSumo limits still apply
- BYOK OpenRouter behavior still applies if you configured your own OpenRouter key
- cached prompt tokens are discounted the same way they are in Writingmate chat
Tool calling
/chat/completions and /responses support OpenAI-style function tools for single-step tool calling.
Notes
- This API is OpenAI-compatible, not byte-for-byte identical to every OpenAI feature.
- Use
/modelsto discover the currently supported model list. - For audio transcription details, see the separate transcription documentation.