We have shipped an OpenAI-compatible API for Writingmate. If a tool already supports a custom OpenAI base URL and Bearer API key, there is a good chance it can now use Writingmate too.
This release adds a standard integration surface for external SDKs, code agents, CLI tools, and internal automations without forcing anyone to learn a one-off private API.
What is included
Writingmate now supports these endpoints under https://writingmate.ai/api/openai/v1:
GET /modelsGET /models/{id}POST /chat/completionsPOST /completionsPOST /responsesPOST /audio/transcriptions
Developer keys
To use the API, create a Writingmate Developer Key in Settings → API Keys.
These keys are different from a personal OpenRouter key:
OpenRouter key: Writingmate routes requests through your provider account.
Writingmate Developer Key: external clients call Writingmate directly.
How counting works
The OpenAI-compatible API uses the same counting path as Writingmate chat. That means usage is counted in messages, not just raw tokens.
1 message = 16,000 tokens
Every request costs at least 1 message
Cached prompt tokens are discounted by 50%
The formula is:
cached_discount = floor(cached_tokens * 0.5)
effective_input = max(0, prompt_tokens - cached_discount)
counted_messages = max(1, ceil((effective_input + completion_tokens) / 16000))
We also validated this on production. A live request that returned prompt_tokens = 10 and completion_tokens = 5 was recorded as count = 1 in daily_message_count, with matching input and output token counts.
Production-validated model
For the launch validation, the cleanest production proof path used google/gemini-2.5-flash. With a freshly minted developer key on writingmate.ai, we validated:
chat/completions→PROD_CHAT_OKcompletions→PROD_COMPLETION_OKresponses→PROD_RESPONSES_OK
OpenCode example
OpenCode can use Writingmate as an OpenAI-compatible provider:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"writingmate": {
"npm": "@ai-sdk/openai-compatible",
"name": "Writingmate",
"options": {
"baseURL": "https://writingmate.ai/api/openai/v1",
"apiKey": "{env:OPENAI_API_KEY}"
},
"models": {
"google/gemini-2.5-flash": {},
"openai/gpt-5-mini": {}
}
}
}
}
Then set:
export OPENAI_API_KEY=YOUR_WRITINGMATE_DEVELOPER_KEY
Other CLI tools
Aider
export OPENAI_API_KEY=YOUR_WRITINGMATE_DEVELOPER_KEY
export OPENAI_API_BASE=https://writingmate.ai/api/openai/v1
aider --model openai/google/gemini-2.5-flash
Aider uses the openai/ prefix for OpenAI-compatible providers, so the Writingmate slug becomes openai/google/gemini-2.5-flash.
llm CLI
- model_id: writingmate-gemini-flash
model_name: google/gemini-2.5-flash
api_base: "https://writingmate.ai/api/openai/v1"
api_key_name: openai
Then run llm -m writingmate-gemini-flash "Reply with exactly: HELLO".
Where to start
The setup instructions and counting details are in the docs:
The goal here was simple: if your tooling already speaks OpenAI-compatible APIs, it should now be able to speak Writingmate too.
OpenAI-Compatible API FAQ
Sources
Written by
Artem Vysotsky
Ex-Staff Engineer at Meta. Building the technical foundation to make AI accessible to everyone.
Reviewed by
Sergey Vysotsky
Ex-Chief Editor / PM at Mosaic. Passionate about making AI accessible and affordable for everyone.


