API documentation

Send your first request, then open the reference section you need.

Inference base URL

https://zapros.ai/api/v1

Base URL for inference requests with a zpr_ key. OpenAPI specification

Quickstart
  1. 1. Create an account

    Register and verify your email.

  2. 2. Create an API key

    Create a zpr_ key under API keys.

  3. 3. Send a request

    Use the example below. Email verification grants a ₽10 welcome credit.

curl (bash)
# Set ZAPROS_API_KEY in the environment. Generate the request key once.
# Keep the same IDEMPOTENCY_KEY value for a retry.
IDEMPOTENCY_KEY="$(uuidgen)"

curl https://zapros.ai/api/v1/chat/completions \
  -H "Authorization: Bearer ${ZAPROS_API_KEY:?set ZAPROS_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -d '{
    "model": "openai/gpt-5-nano",
    "messages": [{"role":"user","content":"Hello!"}],
    "max_tokens": 64
  }'
Authentication

Inference endpoints use Authorization: Bearer zpr_.... Anthropic Messages also accepts the same key through x-api-key for official SDK compatibility; when both headers are present, they must contain the same key. Management REST and MCP accept separately scoped, manually provisioned zpm_... tokens. Each surface also accepts short-lived zpo_... access tokens issued for its exact resource. MCP and Management OAuth grants are separate and their tokens are not interchangeable.

Chat Completions

POST /api/v1/chat/completions supports the familiar OpenAI request format, function tools and SSE streaming. Exact parameter support depends on the selected model. Always set a finite output limit for generative requests.

Python
import uuid
from openai import OpenAI

client = OpenAI(
    api_key="zpr_your_key",
    base_url="https://zapros.ai/api/v1",
)
idempotency_key = str(uuid.uuid4())

response = client.chat.completions.create(
    model="openai/gpt-5-nano",
    messages=[{"role": "user", "content": "Hello!"}],
    max_tokens=512,
    stream=False,
    extra_headers={"Idempotency-Key": idempotency_key},
)
print(response.choices[0].message.content)
Project presetsUse a saved model and message through an @preset reference.

In Chat Playground, use a Project preset's Copy API reference action and send the resulting private @preset/<UUIDv4> value as the whole primary model. Zapros resolves it only inside the exact organization, workspace, and project of the authenticated zpr_ key. A foreign, deleted, malformed, or nested saved reference returns the same opaque HTTP 404 project_request_preset_not_found. A lookup failure returns HTTP 503 project_request_preset_unavailable. Browser-local presets are not callable through the API.

The saved model becomes the request model. When the request omits its own messages property entirely and the saved prompt is non-empty, Zapros supplies exactly one user message. Any explicit messages value wins: null, an empty array, and other invalid values are never replaced and are rejected by normal Chat validation. All other request fields retain the existing bounded managed, BYOK, direct-provider, and streaming validation and routing behavior.

Project preset — JSON Chat
# Set the zpr_ secret safely in the environment before the first attempt.
PRESET_MODEL="@preset/00000000-0000-4000-8000-000000000000" # paste the entire Copy API reference
# Generate once for this request and retain it for an exact retry.
IDEMPOTENCY_KEY="$(uuidgen)"

curl https://zapros.ai/api/v1/chat/completions \
  -H "Authorization: Bearer ${ZAPROS_API_KEY:?set ZAPROS_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  --data "$(printf '{"model":"%s","stream":false,"max_tokens":256}' "$PRESET_MODEL")"

Do not generate a new Idempotency-Key when retrying the same intent. Retain the first-attempt value and resend it with the identical JSON body.

Only the primary model accepts this reference. References in fallback models are unsupported. A separate top-level preset returns HTTP 400 unsupported_preset, while combined model-id@preset/... syntax returns HTTP 400 unsupported_combined_preset. This is a bounded Zapros reference, not OpenRouter Presets REST: it does not apply parameter profiles, tools, a system prompt, or a version pin. The stored prompt is always a user message, unlike an OpenRouter system-prompt preset.

A new call resolves the latest saved snapshot locally. The resolved model then participates in catalog, key-allowlist, budget, routing, and billing checks, and the alias is never sent upstream. Zapros hashes the raw body before preset lookup, so an exact retry with the same zpr_, Idempotency-Key, and body replays the original stored JSON response even after the preset is updated or deleted. A new key starts a new call against the current snapshot.

Provider preferencesRouting preferences can change model availability and price.

Chat Completions, Responses, and both Messages aliases accept the same strict provider object for OpenRouter-backed models. Supported fields are sort (price, throughput, or latency), allow_fallbacks, plus only, ignore, and order. Each of those three fields accepts one to eight unique lowercase OpenRouter base-provider slugs without endpoint or paid-tier suffixes. only is an allowlist and ignore is a denylist; array order has no priority meaning for either. orderdoes prioritize its listed providers. With allow_fallbacks: true, it is not an allowlist: OpenRouter may use another eligible provider after the ordered candidates are unavailable. Combine it with allow_fallbacks: false to restrict fallback outside that list. When order is present, OpenRouter does not apply sort. quantizations accepts one to twelve unique values: int4, int8, fp4, mxfp4, nvfp4, fp6, fp8, mxfp8, fp16, bf16, fp32, or unknown. Also supported are the privacy-tightening data_collection: deny and zdr: true, and the optional compatibility assertion require_parameters: true. Zapros always enforces parameter support and its own price ceiling; client max_price and provider-specific options remain rejected. Routing fields are sent upstream only for requests dispatched through OpenRouter; direct providers reject them. Preferences can reduce availability and can change the final RUB charge within the reserved ceiling. Privacy preferences constrain inference endpoints, not third-party tool backends. Eligible GET /api/v1/modelsentries include a provider_endpoints_url. Fetch that URL with a normal Authorization: Bearer zpr_... inference key to discover current base slugs accepted by only, ignore, and order, while each returned quantization is accepted by quantizations. Discovery has a separate per-key rate limit, performs no inference, and does not reserve or charge balance.

JSON
"provider": {
  "sort": "throughput",
  "allow_fallbacks": true,
  "order": ["azure", "openai"],
  "ignore": ["novita"],
  "quantizations": ["fp8", "bf16"],
  "data_collection": "deny",
  "zdr": true,
  "require_parameters": true
}
Your provider key (BYOK)Your provider bills model usage; Zapros charges 0.01 RUB per committed dispatch.
BYOK models, parameters, and restrictions

Chat Completions can use an external OpenRouter, OpenAI, Anthropic, Google, DeepSeek, or Mistral balance. Store one active key for the selected provider under Providers, then send provider.credential_mode: byok, select the stored key with provider.credential_provider set to openrouter, openai, anthropic, google, deepseek, or mistral, and send a unique first-attempt Idempotency-Key. With credential_provider: openrouter, the existing bounded Chat surface remains available with stream: false or stream: true: requested fallback models, client tools and legacy function calling, structured output, image/PDF inputs, capped web search and plugins, and all provider preferences documented above, including allow_fallbacks. The request still uses exactly the selected stored OpenRouter key. The same exact selector enables native Anthropic Messages JSON and one-shot SSE on both Messages URLs while retaining native system/messages, tools, requested model fallbacks, and bounded provider preferences. Direct providers require stream: false and keep a narrower contract: one exact scalar-text model without fallbacks, tools/functions, media, web search/plugins, or structured output. Direct OpenAI accepts only openai/gpt-5-mini; direct Anthropic accepts only stable anthropic/claude-sonnet-5.5, mapped to native claude-sonnet-5-5 through the fixed https://api.anthropic.com/v1/messages; direct Google accepts only google/gemini-3.8-flash; direct DeepSeek accepts only the non-thinking deepseek/deepseek-v4.1-flash slice and rejects reasoning controls; direct Mistral accepts only the Public Preview mistralai/mistral-large-4-0 with reasoning disabled and rejects reasoning controls. A direct-provider body may contain only model, messages, stream, provider, and one of max_tokens or max_completion_tokens. Every message has exactly a system, user, or assistant role and string content; sampling fields and store are rejected. For Anthropic, one or more leading system messages are combined in its native system field; the conversation must then start and end with a user message, so later system messages and assistant prefills are rejected. Zapros always sends adaptive thinking with high effort to Anthropic: caller reasoning or thinking controls are rejected, and thinking blocks are omitted from the OpenAI-compatible response while still included in billed completion_tokens. Direct Anthropic is available through this Chat Completions endpoint; native Messages may select only a stored OpenRouter key and never select the stored direct Anthropic key. All direct providers reject provider.only, ignore, order, quantizations, sort, data_collection, zdr, and require_parameters; allow_fallbacks may only be false. Zapros never retries an upstream call, switches credential providers, or uses its managed key, and charges 0.01 RUB per committed dispatch attempt; the selected provider bills the model cost to the external account separately. Zapros consumes credential_mode and credential_provider locally and never forwards them upstream. Use a directly created zpr_ key: OAuth-delegated keys are rejected until consent can grant BYOK explicitly. A spend-limited key authorizes a conservative catalog hold and consumes that full authorization after dispatch, independently of the 0.01 RUB Zapros wallet charge. OpenRouter may perform only the bounded model and endpoint fallbacks requested by the caller, using that same stored credential; this is not a Zapros retry or fallback to managed credit. You may independently set only to base slugs such as ["azure"]; Zapros forwards that allowlist to OpenRouter.

An OpenRouter BYOK Chat, Responses, or native Messages stream is delivered only once. Its first SSE response has Idempotency-Replayed: false, and the record is already terminally non-replayable before the response is returned. Zapros stores no stream transcript and supports neither resume nor Last-Event-ID: an exact same-key/body retry after start, disconnect, cancellation, or completion returns HTTP 409 idempotency_replay_unavailable with the stable X-Request-ID and no provider redispatch. A pre-stream JSON error is instead stored and replayed exactly with Idempotency-Replayed: true. The 0.01 RUB fee obligation is durably committed before the SSE is returned and remains due after cancellation, disconnect, or a mid-stream error. If the inline ledger mutation does not finish, reconciliation completes it. A proven pre-dispatch failure releases the reservation without a fee. Cancellation propagates to OpenRouter on a best-effort basis, but the provider may continue processing or billing. The live stream may contain a final usage chunk; this initial slice does not promise terminal token or status analytics from Zapros. Private upstream cost fields, including cost, cost_details, and is_byok, are not forwarded.

OpenRouter BYOK — JSON body
{
  "model": "openai/gpt-5-nano",
  "models": ["openai/gpt-5-mini"],
  "messages": [
    { "role": "user", "content": "Return a JSON object with one greeting" }
  ],
  "stream": false,
  "response_format": { "type": "json_object" },
  "provider": {
    "credential_mode": "byok",
    "credential_provider": "openrouter",
    "allow_fallbacks": true,
    "sort": "price"
  }
}
OpenRouter: streaming
OpenRouter BYOK — streaming curl
IDEMPOTENCY_KEY="$(uuidgen)"
curl -N https://zapros.ai/api/v1/chat/completions \
  -H "Authorization: Bearer zpr_your_key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -d '{
    "model": "openai/gpt-5-nano",
    "messages": [{"role":"user","content":"Hello!"}],
    "stream": true,
    "provider": {
      "credential_mode": "byok",
      "credential_provider": "openrouter",
      "allow_fallbacks": true
    }
  }'
OpenAI: direct key
Direct OpenAI BYOK — JSON body
{
  "model": "openai/gpt-5-mini",
  "messages": [
    { "role": "user", "content": "Explain quantization in two sentences" }
  ],
  "stream": false,
  "max_tokens": 256,
  "provider": {
    "credential_mode": "byok",
    "credential_provider": "openai",
    "allow_fallbacks": false
  }
}
Anthropic: direct key
Direct Anthropic BYOK — JSON body
{
  "model": "anthropic/claude-sonnet-5.5",
  "messages": [
    { "role": "system", "content": "Keep the answer concise" },
    { "role": "user", "content": "Explain quantization in two sentences" }
  ],
  "stream": false,
  "max_tokens": 256,
  "provider": {
    "credential_mode": "byok",
    "credential_provider": "anthropic",
    "allow_fallbacks": false
  }
}
Google: direct key
Direct Google BYOK — JSON body
{
  "model": "google/gemini-3.8-flash",
  "messages": [
    { "role": "user", "content": "Explain quantization in two sentences" }
  ],
  "stream": false,
  "max_tokens": 256,
  "provider": {
    "credential_mode": "byok",
    "credential_provider": "google",
    "allow_fallbacks": false
  }
}
DeepSeek: direct key
Direct DeepSeek BYOK — JSON body
{
  "model": "deepseek/deepseek-v4.1-flash",
  "messages": [
    { "role": "user", "content": "Explain quantization in two sentences" }
  ],
  "stream": false,
  "max_tokens": 256,
  "provider": {
    "credential_mode": "byok",
    "credential_provider": "deepseek",
    "allow_fallbacks": false
  }
}
Mistral: direct key
Direct Mistral BYOK — JSON body
{
  "model": "mistralai/mistral-large-4-0",
  "messages": [
    { "role": "user", "content": "Explain quantization in two sentences" }
  ],
  "stream": false,
  "max_tokens": 256,
  "provider": {
    "credential_mode": "byok",
    "credential_provider": "mistral",
    "allow_fallbacks": false
  }
}
Retries, errors, and response storageReuse the request key for the same intent; a new key can cause a new charge.

Non-streaming POST /api/v1/chat/completions, POST /api/v1/responses, and Anthropic Messages optionally accept an 8–128-character visible-ASCII Idempotency-Key. Generate one key per intended request and send it on the first attempt. Every BYOK request requires the key. Adding it only after an unkeyed request times out cannot associate with or deduplicate the original and may cause a second paid provider call. A retry must also use the same zpr_ credential and logical endpoint: rotating credentials or switching among Chat Completions, Responses, and Messages creates a distinct dedupe scope and may issue another paid call. The /v1/messages and /api/v1/messages aliases share one logical scope, so an exact retry may switch between them. For a retry within 24 hours, reuse that key with the same JSON body (the complete parsed JSON is compared). A stored JSON response up to 256 KiB is replayed without another provider call. If the original response is non-JSON or too large, the retry returns HTTP 409 idempotency_replay_unavailable without another provider call. A changed body or a first request that is still in progress also returns HTTP 409. OpenRouter BYOK Chat, Responses, and native Messages are the streaming exceptions: the header is required, the first SSE is returned once, and any exact retry after stream start gets HTTP 409 idempotency_replay_unavailable without provider redispatch. A pre-stream JSON response is still replayed exactly. Managed streaming with the header remains unsupported and returns HTTP 400; direct-provider BYOK requires stream: false.

When the current attempt passes authentication and rate limiting, then successfully matches or creates the durable idempotency record, X-Request-ID remains stable. Idempotency-Replayed: true means one thing only: the exact stored response body was returned. A value of falsemeans no body was replayed; it is used for the owning attempt's response and for an in-progress or replay-unavailable HTTP 409. An in-progress response additionally includes Retry-After: 2. Every retry first passes authentication and rate limiting again. Pre-lookup HTTP 401, 429 or 503 responses, invalid input, and changed-body conflicts may omit these headers or use an attempt-local request ID. To support replay, the bounded JSON response snapshot (up to 256 KiB) is stored in plaintext in the database for 24 hours. This storage rule applies to JSON responses from supported idempotent inference operations: optional non-streaming text requests, required OpenRouter BYOK Responses, Messages, embeddings, and rerank, pre-stream OpenRouter BYOK JSON responses, and required video-submission protection. Rerank snapshots can contain echoed document text. The SSE itself retains only a terminal record; no chunks or transcript are stored. The raw Idempotency-Key is not stored—only its SHA-256 hash is retained. This replay layer does not store the raw request body either; conflict detection retains only a SHA-256 hash of its canonical JSON.

The snapshot preserves the HTTP status and JSON body, including terminal 402 and 5xx errors, plus Content-Type. Other original provider headers, such as Retry-After, are not replayed; current CORS and rate-limit headers are recomputed on replay. After idempotency_in_progress, retry the same key in two seconds. For idempotency_replay_unavailable or the stable HTTP 502 provider_response_unavailable, never switch keys for the same intent—contact support with X-Request-ID. Only idempotency_abandoned proves the provider was not called and makes a new key safe.

Never retry or reuse an Idempotency-Key after the 24-hour replay window. Once its record is cleaned up, the old key can be accepted as a new paid provider call. Otherwise, generate a fresh key only for a genuinely new intended request. The narrow exception is an explicit idempotency_abandoned result: it proves no provider call occurred, so the same intent may safely retry under a new key.

Anthropic Messages

The official Anthropic SDK receives native Messages JSON and SSE events without conversion to an OpenAI shape. Set its base URL to https://zapros.ai; the SDK calls POST /v1/messages. The OpenRouter-shaped alias is POST /api/v1/messages. Without a credential selector the request uses managed credit. To bill a stored OpenRouter account, pass credential_mode: byok and credential_provider: openrouter in the native provider object. Zapros consumes both selector fields locally; both URLs share one billing and idempotency identity.

Python
import anthropic
from uuid import uuid4

client = anthropic.Anthropic(
    api_key="zpr_your_key",
    base_url="https://zapros.ai",
    max_retries=0,
)

message = client.messages.create(
    model="anthropic/claude-sonnet-5.5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
    extra_headers={"Idempotency-Key": str(uuid4())},
)

print(message.content[0].text)
OpenRouter BYOK Messages — JSON
message = client.messages.create(
    model="anthropic/claude-sonnet-5.5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
    extra_body={
        "provider": {
            "credential_mode": "byok",
            "credential_provider": "openrouter",
            "allow_fallbacks": True,
        }
    },
    extra_headers={"Idempotency-Key": str(uuid4())},
)
print(message.content[0].text)
OpenRouter BYOK Messages — one-shot SSE
with client.messages.stream(
    model="anthropic/claude-sonnet-5.5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
    extra_body={
        "provider": {
            "credential_mode": "byok",
            "credential_provider": "openrouter",
        }
    },
    extra_headers={"Idempotency-Key": str(uuid4())},
) as stream:
    for text in stream.text_stream:
        print(text, end="")

max_tokens is required. Native system, text messages, client tools, and stream: true are supported. Managed JSON accepts an optional idempotency key, while managed SSE rejects it. Every OpenRouter BYOK Messages JSON or SSE request requires the key on its first attempt. Native JSON up to 256 KiB replays exactly for 24 hours. The first BYOK SSE is delivered once: its record becomesidempotency_replay_unavailable before return, so an exact retry gets HTTP 409 without provider redispatch. There is no transcript, resume, or Last-Event-ID; pre-stream JSON still replays exactly. Both URLs share one deduplication scope. For paid calls, set max_retries=0 and send the idempotency key on the first attempt: an SDK retry after a lost connection can otherwise create a second provider call. Charge-possible HTTP responses also include X-Should-Retry: false. Zapros charges a fixed 0.01 RUB for each committed BYOK dispatch, while the external OpenRouter account pays model cost. Before SSE return the fee obligation becomes durable and remains due after cancellation, disconnect, or a stream error; reconciliation may finish the ledger settlement.

Responses API

POST /api/v1/responses supports reasoning, structured outputs, client function tools, image/PDF input and streaming events. Use store: false and pass complete history in input;previous_response_id is not supported.

JavaScript
const idempotencyKey = crypto.randomUUID();

const response = await client.responses.create({
  model: "openai/gpt-5-nano",
  input: "Explain quantum entanglement briefly",
  max_output_tokens: 1024,
  reasoning: { effort: "medium" },
  store: false,
}, {
  headers: { "Idempotency-Key": idempotencyKey },
});

console.log(response.output_text);

OpenRouter BYOK

Responses can charge model cost to a stored OpenRouter account in JSON or SSE mode; managed credit remains the default. Send provider.credential_mode: byok and provider.credential_provider: openrouter alongside any bounded provider preferences documented above. Both credential fields are consumed locally and never forwarded. This path supports stream: false and stream: true and requires a directly created zpr_ key, exactly one active OpenRouter credential in its workspace, and a fresh Idempotency-Key on the first attempt. Zapros makes one upstream call without a retry, managed-credit fallback, or credential switch. Each committed dispatch charges a fixed 0.01 RUB Zapros endpoint fee, while the external OpenRouter account pays model cost. A spend-limited key separately consumes a conservative catalog budget authorization after dispatch.

OpenRouter BYOK Responses — JSON
IDEMPOTENCY_KEY="$(uuidgen)"
curl https://zapros.ai/api/v1/responses \
  -H "Authorization: Bearer zpr_your_key" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5-nano",
    "input": "Explain quantum entanglement briefly",
    "stream": false,
    "store": false,
    "max_output_tokens": 1024,
    "provider": {
      "credential_mode": "byok",
      "credential_provider": "openrouter",
      "sort": "price",
      "allow_fallbacks": true
    }
  }'
OpenRouter BYOK Responses — one-shot SSE
IDEMPOTENCY_KEY="$(uuidgen)"
curl -N https://zapros.ai/api/v1/responses \
  -H "Authorization: Bearer zpr_your_key" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5-nano",
    "input": "Explain quantum entanglement briefly",
    "stream": true,
    "store": false,
    "max_output_tokens": 1024,
    "provider": {
      "credential_mode": "byok",
      "credential_provider": "openrouter"
    }
  }'

For 24 hours, retry the same intent with the same inference key, idempotency key, and identical parsed JSON body. A stored JSON response up to 256 KiB replays exactly without another provider call. A larger or non-JSON result becomes terminal HTTP 409 idempotency_replay_unavailable; an ambiguous committed dispatch becomes stable HTTP 502 provider_response_unavailable. Never switch keys for either result. Responses with a durable fee reservation expose X-Zapros-Credential-Mode: byok and the immutable fee snapshot in X-Zapros-Service-Fee-Rub. A successful SSE is delivered only once with no transcript, replay, resume, or Last-Event-ID. Before returning it, Zapros durably commits the 0.01 RUB fee obligation and makes the key terminally idempotency_replay_unavailable. The fee remains due after cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. An exact retry returns HTTP 409 without redispatch.

Bounded openrouter:web_search is available with exa, parallelor perplexity. Set finitemax_uses, max_resultsand max_total_results. Legacy web plugins, X search, audio/video input and output-image tools are rejected.

Embeddings

POST /api/v1/embeddings accepts one string or an array of up to 256 strings. Safe text-only requests are billed by input tokens; media and token-ID arrays remain rejected. Set dimensions to an integer from 1 through 32768 to request an output width, and use a non-empty input_type of at most 64 characters for a model-specific task hint such as search_query or search_document. These values are passed through to OpenRouter, so support still depends on the selected model and provider. Zapros may reject a dimensions-by-batch combination before dispatch when its conservative response-size estimate exceeds the bounded transport limit.

JavaScript
const result = await client.embeddings.create({
  model: "voyageai/voyage-4-large",
  input: ["First document", "Second document"],
  dimensions: 768,
  input_type: "search_document",
});

console.log(result.data[0].embedding);

To pay the model cost from a stored OpenRouter account, send the exact local selector provider: { credential_mode: "byok", credential_provider: "openrouter" }. This non-streaming BYOK path requires a directly createdzpr_ key, exactly one active OpenRouter workspace credential, and a first-attemptIdempotency-Key. Zapros makes one upstream call, never retries or falls back to managed credit, and charges a 0.01 RUB endpoint fee; OpenRouter bills the embedding separately. A spend-limited key also consumes a conservative catalog budget authorization after dispatch.

OpenRouter BYOK
IDEMPOTENCY_KEY="$(uuidgen)"
curl https://zapros.ai/api/v1/embeddings \
  -H "Authorization: Bearer zpr_your_key" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "voyageai/voyage-4-large",
    "input": ["First document", "Second document"],
    "dimensions": 768,
    "input_type": "search_document",
    "provider": {
      "credential_mode": "byok",
      "credential_provider": "openrouter"
    }
  }'

For 24 hours, retry the same intent with the same inference key, idempotency key, and identical parsed JSON body. A JSON response up to 256 KiB replays exactly without another provider call. Larger or non-JSON results become terminal HTTP 409; an ambiguous committed dispatch becomes stable HTTP 502. Never switch keys for either result. The response exposesX-Zapros-Credential-Mode: byok and the immutable fee snapshot inX-Zapros-Service-Fee-Rub after a durable fee reservation. Managed embeddings do not expose this replay contract.

Rerank

POST /api/v1/rerank reorders one to 100 text documents against a query through exactly one stored OpenRouter workspace credential. This first slice is BYOK-only and non-streaming: use a directly created zpr_ key and send an Idempotency-Key on the first attempt. A non-empty inference-key model allowlist must include the exact rerank model ID; add it with “Add an exact model ID” in the key limits dialog when it is not shown in the catalogs.

OpenRouter BYOK rerank
IDEMPOTENCY_KEY="$(uuidgen)"
curl https://zapros.ai/api/v1/rerank \
  -H "Authorization: Bearer zpr_your_key" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "cohere/rerank-v3.5",
    "query": "What is the capital of France?",
    "documents": [
      "Paris is the capital of France.",
      "Berlin is the capital of Germany."
    ],
    "top_n": 1
  }'

The exact body accepts model, query, and one to 100 non-empty string documents, plus optional top_n, user, and session_id. top_n cannot exceed the document count. The JSON body is capped at 128 KiB. Structured or image documents, provider, trace, streaming, and unknown fields are rejected.

Zapros makes one upstream call without retry, credential switch, or managed-credit fallback and charges 0.0100 RUB for a committed dispatch. The external OpenRouter account pays the model cost; the Zapros key budget accounts only for the service fee. Managed rerank is deliberately unavailable because OpenRouter's public machine-readable catalog does not expose authoritative pre-request rerank SKU prices.

For 24 hours, the same inference key, idempotency key, and parsed JSON body replay an exact JSON response up to 256 KiB without redispatch. Rerank responses echo selected document text, so that text is stored in plaintext inside the replay snapshot for the replay window and the snapshot is then scheduled for deletion. Private upstream cost fields are removed; bounded search_units and total_tokens may remain. A committed or ambiguous dispatch keeps the fee; a proven pre-dispatch failure does not.

Image jobs

GET /api/v1/images returns the public catalog and RUB price. Start an asynchronous generation with POST /api/v1/images, then poll GET /api/v1/images/{id} with the exact same inference API key that created the job.

curl
IDEMPOTENCY_KEY="$(uuidgen)"
curl https://zapros.ai/api/v1/images \
  -H "Authorization: Bearer zpr_your_key" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "black-forest-labs/flux-1-schnell",
    "prompt": "A paper lighthouse on a rocky coast",
    "n": 1,
    "size": "1024x1024",
    "quality": "standard",
    "response_format": "url"
  }'
Poll the job
curl "https://zapros.ai/api/v1/images/JOB_ID" \
  -H "Authorization: Bearer zpr_your_key"

The initial surface has one strict configuration: black-forest-labs/flux-1-schnell, one output, 1024x1024, quality: "standard", and response_format: "url". The required prompt is limited to 10,000 characters. Unknown fields and every other value are rejected; streaming and SSE are unsupported.

POST returns HTTP 202 with the small { id, status: "processing", model, cost_rub } envelope. Location and Retry-After say where and when to poll. GET returns pending, processing, completed, or failed. image_url is populated only for completed jobs and error only for failed jobs. A known failed job still returns HTTP 200. Job-state responses include Cache-Control: no-store.

image_url is a provider-hosted HTTPS URL that may expire. Download and persist the result as soon as the job completes: Zapros neither proxies nor stores generated image bytes and does not promise a durable URL.

The first attempt requires a unique 8–128-character visible-ASCII Idempotency-Key. For 24 hours, retry the same intent with the same inference key, idempotency key, and effective request after defaults. Omitting n, size, quality, or response_format is equivalent to sending its documented default explicitly. Zapros replays the original HTTP 202 exactly without another provider dispatch. A changed effective value or concurrent unfinished attempt returns HTTP 409. Do not retry the old key after the window.

This is a Zapros asynchronous extension, not a wire-compatible implementation of OpenRouter's synchronous Images API. Use the published HTTP routes directly: there is no OpenRouter synchronous JSON/SSE response, /images/generations, resume, or Last-Event-ID here.

Audio jobs

GET /api/v1/audio returns the public catalog, supported settings, and RUB price per 1,000 billed UTF-16 code units. Start an asynchronous text-to-speech job with POST /api/v1/audio, then poll GET /api/v1/audio/{id} with the exact same inference API key that created the job.

Create speech
IDEMPOTENCY_KEY="$(uuidgen)"
curl https://zapros.ai/api/v1/audio \
  -H "Authorization: Bearer zpr_your_key" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax/speech-02-hd",
    "input": "Welcome to Zapros!",
    "voice": "wise-woman",
    "response_format": "mp3",
    "speed": 1
  }'
Poll the job
curl "https://zapros.ai/api/v1/audio/JOB_ID" \
  -H "Authorization: Bearer zpr_your_key"

The initial surface supports only minimax/speech-02-hd, the wise-woman voice, MP3, and speed: 1. The public voice alias maps to MiniMax Wise_Woman internally. The input must contain 1–5,000 JavaScript UTF-16 code units and at least one non-whitespace character. Original leading and trailing whitespace is preserved and billed. Unknown fields, streaming, SSE, voice uploads or cloning, reference audio, and other settings are rejected.

The catalog's price_per_1000_characters_rub is the authoritative current tariff. The immutable job quote uses the original input length, rounds up to a whole kopek, and has a 0.01 RUB minimum. Read the catalog instead of hard-coding a price.

POST returns HTTP 202 with the small { id, status: "processing", model, cost_rub } envelope. Location and Retry-After say where and when to poll. GET returns pending, processing, completed, or failed. audio_url is populated only for completed jobs and error only for failed jobs. A known failed job still returns HTTP 200. Responses include Cache-Control: no-store.

audio_url is a provider-hosted HTTPS URL that may expire. Download and persist the MP3 as soon as the job completes: Zapros neither proxies nor stores generated audio bytes and does not promise a durable URL.

The first attempt requires a unique 8–128-character visible-ASCII Idempotency-Key. For 24 hours, retry the same intent with the exact same inference key, idempotency key, and effective request after defaults. Omitting voice, response_format, or speed is equivalent to explicitly sending wise-woman, mp3, and 1. Zapros replays the original HTTP 202 without another provider dispatch. A changed effective request or concurrent unfinished attempt returns HTTP 409. Do not retry the old key after the window.

This is a Zapros asynchronous extension, not a wire-compatible implementation of OpenAI or OpenRouter POST /audio/speech. There is no raw-audio response, streaming, resume, or Last-Event-ID; use the published job routes directly.

Video jobs

Start an asynchronous job with POST /api/v1/videos, then poll GET /api/v1/videos/{id} using a key from the same account. Video is billed per second; the price depends on the model, duration and audio support.

curl
IDEMPOTENCY_KEY="$(uuidgen)"
curl https://zapros.ai/api/v1/videos \
  -H "Authorization: Bearer zpr_your_key" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/veo-3.1-fast",
    "prompt": "A calm aerial shot over a forest",
    "duration": 8
  }'
Python
import uuid
import requests

idempotency_key = str(uuid.uuid4())
response = requests.post(
    "https://zapros.ai/api/v1/videos",
    headers={
        "Authorization": "Bearer zpr_your_key",
        "Idempotency-Key": idempotency_key,
    },
    json={
        "model": "google/veo-3.1-fast",
        "prompt": "A calm aerial shot over a forest",
        "duration": 8,
    },
)
response.raise_for_status()
print(response.json())
JavaScript
const idempotencyKey = crypto.randomUUID();
const response = await fetch("https://zapros.ai/api/v1/videos", {
  method: "POST",
  headers: {
    "Authorization": "Bearer zpr_your_key",
    "Idempotency-Key": idempotencyKey,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "google/veo-3.1-fast",
    prompt: "A calm aerial shot over a forest",
    duration: 8,
  }),
});

if (!response.ok) throw new Error(await response.text());
console.log(await response.json());

Every new job requires a unique 8–128-character visible-ASCII Idempotency-Key. To retry the same request, reuse the same key with the identical JSON body; a different request with the same key returns HTTP 409. Keep the generated key until you receive a response. X-Request-ID and Idempotency-Replayed identify the operation and a safe replay. The guaranteed replay window is 24 hours from the first request; do not retry an old key after that window.

duration accepts only values supported by the model, and audio must be a boolean. For image-to-video models, pass an HTTP(S) URL in image_url. After an unsuccessful submission, reserved funds are returned only when Zapros confirms that the provider did not charge for it.

Streaming

Set stream: true to receive incremental Server-Sent Events. Chat Completions emits choices[].delta; Responses emits typed events such as response.output_text.delta.

JavaScript
const stream = await client.chat.completions.create({
  model: "openai/gpt-5-nano",
  messages: [{ role: "user", content: "Hello!" }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}

Managed streams meter their final usage event automatically. If a connection is interrupted, retry only according to the endpoint semantics; never concatenate a blind duplicate request. Managed streaming does not accept Idempotency-Key. OpenRouter BYOK Chat, Responses, and native Messages instead require it and deliver the SSE once under the terminal non-replayable rules above. Direct-provider BYOK remains non-streaming.

Models & pricing

Use the live catalogs instead of hard-coding a stale model list. Catalogs fail closed if upstream pricing data becomes stale.

Catalogs
# Chat Completions and Responses
curl https://zapros.ai/api/v1/models

# Filtering is applied before opt-in pagination
curl "https://zapros.ai/api/v1/models?q=claude&model_authors=anthropic&input_modalities=text,image&context=100000&sort=context-high-to-low&output_modalities=text&offset=0&limit=100"

# Count and exact current-model lookup
curl "https://zapros.ai/api/v1/models/count?output_modalities=text"
curl "https://zapros.ai/api/v1/model/anthropic/claude-sonnet-5.5"

# Current text models allowed by this inference key
curl -H "Authorization: Bearer zpr_your_key" "https://zapros.ai/api/v1/models/user?offset=0&limit=500&output_modalities=text"

# Embeddings
curl https://zapros.ai/api/v1/embeddings/models

# Audio
curl https://zapros.ai/api/v1/audio

# Video
curl https://zapros.ai/api/v1/videos

Public GET /api/v1/models returns the complete filtered result when both offset and limit are omitted. Supplying either opts into pagination: offset must be 0 or greater and limit must be 1–1000; the omitted member defaults to 0 or 500. The response contains data, pre-pagination total_count, and links.next, plus the Zapros object and feature_pricing extensions.

Supported filters are case-insensitive q over model ID/name, comma-separated model_authors and input_modalities, minimum context, sort=context-high-to-low, and exactly output_modalities=text. Input modalities are text, image, audio, and file; a model must support every requested value. Filtering and sorting happen before pagination.

GET /api/v1/models/count returns { "data": { "count": ... } }. GET /api/v1/model/{author}/{slug} returns one exact current model or a generic 404. Public catalog responses use Cache-Control: no-store; list and single-model responses also carry X-Zapros-Currency: RUB.

These objects are Zapros's safe RUB catalog projection, not OpenRouter's complete USD-denominated Modelwire object. The paths and envelopes are OpenRouter-shaped HTTP, but the official OpenRouter SDK's strict models.list() and models.get() response validators are not a supported contract; use raw HTTP and the published Zapros schema.

GET /api/v1/models/userintersects the current RUB chat catalog with the authenticated key's exact allowed_models; an empty allowlist means every current chat model. Filtering happens before pagination;offset must be 0 or greater, limit must be 1–1000, and output_modalities may be omitted or exactly text. Its private, no-store response contains data, total_count, and links.next, plus optional Zapros object and feature_pricing extensions.

This is an advisory snapshot, not a dispatch guarantee. It does not filter by or promise account balance, remaining budget, stored BYOK credentials, transient provider availability, provider preferences, privacy settings, or guardrails, and it performs no inference, provider call, reservation, or charge.

Pricing fields explicitly identify token rates and fixed request, image and web-search fees. A search engine can add its own fee. Browse the same live data on Models & pricing.

Limits & billing
  • • Rate limit: 200 requests per minute per inference key. Respect HTTP 429 andRetry-After.
  • • Balance and budgets: HTTP 402 means the balance or a configured key budget is insufficient for the bounded reservation.
  • • Per-key controls: configure a monthly ruble budget, a per-request ruble cap and a model allowlist. In-flight reservations count toward the budget.
  • • Settlement: final charges use provider usage where available; unused holds are released and definite pre-processing failures are refunded.

Inspect the current inference key

GET /api/v1/key returns a modern OpenRouter-shaped subset for the zpr_ key supplied as a Bearer credential. It is a local, side-effect-free read: no provider call, generation, reservation or charge occurs, and Idempotency-Key is not required.

GET /api/v1/key
curl https://zapros.ai/api/v1/key \
  -H "Authorization: Bearer zpr_your_key"
Example response
{
  "data": {
    "label": "Production",
    "limit": 1000,
    "limit_remaining": 742.31,
    "limit_reset": "monthly",
    "usage": 245.19,
    "usage_daily": 12.4,
    "usage_weekly": 89.1,
    "usage_monthly": 245.19,
    "byok_usage": 0.03,
    "byok_usage_daily": 0.01,
    "byok_usage_weekly": 0.02,
    "byok_usage_monthly": 0.03,
    "include_byok_in_limit": true,
    "budgets": [],
    "effective_budget": null,
    "is_free_tier": false,
    "is_management_key": false,
    "is_provisioning_key": false,
    "free_model_daily_requests": {"used": 0, "limit": 0, "remaining": 0},
    "allowed_data_regions": [],
    "rate_limit": {"requests": 200, "interval": "1m"},
    "currency": "RUB",
    "zapros": {
      "prefix": "zpr_abcd1234",
      "usage_basis": "current_utc_month_budget_spent_rub",
      "byok_usage_basis": "zapros_fee_only",
      "period_start": "2026-10-01",
      "resets_at": "2026-11-01T00:00:00.000Z",
      "reserved_rub": 12.5,
      "max_request_rub": 100,
      "allowed_models": ["openai/gpt-5-nano"]
    }
  }
}
The OpenRouter-compatible monetary field names are not dollars here. currency: "RUB" and X-Zapros-Currency: RUB mean that one credit equals one ruble. usage and usage_monthly are the authoritative key budget spend for the current UTC calendar month. After a BYOK dispatch, that spend may include consumed conservative budget authorization, while byok_usage* reports only Zapros service fees and excludes the external provider bill. limit_remaining already subtracts active reservations.

usage_daily starts at 00:00 on the current UTC day. usage_weekly covers the current UTC day plus the previous six UTC days. This response deliberately excludes the account wallet balance; use GET /api/v1/management/account with account:read for that. Zapros deliberately does not expose /api/v1/credits: mapping its purchased-USD-credit semantics onto the RUB wallet ledger would be misleading. The response is private and never cached. Its X-RateLimit-* headers describe the separate introspection quota, while data.rate_limit describes inference.

Management API

Management automation can use the separate zpm_namespace. Create and revoke those tokens from Agents & MCP. Public OAuth clients instead request the exact resource https://zapros.ai/api/v1/management. That grant is separate from MCP OAuth, and a token for one resource fails at the other. Neither credential can create management tokens, access payments or top up a balance.

Management OAuth discovery
GET https://zapros.ai/.well-known/oauth-protected-resource/api/v1/management
GET https://zapros.ai/.well-known/oauth-authorization-server
POST https://zapros.ai/oauth/register
GET https://zapros.ai/oauth/authorize?resource=https%3A%2F%2Fzapros.ai%2Fapi%2Fv1%2Fmanagement
POST https://zapros.ai/oauth/token
ScopeAccess
account:readAccount identity and RUB balance
models:readCatalogs, endpoint capabilities, and cost estimation
keys:readInference-key metadata and limits
keys:createCreate bounded inference keys
keys:updateUpdate inference keys
keys:revokePermanently revoke inference keys
usage:readUsage, recent requests, and personal organization, workspace, and project names and IDs
compute:readCurrent and future CPU/GPU resources
Catalog and cost estimate
curl "https://zapros.ai/api/v1/management/models?kind=video&limit=20" \
  -H "Authorization: Bearer zpm_your_management_token"

curl https://zapros.ai/api/v1/management/cost-estimates \
  -X POST \
  -H "Authorization: Bearer zpm_your_management_token" \
  -H "Content-Type: application/json" \
  -d '{"endpoint":"chat","model":"openai/gpt-5-nano","input_tokens":2000,"output_tokens":500}'

curl "https://zapros.ai/api/v1/management/models/endpoints?model=openai%2Fgpt-5-nano&limit=50"   -H "Authorization: Bearer zpm_your_management_token"

All three management operations require models:read. A cost estimate uses current catalog pricing and never calls a provider, reserves balance, or charges the account; an accepted request's actual settled cost may differ. Endpoint discovery is a cached metadata lookup for one active OpenRouter chat model's canonical base provider/model ID without a routing suffix. It also performs no inference and no charge, exposes no upstream prices, retention promise, internal credential state, or SLA, and returns HTTP 503 instead of stale observations. The same bounded endpoint projection is available to inference clients at the provider_endpoints_url returned by GET /api/v1/models; send the inference key as a Bearer token. A returned base provider_slug can be used in provider.only, provider.ignore, or provider.order for a later OpenRouter request, while its quantization can be used in provider.quantizations. These preferences affect routing but do not guarantee that the endpoint will still be available; endpoint variants and paid tiers remain disabled.

Discover or bootstrap a project
curl "https://zapros.ai/api/v1/management/projects?limit=50" \
  -H "Authorization: Bearer zpm_your_management_token"

# If the list is empty, safely create the personal default project:
curl https://zapros.ai/api/v1/management/projects/default \
  -X POST \
  -H "Authorization: Bearer zpm_your_management_token"

GET /projects works with any key-management scope or usage:read. A usage-only caller can discover existing projects, but the idempotent bootstrap still requires keys:create. Every inference-key operation then requires an explicit project_id. On GET /usage, that field is optional and only narrows the existing boundary: manual tokens remain limited to usage owned by their account, while OAuth remains limited to keys created by that exact grant. It never adds another project member's, account's, or grant's usage.

Create a constrained inference key
curl https://zapros.ai/api/v1/management/keys \
  -X POST \
  -H "Authorization: Bearer zpm_your_management_token" \
  -H "Idempotency-Key: agent-key-2026-10-04" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "project-id-from-the-previous-response",
    "name": "Research agent",
    "monthlyBudgetRub": 500,
    "maxRequestRub": 10,
    "allowedModels": ["openai/gpt-5-nano"]
  }'

A trusted direct zpm_ caller receives the new zpr_ secret once. A Management OAuth client never receives a raw zpr_; it receives only a 15-minute dashboard claim for the account owner. A stable 8–128 character Idempotency-Key prevents duplicate creation for 24 hours, but it cannot restore a secret after its dashboard claim was acknowledged or expired. Such a terminal replay returns claim metadata without the secret. Management mutations are audited.

Management routes
GET    /api/v1/management/account
GET    /api/v1/management/models?kind=all&limit=50
GET    /api/v1/management/models/endpoints?model={model}&limit=50
POST   /api/v1/management/cost-estimates
GET    /api/v1/management/projects?limit=50
POST   /api/v1/management/projects/default
GET    /api/v1/management/keys?project_id={project_id}
POST   /api/v1/management/keys
PATCH  /api/v1/management/keys/{id}
DELETE /api/v1/management/keys/{id}?project_id={project_id}
GET    /api/v1/management/usage?days=30&limit=50
GET    /api/v1/management/usage?days=30&limit=50&project_id={project_id}
GET    /api/v1/management/compute/offers
GET    /api/v1/management/compute/instances
MCP for agents

Zapros exposes a stateless, POST-only JSON-RPC MCP server at https://zapros.ai/mcp. It supports MCP 2026-07-28 and safe compatibility with 2025-11-25 and 2025-06-18. There is no GET/SSE session stream. The preferred connection method is to give a compatible client only the MCP URL and complete Agent Connect OAuth. Ready-to-use Claude, Cursor and Codex instructions are available on the Connect an agent page. A manually provisioned zpm_ bearer remains supported for explicit configuration.

Agent Connect OAuth

The MCP authentication challenge points to RFC 9728 protected-resource metadata, which links to RFC 8414 authorization-server metadata. Public clients use authorization code with S256 PKCE, an exact registered redirect URI, and resource=https://zapros.ai/mcp. Client secrets are neither required nor accepted. Claude and Codex can use a Client ID Metadata Document, while Cursor uses bounded dynamic public-client registration.

OAuth discovery
GET https://zapros.ai/.well-known/oauth-protected-resource/mcp
GET https://zapros.ai/.well-known/oauth-authorization-server
POST https://zapros.ai/oauth/register
GET https://zapros.ai/oauth/authorize
POST https://zapros.ai/oauth/token

A zpo_ access token normally lasts 15 minutes. Refresh tokens rotate on every exchange; reusing an old refresh token revokes that MCP grant. This token works only at MCP. Management REST requires a separate OAuth grant with resource=https://zapros.ai/api/v1/management; audiences are not interchangeable.

Consent caps the aggregate monthly budget across every active key created by the connection, per-request spend, allowed models, maximum active keys, and grant lifetime. A connection can see, update, and revoke only keys it created. Users can revoke a connected app under Agents & MCP, immediately invalidating its tokens and disabling its active keys.

Manual connection

Create a scoped zpm_ token in the dashboard and configure it as the MCP bearer header. This account-scoped credential is intended for trusted automation and is distinct from a consent-bounded OAuth grant.

MCP 2026 discovery
curl https://zapros.ai/mcp \
  -X POST \
  -H "Authorization: Bearer zpm_your_management_token" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "MCP-Protocol-Version: 2026-07-28" \
  -H "Mcp-Method: server/discover" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "server/discover",
    "params": {
      "_meta": {
        "io.modelcontextprotocol/protocolVersion": "2026-07-28",
        "io.modelcontextprotocol/clientInfo": {
          "name": "my-agent",
          "version": "1.0.0"
        },
        "io.modelcontextprotocol/clientCapabilities": {}
      }
    }
  }'

Modern methods are server/discover,ping, tools/listand tools/call. For a tool call, setMcp-Method: tools/call and anMcp-Name header matchingparams.name. The available tool list is filtered by token scope. list_projects is available with any key-management scope or usage:read; the idempotent ensure_default_project still requires keys:create. Pass the returned project object's id as project_id to every key tool or optionally to get_usage. The latter only narrows the caller's existing account or exact-grant usage boundary.

get_account

Account identity and balance

list_projects

Discover projects for keys or usage filters

ensure_default_project

Idempotent personal-project bootstrap

list_models

Paginated current model catalog

list_model_endpoints

Fresh provider capability discovery

estimate_cost

Bounded RUB cost estimate

list_api_keys

Inference-key metadata

create_api_key

24-hour retry-safe key creation

update_api_key

Name and limit updates

revoke_api_key

Permanent key revocation

get_usage

Usage aggregates with an optional project filter

list_compute_offers

CPU/GPU offer discovery

list_compute_instances

Account compute inventory

MCP deliberately excludes payments, top-ups, management-token creation and compute mutations. Key mutations use separate keys:create, keys:update, and keys:revoke scopes. MCP never puts a raw new zpr_ secret in model-facing output; it returns an owner-authenticated dashboard claim. The owner can safely retry Reveal for 15 minutes and explicitly confirms after saving the key; without confirmation, expiry disables the key. Grant only the operations the client needs.
Compute discovery

compute:read already provides stable discovery endpoints and MCP tools for future CPU/GPU hosting. Until hosting is enabled, an empty offers or instances list is a valid successful response—not an outage. Creation, shutdown and billing mutations are not exposed yet.

Errors

APIs return machine-readable JSON errors and a request ID. Log the request ID, but never log bearer tokens or full prompts.

HTTPMeaningAction
400Invalid or unsupported inputFix the request; do not retry unchanged
401Missing or invalid secretUse the correct zpr_/zpm_/zpo_ namespace
402Balance or key limit exceededTop up or adjust the relevant limit
403Missing management scopeIssue a least-privilege token with that scope
429Rate limitedBack off and respect Retry-After
5xxTransient service/provider errorRetry boundedly with idempotency where supported
Code examples

Zapros works with OpenAI-compatible SDKs or ordinary HTTP clients. Keep the base URL and bearer-key namespace explicit.

Python · OpenAI SDK
from openai import OpenAI

client = OpenAI(
    api_key="zpr_your_key",
    base_url="https://zapros.ai/api/v1",
)

response = client.chat.completions.create(
    model="openai/gpt-5-nano",
    messages=[{"role": "user", "content": "Hello!"}],
    max_tokens=512,
)
print(response.choices[0].message.content)
JavaScript · fetch
const response = await fetch(
  "https://zapros.ai/api/v1/chat/completions",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer zpr_your_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: "openai/gpt-5-nano",
      messages: [{ role: "user", content: "Hello!" }],
      max_tokens: 512,
    }),
  },
);

const data = await response.json();
console.log(data.choices[0].message.content);
Machine-readable refs