API Documentation
An OpenAI-compatible API. Point any existing SDK at Meriq by changing the base URL and key.
1. Create a key in the API dashboard. 2. Fund your wallet ($5 minimum) unless your plan covers API usage. With a $0 balance, wallet-billed calls return 402 insufficient_balance.
Quickstart
Base URL: https://meriq.ai/v1. Call it exactly as you would OpenAI's.
# pip install openai
from openai import OpenAI
client = OpenAI(
api_key="mrq_your_key_here",
base_url="https://meriq.ai/v1",
)
resp = client.chat.completions.create(
model="meriq",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)Authentication
Every request needs a bearer token. Keys start with mrq_ and are shown once at creation, so store them somewhere safe.
Authorization: Bearer mrq_your_key_here
Each key carries scopes (chat, search, exports, account-read, account-write). A request outside a key's scopes returns 403 insufficient_scope.
Models
Pass one of these ids as model. Omit model and the request uses meriq, or the first model in this list your plan can call. GET /v1/models lists only the models your key can call.
| Model | Id | Context | Max output | Input / 1M | Cached input / 1M | Output / 1M | Billing |
|---|---|---|---|---|---|---|---|
| Meriq Fast, versatile responses for everyday tasks | meriq |
1,048,576 | 384,000 | $1.08 | $0.270 | $2.29 | Plan usage or wallet |
| Meriq Pro Maximum capability for complex coding, math, and long-context work | meriq-pro |
262,144 | 262,144 | $1.14 | $0.285 | $4.80 | Plan usage or wallet |
| Gemini Flash Lite Lightweight model for high-volume, low-latency calls | gemini-flash-lite |
1,048,576 | 65,536 | $0.33 | $0.083 | $2.75 | Wallet |
| DeepSeek V4.1 Flash Fast, low-cost open-weight model. | deepseek-v4-1-flash |
1,048,576 | 1,048,576 | $0.28 | $0.070 | $0.83 | Wallet |
| GLM 5.3 Flash Fast open-weight model for everyday tasks. | glm-5-3-flash |
1,048,576 | 131,072 | $0.19 | $0.048 | $0.63 | Wallet |
| Qwen 3.6 35B Small open-weight model, very low cost. | qwen-3-6-35b |
262,144 | 262,144 | $0.19 | $0.048 | $1.25 | Wallet |
| GLM 5.3 Open-weight model for coding and reasoning. | glm-5-3 |
1,310,720 | 131,072 | $1.52 | $0.380 | $4.76 | Wallet |
| Kimi K3 Open-weight model for long agentic work. | kimi-k3 |
1,310,720 | 1,048,576 | $2.92 | $0.730 | $14.58 | Wallet |
Billing
API usage is billed one of two ways, decided per request:
- API wallet. A prepaid USD balance you top up from the dashboard ($5 minimum per payment). Charged per token at the published rates above. This is how every account pays by default, and how wallet-only models are always billed.
- Plan usage. If your subscription includes API usage, calls to the plan-eligible models above draw from the same rolling usage windows as chat instead of your wallet. No wallet balance required.
Prompt tokens the provider serves from its cache bill at the cached input rate in the table above, not the full input rate. Long conversations and agent loops that resend the same prefix cost less per call. usage.prompt_tokens still counts every prompt token.
When a plan usage window runs out, calls return 429 usage_limit_exceeded until it resets. Turn on wallet fallback in the dashboard to have those calls continue on your wallet balance instead.
Monthly key budgets cover wallet charges in UTC calendar months, including wallet fallback. Pending requests reserve part of the budget before starting; a request whose estimate does not fit returns 402 budget_exceeded. Final billing uses actual usage, including any extra usage that fits the remaining budget, while protecting other pending reservations. Charges never exceed the budget agreed when the request started. Requests crossing midnight on the first day settle against their starting month. Budget changes apply to new requests.
A refunded or disputed top-up is taken back out of the wallet, which can leave the balance below zero. Wallet-billed calls return 402 until it is positive again.
Refused answers are refunded on models marked refund-eligible: check refunds_refusals on /v1/models, or meriq.refund_policy in each response. Fees for completed server-side tool calls, such as web searches, are kept. Meriq never silently retries or rewrites your prompt.
Chat completions
POST /v1/chat/completions · scope chat, plus search for server-side tools
| Field | Type | Notes |
|---|---|---|
model | string | Model id from /v1/models. Optional: defaults to meriq. |
messages | array | Required. Roles: system, developer, user, assistant (with optional tool_calls), and tool (with tool_call_id). Content is a string or an array of parts. Message count and prompt size are bounded by the model's context window. |
temperature | number | 0 to 2. Omit to use the model's default. |
max_tokens or max_completion_tokens | integer | Send one, not both. Clamped to the model's output limit. When omitted: min(4,096, model max output), shown as default_max_tokens on /v1/models. A reply that hits the cap ends with finish_reason: "length". |
stream | boolean | Server-sent events when true. |
stream_options.include_usage | boolean | Adds a final chunk with usage and empty choices. |
tools | array | Up to 128 function tools, plus Meriq's server-side tools. The model must support tools. |
tool_choice | string or object | auto, none, required, or a function object. |
top_p | number | 0 to 1. Passed to the provider. |
presence_penalty, frequency_penalty | number | -2 to 2. Passed to the provider. |
stop | string or array | Up to 4 stop sequences. Passed to the provider. |
seed | integer | Passed to the provider. Determinism depends on the model. |
n | integer | Only 1 is accepted. |
parallel_tool_calls | boolean | Accepted and ignored. |
Fields sent as null are ignored. Not supported, and rejected with 400 unsupported_parameter: logprobs (except false), top_logprobs, logit_bias, response_format (except {"type": "text"}), reasoning and reasoning_effort. Reasoning settings are configured by the selected model. Each entry on /v1/models lists its supported_parameters.
Streaming responses are SSE lines of data: {...} in OpenAI chunk format, terminated by data: [DONE]. If generation fails after the stream has started, an error event in the same shape as the error body below is sent before [DONE].
curl https://meriq.ai/v1/chat/completions \
-H "Authorization: Bearer mrq_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"model": "meriq",
"messages": [{"role": "user", "content": "Hello"}]
}'Tool calling
Meriq supports standard OpenAI function calling. Send your schemas in tools and they are passed to the model untouched; when it decides to call one you get tool_calls back with finish_reason: "tool_calls". Reply with a role: "tool" message carrying the matching tool_call_id to continue the loop. This is what agent harnesses expect, so pointing one at Meriq works without changes.
{
"model": "meriq",
"messages": [{"role": "user", "content": "What's the weather in Paris?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
}]
}If a model cannot use tools, the request is rejected with 400 tools_not_supported rather than silently answering in prose. Check supports_tools on /v1/models before sending.
Server-side tools
Meriq can also run tools for you. They need a key with the search scope and a model that supports tool calling. Models that can use them list them in server_tools on /v1/models. Dashboard keys start with only chat, so tick search when you create the key. Add them alongside your own functions:
| Tool | Declare as | Cost |
|---|---|---|
| Web search | {"type": "web_search"} | $0.001 per search on wallet-billed calls, on top of tokens. Not charged when the call bills plan usage. |
| Web fetch | {"type": "web_fetch"} | No fee. Page content is billed as input tokens. |
Meriq runs these internally, up to 8 model passes per request, and returns the finished answer. The tool calls never surface in your response. If you define your own function with the same name, yours wins and Meriq's is not added.
List models
GET /v1/models · any scope
Returns the models your key can call, with per-model prices (including cached_input_price_per_million), limits, default_max_tokens, supported_parameters, and whether the model is eligible for plan usage on your subscription. GET /v1/models/{id} returns a single entry.
curl https://meriq.ai/v1/models \ -H "Authorization: Bearer mrq_your_key_here"
Balance
GET /v1/me/balance · scope account-read
Returns your wallet balance, month-to-date spend, whether wallet fallback is on, and the state of each usage window if your plan includes API usage.
{
"balance_usd": 24.8102,
"wallet_fallback_enabled": false,
"month_spend_usd": 5.1898,
"subscription_usage": {
"eligible_models": ["meriq", "meriq-pro"],
"windows": {
"session": {"used_usd": 0.12, "limit_usd": 0.5, "pct_used": 24, "reset_at": "..."}
}
}
}Usage history
GET /v1/usage · scope account-read
Your most recent calls, newest first. limit sets the page size (default 50, max 200); refunded=true returns only refunded refusals.
{
"object": "list",
"data": [{
"id": "...",
"request_id": "chatcmpl-...",
"created": 1767225600,
"endpoint": "/v1/chat/completions",
"model": "meriq",
"prompt_tokens": 812,
"completion_tokens": 240,
"total_tokens": 1052,
"cost_usd": 0.0013,
"billed_to": "wallet",
"refunded": false
}]
}cost_usd is null on plan-billed calls.
Request IDs
Every /v1 response, including errors, carries an X-Request-Id header. On chat completions it equals the completion id. Error bodies repeat it as error.request_id, and /v1/usage returns it as request_id. Quote it when you contact support.
Web search
POST /v1/search · scope search
Runs a cited web search and returns results with citations. Always billed to the wallet: $0.001 per request. max_results is 1 to 10; query is up to 4,000 characters. A search that returns no usable evidence is not charged.
curl https://meriq.ai/v1/search \
-H "Authorization: Bearer mrq_your_key_here" \
-H "Content-Type: application/json" \
-d '{"query": "latest AI research", "max_results": 5}'Limits
| Limit | Value |
|---|---|
| Requests per minute, per key | The key's rate limit, 60/min by default. Shown on each key in the dashboard. |
| Chat completions, per account | 300/min across all keys |
| Web search endpoint | 30/min |
| Other endpoints | 2000 per hour |
| Server-side tool passes | 8 per request |
| Function tools | 128 per request |
| Messages | 4 per 1K tokens of context, at least 256, at most 4,096. See max_messages on /v1/models. |
| Prompt size | About 4 characters per token of context. See max_prompt_characters on /v1/models. |
Default max_tokens | min(4,096, model max output) |
Abuse protection can also return 429. Every 429 carries a Retry-After header in seconds.
Account export and deletion
GET /v1/me/export (scope exports) and DELETE /v1/me (scope account-write) return 202 with a durable action ID, status URL, and first-party confirmation URL. Repeated requests reuse the recorded action. A request pending confirmation has not exported or deleted anything.
Open the confirmation URL while signed in as the owner. Export requires password verification or the applicable social-account confirmation and an operation-specific session grant. An API key cannot unlock saved content. Archives include a versioned completeness manifest, expire after one hour, and require a fresh download grant after ten minutes. Browser-only conversations require a browser export.
Confirmed deletion reports processing, failed_retryable, or completed. Processing waits for active work and cleanup acknowledgments from storage servers. Minimal billing and required security records follow the Privacy Policy. The receipt URL shows status for seven days without exposing account content.
Key management
Manage keys programmatically with an account-read / account-write scoped key:
GET/v1/keyslists your keysPOST/v1/keyscreates a key. A child key can never hold scopes its parent lacks, and a key with a monthly budget cannot create keys.POST/v1/keys/{id}/revokerevokes a key
Image generation and file upload endpoints are not available yet and return 501 not_implemented.
Errors
Every error is returned as:
{
"error": {
"message": "Human-readable explanation.",
"type": "invalid_request_error",
"code": "invalid_parameter",
"param": "temperature",
"request_id": "chatcmpl-..."
}
}param appears when one field caused the error. Rate limits add a top-level rate_limit object with reset_at and retry_after_seconds.
| Status | Type | Codes | Meaning |
|---|---|---|---|
| 400 | invalid_request_error | invalid_json, invalid_parameter, unsupported_parameter, tools_not_supported, unsupported_tool_type | Malformed body, a value out of range, or a field this API does not support. |
| 401 | authentication_error | missing_api_key, invalid_api_key, revoked_api_key | Missing, unknown, or revoked key. |
| 402 | payment_required | insufficient_balance | Wallet balance too low for this call. Add funds in the dashboard ($5 minimum). |
| 402 | budget_exceeded | budget_exceeded | The key's monthly budget would be exceeded. The error carries budget_usd and spent_usd. |
| 403 | insufficient_scope | insufficient_scope | The key lacks the scope named in required_scope. |
| 403 | permission_error | model_not_available, not_on_plan, search_disabled, budgeted_key_cannot_create_keys | Your plan or key cannot use this model or feature. |
| 403 | authentication_error | account_suspended, password_change_required | The account cannot use the API until the issue is resolved in the web app. |
| 404 | not_found_error | unsupported_endpoint, not_found | Unknown endpoint, or the resource does not exist. |
| 404 | invalid_request_error | model_not_found | The model id does not exist or is not available to your key. |
| 405 | invalid_request_error | method_not_allowed | Wrong HTTP method for this endpoint. |
| 409 | account_deletion_pending | account_deletion_pending | The account is being deleted. |
| 413 | invalid_request_error | too_many_messages, context_length_exceeded, request_too_large | Message count, prompt size, or body size exceeds the limit. |
| 429 | rate_limit_error | rate_limit_exceeded, usage_limit_exceeded, too_many_requests | Per-minute limit, exhausted plan usage window, or abuse protection. Honour Retry-After. |
| 500 | server_error | internal_error | Unexpected failure. Nothing is charged. |
| 501 | not_implemented | not_implemented | Endpoint not available yet. |
| 503 | server_error | providers_unavailable | Every provider for the model is unavailable. Nothing is charged; retry shortly. |
| 503 | service_unavailable | api_disabled | The API is turned off. |
| 503 | search_unavailable | search_unavailable | Search returned no usable evidence. Not charged. |
A streamed call that fails mid-response sends a final error event with type: "server_error" and code stream_error, providers_unavailable, or internal_error.
Use with coding tools
Any tool that speaks the OpenAI chat completions API can use Meriq. The settings below are configured for each tool, not tested with every version. Replace <MODEL_ID>, <CONTEXT> and <MAX_OUTPUT> with id, context_length and max_output_tokens from /v1/models, and pick a model with supports_tools: true for agent workflows.
OpenCode
Configured for opencode.json. Set MERIQ_API_KEY in your environment.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"meriq": {
"npm": "@ai-sdk/openai-compatible",
"name": "Meriq",
"options": {
"baseURL": "https://meriq.ai/v1",
"apiKey": "{env:MERIQ_API_KEY}"
},
"models": {
"<MODEL_ID>": {
"name": "<MODEL_ID>",
"limit": { "context": <CONTEXT>, "output": <MAX_OUTPUT> }
}
}
}
}
}Cline
Configured for the Cline settings panel:
API Provider: OpenAI Compatible Base URL: https://meriq.ai/v1 API Key: mrq_your_key_here Model ID: <MODEL_ID> Context Window Size: <CONTEXT> Max Output Tokens: <MAX_OUTPUT>
Aider
Configured for Aider's OpenAI-compatible mode. Set max_tokens, or Aider uses the API default of min(4,096, model max output) and long edits stop with finish_reason: "length".
export OPENAI_API_BASE=https://meriq.ai/v1 export OPENAI_API_KEY=mrq_your_key_here aider --model openai/<MODEL_ID>
.aider.model.settings.yml:
- name: openai/<MODEL_ID>
extra_params:
max_tokens: <MAX_OUTPUT>.aider.model.metadata.json:
{
"openai/<MODEL_ID>": {
"max_input_tokens": <CONTEXT>,
"max_output_tokens": <MAX_OUTPUT>,
"litellm_provider": "openai",
"mode": "chat"
}
}Continue
Configured for config.yaml:
models:
- name: Meriq <MODEL_ID>
provider: openai
model: <MODEL_ID>
apiBase: https://meriq.ai/v1
apiKey: mrq_your_key_here
defaultCompletionOptions:
contextLength: <CONTEXT>
maxTokens: <MAX_OUTPUT>
roles:
- chat
- editCursor
Configured for chat only. Tab completion and other built-in features keep using Cursor's own models.
Settings > Models > API Keys OpenAI API Key: mrq_your_key_here Override OpenAI Base URL: https://meriq.ai/v1 Add model: <MODEL_ID>
Create your first key and fund your wallet in the API dashboard.