Writingmate Now Has an OpenAI-Compatible API

Writingmate now supports an OpenAI-compatible API with developer keys, workspace-based billing, and examples for OpenCode, Aider, and other CLI tools.

Read the setup guide
200+ models
One subscription
No API keys
Cancel anytime
OpenAI-compatible API launch artwork for Writingmate
Artem Vysotsky

Author, Co-Founder & CEO

Artem Vysotsky

Sergey Vysotsky

Reviewer, Co-Founder & CMO

Sergey Vysotsky

2 min read
Updated: 04/02/2026

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.

Writingmate OpenAI-compatible API launch cover

What is included

Writingmate now supports these endpoints under https://writingmate.ai/api/openai/v1:

  • GET /models

  • GET /models/{id}

  • POST /chat/completions

  • POST /completions

  • POST /responses

  • POST /audio/transcriptions

Developer keys

To use the API, create a Writingmate Developer Key in Settings → API Keys.

Writingmate Developer Keys settings

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))
OpenAI-compatible counting explanation

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/completionsPROD_CHAT_OK

  • completionsPROD_COMPLETION_OK

  • responsesPROD_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": {}
      }
    }
  }
}
OpenCode configuration for Writingmate

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

Artem Vysotsky

Written by

Artem Vysotsky

Ex-Staff Engineer at Meta. Building the technical foundation to make AI accessible to everyone.

Sergey Vysotsky

Reviewed by

Sergey Vysotsky

Ex-Chief Editor / PM at Mosaic. Passionate about making AI accessible and affordable for everyone.

Ready to experience the power of AI?

Access 200+ AI models, custom agents, and powerful tools - all in one subscription.