Base URL
All requests are made against a single host. The version segment is part of the base URL.
https://api.prbycode.com/v1POST /v1/chat/completionsPOSTPOST /v1/messagesPOSTGET /v1/modelsGETGET /v1/quotaGETAuthentication
Send the key as a bearer token. The Anthropic-shaped endpoint also accepts the key in an x-api-key header.
Authorization: Bearer prby_live_••••••••••••- Accepted header
Authorization: Bearer <key>- Alternative
x-api-key: <key>- Key format
prby_live_…- Rotation
- Issue a new key, deploy it, then revoke the old one
Conventions
- Request and response bodies are JSON encoded as UTF-8.
- Timestamps in responses are ISO 8601 UTC.
- Token counts follow the routed model's own tokenizer.
- Every response includes an
x-prbycode-request-idheader. - Unknown fields in a request body are ignored rather than rejected.
POST /v1/chat/completions
Create a model response from a list of messages. This is the endpoint most clients use.
curl https://api.prbycode.com/v1/chat/completions \
-H "Authorization: Bearer $PRBYCODE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"messages": [
{ "role": "system", "content": "You are a concise assistant." },
{ "role": "user", "content": "Summarise the request lifecycle." }
],
"max_tokens": 512,
"temperature": 0.7,
"stream": false
}'POST /v1/messages
The Anthropic-compatible shape. Differences from the chat completions endpoint are the API key header, the required max_tokens field, and system as a top-level field.
curl https://api.prbycode.com/v1/messages \
-H "x-api-key: $PRBYCODE_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"system": "You are a concise assistant.",
"messages": [{ "role": "user", "content": "Hello" }]
}'GET /v1/models
Return the models routable with the presented key.
{
"object": "list",
"data": [
{
"id": "claude-sonnet-5",
"object": "model",
"owned_by": "anthropic",
"context_window": 1000000
},
{
"id": "glm-5.3-flash",
"object": "model",
"owned_by": "zhipu ai",
"context_window": 256000
}
]
}Catalog
The same set, with pricing, in table form.
| Model | Model ID | Context | Input / 1M | Output / 1M |
|---|---|---|---|---|
| Claude Sonnet 5 | claude-sonnet-5 | 1M | $3.00 | $15.00 |
| GLM 5.3 Flash | glm-5.3-flash | 256K | $0.25 | $1.10 |
| GLM 5.2 | glm-5.2 | 256K | $0.60 | $2.20 |
| DeepSeek V4 Pro | deepseek-v4-pro | 256K | $0.90 | $3.40 |
| DeepSeek V4.1 Flash | deepseek-v4.1-flash | 256K | $0.20 | $0.80 |
| GPT 5.6 Luna | gpt-5.6-luna | 1M | $2.50 | $10.00 |
- Claude Sonnet 5claude-sonnet-5 · 1M · $3.00 in / $15.00 out
- GLM 5.3 Flashglm-5.3-flash · 256K · $0.25 in / $1.10 out
- GLM 5.2glm-5.2 · 256K · $0.60 in / $2.20 out
- DeepSeek V4 Prodeepseek-v4-pro · 256K · $0.90 in / $3.40 out
- DeepSeek V4.1 Flashdeepseek-v4.1-flash · 256K · $0.20 in / $0.80 out
- GPT 5.6 Lunagpt-5.6-luna · 1M · $2.50 in / $10.00 out
GET /v1/quota
Inspect plan status, token allowance and current rate limit standing without opening the console.
{
"object": "quota",
"plan": "Monthly",
"period": {
"start": "2026-09-18",
"renews": "2026-10-18"
},
"tokens": {
"used": 412884000,
"total": 1000000000
},
"rate_limit": {
"limit": 600,
"remaining": 574,
"reset_at": "2026-09-20T04:00:00Z"
}
}Request parameters
Fields accepted by /v1/chat/completions. Availability depends on the routed model — see the parameters tab on any model page.
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID from the catalog. Falls back to the default route when omitted. |
messages | array | Yes | Conversation history as { role, content } objects. |
stream | boolean | No | Return server-sent events instead of a single JSON body. |
temperature | number | No | Sampling temperature. Model defaults apply when omitted. |
top_p | number | No | Nucleus sampling probability mass. |
max_tokens | integer | No | Upper bound on completion tokens. |
tools | array | No | Function definitions the model may call. |
tool_choice | string | object | No | Whether and which tool the model must call. |
response_format | object | No | Request a JSON response shape. |
stop | string | array | No | Sequences that terminate generation. |
user | string | No | Stable end-user identifier for abuse attribution. |
- modelYesstring · Model ID from the catalog. Falls back to the default route when omitted.
- messagesYesarray · Conversation history as { role, content } objects.
- streamNoboolean · Return server-sent events instead of a single JSON body.
- temperatureNonumber · Sampling temperature. Model defaults apply when omitted.
- top_pNonumber · Nucleus sampling probability mass.
- max_tokensNointeger · Upper bound on completion tokens.
- toolsNoarray · Function definitions the model may call.
- tool_choiceNostring | object · Whether and which tool the model must call.
- response_formatNoobject · Request a JSON response shape.
- stopNostring | array · Sequences that terminate generation.
- userNostring · Stable end-user identifier for abuse attribution.
Response object
A non-streamed response is a standard completion object with usage counters attached.
{
"id": "req_8f21c0d4a7b2",
"object": "chat.completion",
"created": 1789000000,
"model": "claude-sonnet-5",
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "Requests enter the gateway, are validated and metered, then routed to a healthy model."
}
}
],
"usage": {
"prompt_tokens": 38,
"completion_tokens": 24,
"total_tokens": 62
}
}Errors
Failures use conventional status codes and a JSON body carrying a machine-readable type plus a request ID.
{
"error": {
"type": "rate_limit_error",
"code": 429,
"message": "Rate limit reached for this API key. Retry after the window resets.",
"request_id": "req_8f21c0d4a7b2"
}
}Status codes
Whether a retry is worth attempting.
- 400Body failed validation. Fix the payload before retrying.
invalid_request_error - 401The key is missing, revoked or malformed.
authentication_error - 403The key's scope does not permit this model or endpoint.
permission_error - 404Unknown model ID or path.
not_found_error - 429Per-key rate limit or plan allowance reached.
rate_limit_error - 500Provider failure inside the routed model.
upstream_error - 504The routed model exceeded the request timeout.
timeout_error
Rate limits
Limits are enforced per key. Response headers report the remaining budget so a client can back off before it is refused.
- Remaining requests
x-ratelimit-remaining-requests- Remaining tokens
x-ratelimit-remaining-tokens- Reset time
x-ratelimit-reset- Back-off hint
retry-after