Documentation
An OpenAI-compatible API. If you already have code using the official OpenAI SDK, just change the base_url and the key.
Quickstart
- 1. Sign up
- 2. Top up your balance and create an API key in the dashboard.
- 3. Paste your key into the snippet below and run the request.
curl https://apimira.com/v1/chat/completions \
-H "Authorization: Bearer ya-ВАШ_КЛЮЧ" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.4-mini",
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
}'The base_url is the address above with a /v1 suffix. The model is set via the model parameter.
Copy the Model ID from the catalog in full, including the part before «/»: for example openai/gpt-5.4-mini or anthropic/claude-sonnet-4.6.
Connect your apps
Any app with an OpenAI-compatible API connects with three values:
| Base URL / Endpoint | https://apimira.com/v1 |
|---|---|
| API key | ya-ВАШ_КЛЮЧ |
| Model ID | openai/gpt-5.4-mini |
If the field is just «Base URL», the app appends /chat/completions itself — do not add it. And make sure the address does not end up as /v1/v1.
To test the key without an app, run the request from the Quickstart block above.
What the gateway cannot do yet
Function calling (tools, tool_choice, functions), strict JSON mode (response_format) and image input are not supported yet. Such a request gets an explicit unsupported_parameter error instead of the parameter being silently dropped, so you never pay for an answer produced under different rules than you asked for. Plain chat and streaming work across the whole catalogue. Function calling support is in progress.
Code editors: Cursor, Cline, Roo Code, Kilo Code
Pick "OpenAI Compatible" in the provider settings and fill in the three values above. Note: agentic modes, where the extension reads and edits files on its own, rely on function calling and do not work yet - plain chat with the model is available. The built-in Cursor agent does not accept a custom endpoint: install the Cline or Roo Code extension inside Cursor instead. If the model list does not load, type the Model ID manually.
SillyTavern
API Connections → Chat Completion → Source: Custom (OpenAI-compatible). Put the Base URL into Custom Endpoint, then the key and Model ID. If chat works but the status check fails, enable Bypass API status check.
n8n
Create an OpenAI credential, put our address with /v1 into Base URL and paste the key. Pick the model by its full Model ID in the AI node. The AI Agent node relies on function calling and will not work yet - use plain generation nodes such as Basic LLM Chain.
Janitor AI
In the proxy settings set Proxy URL (Base URL with /v1), API Key and Model. Janitor appends /chat/completions itself. Save the proxy configuration first, then the character settings.
OpenCode
Open ~/.config/opencode/opencode.json, add the provider with the config below, run opencode and pick a model via /models.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"yourapi": {
"npm": "@ai-sdk/openai-compatible",
"name": "yourapi",
"options": {
"baseURL": "https://apimira.com/v1",
"apiKey": "ya-ВАШ_КЛЮЧ"
},
"models": {
"openai/gpt-5.4-mini": { "name": "GPT-5.4 Mini" },
"anthropic/claude-sonnet-4.6": { "name": "Claude Sonnet 4.6" }
}
}
}
}Claude Code and Anthropic SDK
These require the native Anthropic endpoint (/v1/messages), which is not supported yet - it is in progress. The Anthropic models themselves are available over the OpenAI-compatible path above, in plain chat mode.
Chat — generate a response
POST /v1/chat/completions
Generates a model response. Supports stream=true (SSE). Request and response formats match OpenAI.
Streaming: pass "stream": true. Chunks arrive as data: {...} and end with data: [DONE].
Supported: text chat, image generation and speech (TTS). In chat, the tools, response_format and vision parameters return 400 for now.
Image generation
POST /v1/images/generations
POST /v1/images/generations — synchronous, request and response are OpenAI Images-compatible. A fixed price per image is charged, multiplied by the count (n).
curl https://apimira.com/v1/images/generations \
-H "Authorization: Bearer ya-ВАШ_КЛЮЧ" \
-H "Content-Type: application/json" \
-d '{
"model": "image/gpt-image-2",
"prompt": "a red cat wearing glasses",
"n": 1
}'The model must be an image model (see GET /v1/models). The response is a data array with a b64_json field (base64 image) or url.
Speech (TTS)
POST /v1/audio/speech
POST /v1/audio/speech — synchronously turns text into speech. The response is binary audio bytes (mp3 by default). A fixed price per request is charged.
curl https://apimira.com/v1/audio/speech \
-H "Authorization: Bearer ya-ВАШ_КЛЮЧ" \
-H "Content-Type: application/json" \
-d '{
"model": "audio/elevenlabs-tts",
"input": "Привет! Это синтез речи.",
"voice": "alloy"
}' \
--output speech.mp3The model must be an audio model (see GET /v1/models). Parameters: input (text), voice, response_format.
Endpoints
POST /v1/chat/completions
Generates a model response. Supports stream=true (SSE). Request and response formats match OpenAI.
GET /v1/models
Lists available models in OpenAI format. Disabled models are not returned.
POST /v1/images/generations
Synchronous image generation (OpenAI Images-compatible).
POST /v1/audio/speech
Text-to-speech synthesis (TTS) — returns an audio file.
Error codes
| HTTP | code | When it happens |
|---|---|---|
| 401 | invalid_api_key | The key is wrong, revoked or missing. |
| 402 | insufficient_balance | Your balance is empty — top it up in the dashboard. |
| 404 | model_not_found | The model does not exist or is disabled. See GET /v1/models. |
| 400 | invalid_request | Malformed request body or an unsupported parameter. |
| 5xx | upstream_error | The model provider failed. You are not charged for such a request. |
Common questions
How do I switch models?
Change the model parameter. The rest of your code stays the same — the request goes to the right provider.
Does the official OpenAI SDK work?
Yes. Point base_url at our address with /v1 and use our key — the rest of the code stays unchanged.
How is the cost calculated?
By input and output tokens, at the model price at request time. The cost is shown in your dashboard stats.