{"openapi":"3.1.0","jsonSchemaDialect":"https://json-schema.org/draft/2020-12/schema","info":{"title":"Zapros API","version":"1.0.0","description":"OpenAI-compatible text inference, native Anthropic Messages compatibility, bounded asynchronous image, audio, and video generation, scoped management APIs, and Agent Connect OAuth for MCP and Management REST. Prices and balances are denominated in Russian rubles (RUB). Inference keys start with zpr_; manually provisioned management tokens start with zpm_; short-lived OAuth access tokens start with zpo_. Dynamic-registration client IDs start with zpc_ and are public identifiers, not credentials. Every OAuth grant and token has exactly one audience: https://zapros.ai/mcp or https://zapros.ai/api/v1/management. Tokens for those resources are never interchangeable.","contact":{"url":"https://zapros.ai"}},"servers":[{"url":"https://zapros.ai","description":"Production"}],"tags":[{"name":"Models"},{"name":"API Keys"},{"name":"Inference"},{"name":"Images"},{"name":"Audio"},{"name":"Video"},{"name":"Management"},{"name":"OAuth"},{"name":"MCP"}],"paths":{"/api/v1/key":{"get":{"tags":["API Keys"],"operationId":"getCurrentInferenceKey","summary":"Inspect the authenticated inference key","description":"Requires one active zpr_ inference key in Authorization: Bearer; management and OAuth access tokens are not accepted. Returns a modern OpenRouter-shaped key-information subset with an explicit Zapros currency profile: every unqualified monetary compatibility field is a RUB credit, one credit equals one RUB, and neither the body nor the X-Zapros-Currency header represents USD. usage and usage_monthly are the authoritative current UTC-month key-budget spend. A dispatched BYOK request can consume conservative key-budget authorization even though byok_usage reports only Zapros service fees and excludes the external provider's bill. usage_daily covers the current UTC day. usage_weekly covers the current UTC day plus the preceding six UTC days. limit_remaining subtracts both budget spend and active reservations and is clamped to zero. This endpoint never exposes the account wallet balance. Zapros deliberately does not offer OpenRouter's /api/v1/credits contract because its purchased-credit semantics do not map honestly onto the RUB wallet ledger. The read is local and side-effect free: it does not call an upstream provider, run inference, reserve or charge funds, initialize budget state, or require Idempotency-Key. The X-RateLimit-* response headers describe this endpoint's separate per-key introspection quota; data.rate_limit describes the configured inference request rate.","security":[{"InferenceApiKey":[]}],"responses":{"200":{"description":"Current inference-key policy and RUB-denominated usage; never an account-balance response","headers":{"Cache-Control":{"description":"Always private, no-store for this credential-specific response.","schema":{"type":"string","const":"private, no-store"}},"Vary":{"description":"Prevents reuse across Authorization credentials.","schema":{"type":"string","const":"Authorization"}},"X-Request-ID":{"description":"Request identifier for support and diagnostics.","schema":{"type":"string"}},"X-Zapros-Currency":{"description":"Confirms that all unqualified monetary compatibility fields are RUB credits, not USD.","schema":{"type":"string","const":"RUB"}},"X-RateLimit-Limit":{"description":"Request limit for this introspection endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Remaining":{"description":"Requests remaining for this introspection endpoint's current window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Reset":{"description":"Seconds until this introspection endpoint's current window resets.","schema":{"type":"string","pattern":"^[0-9]+$"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["label","limit","limit_remaining","limit_reset","usage","usage_daily","usage_weekly","usage_monthly","byok_usage","byok_usage_daily","byok_usage_weekly","byok_usage_monthly","include_byok_in_limit","budgets","effective_budget","is_free_tier","is_management_key","is_provisioning_key","free_model_daily_requests","allowed_data_regions","rate_limit","currency","zapros"],"properties":{"label":{"type":"string","minLength":1,"maxLength":100,"description":"Human-readable name of the authenticated inference key."},"limit":{"type":["number","null"],"minimum":0,"maximum":99999999.9999,"description":"Configured monthly key budget in RUB credits, or null when unlimited. One Zapros credit is one RUB; this is not a USD value."},"limit_remaining":{"type":["number","null"],"minimum":0,"maximum":99999999.9999,"description":"Immediately available monthly key budget in RUB credits: limit minus authoritative budget spend and active reservations, clamped to zero; null when unlimited."},"limit_reset":{"enum":["monthly",null],"description":"monthly when the key has a budget, otherwise null. Monthly windows reset at 00:00 UTC on the first day of the next month."},"usage":{"type":"number","minimum":0,"description":"Authoritative current-UTC-month key budget spend in RUB. For dispatched BYOK requests this can include consumed conservative budget authorization in addition to the separately billed Zapros service fee."},"usage_daily":{"type":"number","minimum":0,"description":"Settled customer charges in RUB since 00:00 UTC on the current UTC day."},"usage_weekly":{"type":"number","minimum":0,"description":"Settled customer charges in RUB over the rolling seven-UTC-day window: the current UTC day plus the previous six UTC days."},"usage_monthly":{"type":"number","minimum":0,"description":"Same authoritative current-UTC-month key budget spend as usage."},"byok_usage":{"type":"number","minimum":0,"description":"Current-UTC-month Zapros BYOK service fees in RUB. Excludes charges billed independently by the external provider."},"byok_usage_daily":{"type":"number","minimum":0,"description":"Zapros BYOK service fees in RUB since 00:00 UTC on the current UTC day."},"byok_usage_weekly":{"type":"number","minimum":0,"description":"Zapros BYOK service fees in RUB over the current UTC day plus the previous six UTC days."},"byok_usage_monthly":{"type":"number","minimum":0,"description":"Current-UTC-month Zapros BYOK service fees in RUB."},"include_byok_in_limit":{"const":true,"description":"BYOK requests consume key-budget authorization; byok_usage fields still report only Zapros service fees."},"budgets":{"type":"array","maxItems":0,"description":"Always empty. Zapros does not put RUB amounts into OpenRouter's USD-denominated budget objects."},"effective_budget":{"type":"null","description":"Always null. Use limit, limit_remaining, and data.zapros for the RUB key-budget state."},"is_free_tier":{"const":false},"is_management_key":{"const":false},"is_provisioning_key":{"const":false,"deprecated":true},"free_model_daily_requests":{"type":"object","required":["used","limit","remaining"],"properties":{"used":{"const":0},"limit":{"const":0},"remaining":{"const":0}},"additionalProperties":false,"description":"All fields are zero because Zapros does not expose OpenRouter's free-model request tier."},"allowed_data_regions":{"type":"array","maxItems":0,"description":"Always empty; Zapros does not claim an OpenRouter regional-routing entitlement through this compatibility endpoint."},"rate_limit":{"type":"object","required":["requests","interval"],"properties":{"requests":{"type":"integer","minimum":1,"maximum":50000,"description":"Configured inference requests per minute. The X-RateLimit-* response headers separately describe this introspection endpoint's own quota."},"interval":{"const":"1m"}},"additionalProperties":false},"currency":{"const":"RUB","description":"Currency for every unqualified monetary compatibility field in this response. One Zapros credit equals one RUB, never one USD."},"zapros":{"type":"object","required":["prefix","usage_basis","byok_usage_basis","period_start","resets_at","reserved_rub","max_request_rub","allowed_models"],"properties":{"prefix":{"type":"string","minLength":12,"maxLength":12,"pattern":"^zpr_[A-Za-z0-9_-]{8}$","description":"Non-secret prefix of the authenticated inference key."},"usage_basis":{"const":"current_utc_month_budget_spent_rub"},"byok_usage_basis":{"const":"zapros_fee_only"},"period_start":{"type":"string","format":"date","description":"First UTC calendar date of the current budget month."},"resets_at":{"type":"string","format":"date-time","description":"Start of the next UTC calendar month."},"reserved_rub":{"type":"number","minimum":0,"maximum":99999999.9999,"description":"Active in-flight key-budget reservations already subtracted from limit_remaining."},"max_request_rub":{"type":["number","null"],"exclusiveMinimum":0,"maximum":99999999.9999},"allowed_models":{"type":"array","maxItems":500,"items":{"type":"string","minLength":1,"maxLength":255},"description":"An empty array allows every currently supported model."}},"additionalProperties":false}},"additionalProperties":false}},"additionalProperties":false}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Always private, no-store for this credential-specific response.","schema":{"type":"string","const":"private, no-store"}},"Vary":{"description":"Prevents reuse across Authorization credentials.","schema":{"type":"string","const":"Authorization"}},"X-Request-ID":{"description":"Request identifier for support and diagnostics.","schema":{"type":"string"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Always private, no-store for this credential-specific response.","schema":{"type":"string","const":"private, no-store"}},"Vary":{"description":"Prevents reuse across Authorization credentials.","schema":{"type":"string","const":"Authorization"}},"X-Request-ID":{"description":"Request identifier for support and diagnostics.","schema":{"type":"string"}},"X-RateLimit-Limit":{"description":"Request limit for this introspection endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Remaining":{"description":"Requests remaining for this introspection endpoint's current window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Reset":{"description":"Seconds until this introspection endpoint's current window resets.","schema":{"type":"string","pattern":"^[0-9]+$"}},"Retry-After":{"description":"Seconds until the introspection quota resets.","schema":{"type":"string","pattern":"^[0-9]+$"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Always private, no-store for this credential-specific response.","schema":{"type":"string","const":"private, no-store"}},"Vary":{"description":"Prevents reuse across Authorization credentials.","schema":{"type":"string","const":"Authorization"}},"X-Request-ID":{"description":"Request identifier for support and diagnostics.","schema":{"type":"string"}}}},"503":{"description":"API-key introspection is temporarily unavailable because its shared rate limiter failed closed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Always private, no-store for this credential-specific response.","schema":{"type":"string","const":"private, no-store"}},"Vary":{"description":"Prevents reuse across Authorization credentials.","schema":{"type":"string","const":"Authorization"}},"X-Request-ID":{"description":"Request identifier for support and diagnostics.","schema":{"type":"string"}},"Retry-After":{"description":"Seconds before retrying a failed-closed introspection read.","schema":{"type":"string","const":"1"}}}}}}},"/api/v1/models":{"get":{"tags":["Models"],"operationId":"listChatModels","summary":"List Chat, Responses, and Messages models","description":"Public no-charge read of the current fail-closed Zapros text-model catalog with retail RUB pricing; it performs no inference, provider call, reservation, or charge. Omitting both offset and limit preserves the full-list response. Supplying either enables pagination with offset=0 and limit=500 defaults; filtering happens before pagination. This bounded phase supports exact text output, case-insensitive q over model ID/name, model_authors union filtering, require-all input_modalities filtering, minimum context, and context-high-to-low sorting. Unsupported OpenRouter filters are rejected rather than guessed. In particular, upstream USD price filters, provider/ZDR/region filters, categories, benchmarks, popularity, and model-age sorting are unavailable from the safe Zapros catalog. The response uses OpenRouter's data, total_count, and links.next envelope while retaining Zapros object and feature_pricing extensions. Model rows remain Zapros RUB projections rather than the complete OpenRouter SDK Model schema.","security":[],"parameters":[{"name":"offset","in":"query","description":"Number of filtered records to skip. Supplying offset or limit enables pagination.","schema":{"type":"integer","minimum":0}},{"name":"limit","in":"query","description":"Maximum records to return once pagination is enabled.","schema":{"type":"integer","minimum":1,"maximum":1000}},{"name":"output_modalities","in":"query","description":"This Zapros text-catalog slice accepts only the exact value text.","schema":{"type":"string","const":"text"}},{"name":"q","in":"query","description":"Case-insensitive search over model ID and name.","schema":{"type":"string","minLength":1,"maxLength":200}},{"name":"model_authors","in":"query","description":"Comma-separated union of one to sixteen lowercase author slugs.","schema":{"type":"string","maxLength":2063,"pattern":"^[a-z0-9][a-z0-9._-]{0,127}(?:,[a-z0-9][a-z0-9._-]{0,127}){0,15}$"}},{"name":"input_modalities","in":"query","description":"Comma-separated unique values from text, image, audio, and file. A model must support every requested modality.","schema":{"type":"string"}},{"name":"context","in":"query","description":"Minimum required context length in tokens.","schema":{"type":"integer","minimum":1,"maximum":100000000}},{"name":"sort","in":"query","description":"Only the sort backed by authoritative local catalog data is accepted.","schema":{"type":"string","const":"context-high-to-low"}}],"responses":{"200":{"description":"Current fail-closed model catalog page and retail prices in RUB","headers":{"Cache-Control":{"description":"Always no-store so a stale catalog cannot outlive the billing-safety freshness gate.","schema":{"type":"string","const":"no-store"}},"Access-Control-Allow-Origin":{"description":"Public read-only catalog access.","schema":{"type":"string","const":"*"}},"X-Zapros-Currency":{"description":"Every price in the Zapros model projection is RUB-denominated.","schema":{"type":"string","const":"RUB"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","total_count","links"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","object","owned_by","pricing"],"properties":{"id":{"type":"string"},"object":{"const":"model"},"created":{"type":"integer"},"owned_by":{"type":"string"},"name":{"type":"string"},"modality":{"type":"string"},"input_modalities":{"type":"array","items":{"type":"string"}},"output_modalities":{"type":"array","items":{"type":"string"}},"supported_endpoints":{"type":"array","items":{"type":"string"}},"supported_provider_preferences":{"type":"array","description":"Provider preference fields accepted for this model. Empty for non-OpenRouter-backed models.","items":{"enum":["only","ignore","order","quantizations","sort","allow_fallbacks","data_collection","zdr","require_parameters"]}},"provider_endpoints_url":{"type":"string","pattern":"^/api/v1/models/[A-Za-z0-9][A-Za-z0-9._-]{0,127}/[A-Za-z0-9][A-Za-z0-9._-]{0,127}/endpoints$","description":"Inference-key-authenticated discovery URL for current OpenRouter endpoint provider slugs eligible for provider.only, provider.ignore, and provider.order, plus quantization values eligible for provider.quantizations."},"context_length":{"type":["integer","null"]},"pricing":{"type":"object","required":["input_per_m","output_per_m"],"properties":{"input_per_m":{"type":"number","minimum":0},"output_per_m":{"type":"number","minimum":0},"request_rub_per_inference":{"type":"number","minimum":0},"image_rub_per_image_per_inference":{"type":["number","null"],"minimum":0},"web_search_rub_per_use":{"type":["number","null"],"minimum":0}}}},"additionalProperties":true}},"total_count":{"type":"integer","minimum":0,"description":"Number of current matching models before offset/limit pagination."},"links":{"type":"object","required":["next"],"properties":{"next":{"type":["string","null"],"description":"Relative URL for the next page with the same filters, or null when pagination was not requested or this is the final page."}},"additionalProperties":false},"object":{"const":"list","description":"Zapros list-envelope extension."},"feature_pricing":{"type":"object","description":"Zapros extension with current bounded feature-price ceilings in RUB.","additionalProperties":true}},"additionalProperties":true}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/models/count":{"get":{"tags":["Models"],"operationId":"countChatModels","summary":"Count current text models","description":"Public no-charge count of the same current safe text-output catalog used by GET /api/v1/models. This endpoint performs no inference, provider call, reservation, or charge.","security":[],"parameters":[{"name":"output_modalities","in":"query","description":"Optional OpenRouter-shaped filter; this Zapros slice accepts only the exact value text.","schema":{"type":"string","const":"text"}}],"responses":{"200":{"description":"Count of current safe text-output models","headers":{"Cache-Control":{"description":"Always no-store so a stale catalog cannot outlive the billing-safety freshness gate.","schema":{"type":"string","const":"no-store"}},"Access-Control-Allow-Origin":{"description":"Public read-only catalog access.","schema":{"type":"string","const":"*"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["count"],"properties":{"count":{"type":"integer","minimum":0}},"additionalProperties":false}},"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/model/{author}/{slug}":{"get":{"tags":["Models"],"operationId":"getChatModel","summary":"Get one exact current text model","description":"Public no-charge exact lookup in the current safe Zapros text catalog. It returns the same RUB-denominated Zapros projection as the list endpoint and does not resolve OpenRouter aliases or expose models excluded by Zapros pricing and safety policy. It performs no inference, provider call, reservation, or charge.","security":[],"parameters":[{"name":"author","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"}},{"name":"slug","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9._-]{0,127}(?::[A-Za-z0-9][A-Za-z0-9._-]{0,63})?$"}}],"responses":{"200":{"description":"One exact current Zapros RUB model projection","headers":{"Cache-Control":{"description":"Always no-store so a stale catalog cannot outlive the billing-safety freshness gate.","schema":{"type":"string","const":"no-store"}},"Access-Control-Allow-Origin":{"description":"Public read-only catalog access.","schema":{"type":"string","const":"*"}},"X-Zapros-Currency":{"description":"Every price in the Zapros model projection is RUB-denominated.","schema":{"type":"string","const":"RUB"}}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["id","object","owned_by","pricing"],"properties":{"id":{"type":"string"},"object":{"const":"model"},"created":{"type":"integer"},"owned_by":{"type":"string"},"name":{"type":"string"},"modality":{"type":"string"},"input_modalities":{"type":"array","items":{"type":"string"}},"output_modalities":{"type":"array","items":{"type":"string"}},"supported_endpoints":{"type":"array","items":{"type":"string"}},"supported_provider_preferences":{"type":"array","description":"Provider preference fields accepted for this model. Empty for non-OpenRouter-backed models.","items":{"enum":["only","ignore","order","quantizations","sort","allow_fallbacks","data_collection","zdr","require_parameters"]}},"provider_endpoints_url":{"type":"string","pattern":"^/api/v1/models/[A-Za-z0-9][A-Za-z0-9._-]{0,127}/[A-Za-z0-9][A-Za-z0-9._-]{0,127}/endpoints$","description":"Inference-key-authenticated discovery URL for current OpenRouter endpoint provider slugs eligible for provider.only, provider.ignore, and provider.order, plus quantization values eligible for provider.quantizations."},"context_length":{"type":["integer","null"]},"pricing":{"type":"object","required":["input_per_m","output_per_m"],"properties":{"input_per_m":{"type":"number","minimum":0},"output_per_m":{"type":"number","minimum":0},"request_rub_per_inference":{"type":"number","minimum":0},"image_rub_per_image_per_inference":{"type":["number","null"],"minimum":0},"web_search_rub_per_use":{"type":["number","null"],"minimum":0}}}},"additionalProperties":true}},"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"404":{"description":"Model not found in the current safe Zapros catalog","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/models/user":{"get":{"tags":["Models"],"operationId":"listUserChatModels","summary":"List current text models allowed by this inference key","description":"Requires an active zpr_ inference key in Authorization: Bearer; management and OAuth access tokens are not accepted. Returns the current fail-closed RUB chat catalog intersected with that exact key's allowed_models policy. An empty allowed_models array allows every current chat model. Filtering happens before offset/limit pagination. output_modalities may be omitted or must be exactly text; embeddings and video keep their separate Zapros catalogs. The response uses OpenRouter's data, total_count, and links.next envelope while retaining optional Zapros object and feature_pricing extensions. This is an advisory catalog snapshot, not a dispatch guarantee. A later paid request rechecks the current model catalog and key policy. The result is not filtered by or a promise about account balance, remaining budget, stored BYOK credentials, transient provider availability, account-wide provider preferences, privacy settings, or guardrails. It performs no inference, provider call, reservation, or charge.","security":[{"InferenceApiKey":[]}],"parameters":[{"name":"offset","in":"query","description":"Number of filtered records to skip.","schema":{"type":"integer","minimum":0,"default":0}},{"name":"limit","in":"query","description":"Maximum number of filtered records to return.","schema":{"type":"integer","minimum":1,"maximum":1000,"default":500}},{"name":"output_modalities","in":"query","description":"Optional OpenRouter-compatible filter. This initial slice accepts only the exact value text.","schema":{"type":"string","const":"text"}}],"responses":{"200":{"description":"Advisory snapshot of current RUB-priced chat models allowed by the authenticated inference key","headers":{"Cache-Control":{"description":"Always private, no-store for this credential-specific catalog.","schema":{"type":"string","const":"private, no-store"}},"Vary":{"description":"Prevents reuse across Authorization credentials.","schema":{"type":"string","const":"Authorization"}},"X-Request-ID":{"description":"Request identifier for support and diagnostics.","schema":{"type":"string"}},"X-Zapros-Currency":{"description":"Present as RUB on successful catalog responses; every price in the Zapros model projection is RUB-denominated.","schema":{"type":"string","const":"RUB"}},"X-RateLimit-Limit":{"description":"Request limit for this catalog endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Remaining":{"description":"Requests remaining for this catalog endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Reset":{"description":"Seconds until this catalog endpoint's current one-minute window resets.","schema":{"type":"string","pattern":"^[0-9]+$"}}},"content":{"application/json":{"schema":{"type":"object","required":["data","total_count","links"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","object","owned_by","pricing"],"properties":{"id":{"type":"string"},"object":{"const":"model"},"created":{"type":"integer"},"owned_by":{"type":"string"},"name":{"type":"string"},"modality":{"type":"string"},"input_modalities":{"type":"array","items":{"type":"string"}},"output_modalities":{"type":"array","items":{"type":"string"}},"supported_endpoints":{"type":"array","items":{"type":"string"}},"supported_provider_preferences":{"type":"array","description":"Provider preference fields accepted for this model. Empty for non-OpenRouter-backed models.","items":{"enum":["only","ignore","order","quantizations","sort","allow_fallbacks","data_collection","zdr","require_parameters"]}},"provider_endpoints_url":{"type":"string","pattern":"^/api/v1/models/[A-Za-z0-9][A-Za-z0-9._-]{0,127}/[A-Za-z0-9][A-Za-z0-9._-]{0,127}/endpoints$","description":"Inference-key-authenticated discovery URL for current OpenRouter endpoint provider slugs eligible for provider.only, provider.ignore, and provider.order, plus quantization values eligible for provider.quantizations."},"context_length":{"type":["integer","null"]},"pricing":{"type":"object","required":["input_per_m","output_per_m"],"properties":{"input_per_m":{"type":"number","minimum":0},"output_per_m":{"type":"number","minimum":0},"request_rub_per_inference":{"type":"number","minimum":0},"image_rub_per_image_per_inference":{"type":["number","null"],"minimum":0},"web_search_rub_per_use":{"type":["number","null"],"minimum":0}}}},"additionalProperties":true}},"total_count":{"type":"integer","minimum":0,"description":"Number of current allowed chat models before offset/limit pagination."},"links":{"type":"object","required":["next"],"properties":{"next":{"type":["string","null"],"description":"Relative URL for the next page with the same filters, or null on the final page."}},"additionalProperties":false},"object":{"const":"list","description":"Optional Zapros list-envelope extension."},"feature_pricing":{"type":"object","description":"Optional Zapros extension with current bounded feature-price ceilings in RUB.","properties":{"web_search_engine_max_rub_per_use":{"type":"object","additionalProperties":{"type":"number","minimum":0}}},"additionalProperties":true}},"additionalProperties":true}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Always private, no-store for this credential-specific catalog.","schema":{"type":"string","const":"private, no-store"}},"Vary":{"description":"Prevents reuse across Authorization credentials.","schema":{"type":"string","const":"Authorization"}},"X-Request-ID":{"description":"Request identifier for support and diagnostics.","schema":{"type":"string"}},"X-Zapros-Currency":{"description":"Present as RUB on successful catalog responses; every price in the Zapros model projection is RUB-denominated.","schema":{"type":"string","const":"RUB"}},"X-RateLimit-Limit":{"description":"Request limit for this catalog endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Remaining":{"description":"Requests remaining for this catalog endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Reset":{"description":"Seconds until this catalog endpoint's current one-minute window resets.","schema":{"type":"string","pattern":"^[0-9]+$"}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Always private, no-store for this credential-specific catalog.","schema":{"type":"string","const":"private, no-store"}},"Vary":{"description":"Prevents reuse across Authorization credentials.","schema":{"type":"string","const":"Authorization"}},"X-Request-ID":{"description":"Request identifier for support and diagnostics.","schema":{"type":"string"}},"X-Zapros-Currency":{"description":"Present as RUB on successful catalog responses; every price in the Zapros model projection is RUB-denominated.","schema":{"type":"string","const":"RUB"}},"X-RateLimit-Limit":{"description":"Request limit for this catalog endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Remaining":{"description":"Requests remaining for this catalog endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Reset":{"description":"Seconds until this catalog endpoint's current one-minute window resets.","schema":{"type":"string","pattern":"^[0-9]+$"}}}},"429":{"description":"User model catalog rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Always private, no-store for this credential-specific catalog.","schema":{"type":"string","const":"private, no-store"}},"Vary":{"description":"Prevents reuse across Authorization credentials.","schema":{"type":"string","const":"Authorization"}},"X-Request-ID":{"description":"Request identifier for support and diagnostics.","schema":{"type":"string"}},"X-Zapros-Currency":{"description":"Present as RUB on successful catalog responses; every price in the Zapros model projection is RUB-denominated.","schema":{"type":"string","const":"RUB"}},"X-RateLimit-Limit":{"description":"Request limit for this catalog endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Remaining":{"description":"Requests remaining for this catalog endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Reset":{"description":"Seconds until this catalog endpoint's current one-minute window resets.","schema":{"type":"string","pattern":"^[0-9]+$"}},"Retry-After":{"description":"Seconds until the catalog quota resets.","schema":{"type":"string","pattern":"^[0-9]+$"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Always private, no-store for this credential-specific catalog.","schema":{"type":"string","const":"private, no-store"}},"Vary":{"description":"Prevents reuse across Authorization credentials.","schema":{"type":"string","const":"Authorization"}},"X-Request-ID":{"description":"Request identifier for support and diagnostics.","schema":{"type":"string"}},"X-Zapros-Currency":{"description":"Present as RUB on successful catalog responses; every price in the Zapros model projection is RUB-denominated.","schema":{"type":"string","const":"RUB"}},"X-RateLimit-Limit":{"description":"Request limit for this catalog endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Remaining":{"description":"Requests remaining for this catalog endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Reset":{"description":"Seconds until this catalog endpoint's current one-minute window resets.","schema":{"type":"string","pattern":"^[0-9]+$"}}}},"503":{"description":"User model catalog is temporarily unavailable because its shared rate limiter failed closed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Always private, no-store for this credential-specific catalog.","schema":{"type":"string","const":"private, no-store"}},"Vary":{"description":"Prevents reuse across Authorization credentials.","schema":{"type":"string","const":"Authorization"}},"X-Request-ID":{"description":"Request identifier for support and diagnostics.","schema":{"type":"string"}},"X-Zapros-Currency":{"description":"Present as RUB on successful catalog responses; every price in the Zapros model projection is RUB-denominated.","schema":{"type":"string","const":"RUB"}},"X-RateLimit-Limit":{"description":"Request limit for this catalog endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Remaining":{"description":"Requests remaining for this catalog endpoint's current one-minute window.","schema":{"type":"string","pattern":"^[0-9]+$"}},"X-RateLimit-Reset":{"description":"Seconds until this catalog endpoint's current one-minute window resets.","schema":{"type":"string","pattern":"^[0-9]+$"}},"Retry-After":{"description":"Seconds before retrying the failed-closed catalog read.","schema":{"type":"string","const":"1"}}}}}}},"/api/v1/models/{author}/{slug}/endpoints":{"get":{"tags":["Models"],"operationId":"listModelProviderEndpoints","summary":"List OpenRouter provider endpoints for one chat model","description":"Requires an inference API key. Returns a fresh, bounded, sanitized endpoint-capability snapshot for one current OpenRouter-backed Zapros chat model. Each provider_slug is an exact base-provider value accepted by provider.only, provider.ignore, and provider.order; each quantization is accepted by provider.quantizations. Discovery is separately rate limited per inference key and does not run inference, reserve balance, or charge the account; availability and capabilities are observations rather than an SLA.","security":[{"InferenceApiKey":[]}],"parameters":[{"name":"author","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"}},{"name":"slug","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","description":"Numeric cursor returned by the preceding page.","schema":{"type":"string","pattern":"^[0-9]+$"}}],"responses":{"200":{"description":"Fresh, sanitized OpenRouter endpoint observations for one current Zapros chat model","content":{"application/json":{"schema":{"type":"object","required":["object","model","source","fresh","observed_at","fresh_until","data","next_cursor","total","disclaimer"],"properties":{"object":{"const":"list"},"model":{"type":"string","minLength":1,"maxLength":255},"source":{"const":"openrouter"},"fresh":{"const":true},"observed_at":{"type":"string","format":"date-time"},"fresh_until":{"type":"string","format":"date-time"},"data":{"type":"array","maxItems":100,"items":{"type":"object","required":["object","provider_slug","provider_name","context_length","max_prompt_tokens","max_completion_tokens","quantization","supported_parameters","supports_implicit_caching"],"properties":{"object":{"const":"provider_endpoint"},"provider_slug":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[a-z0-9][a-z0-9._-]{0,127}$","description":"Exact base-provider slug accepted in provider.only, provider.ignore, and provider.order. Availability and capabilities remain point-in-time observations, not an SLA."},"provider_name":{"type":"string","minLength":1,"maxLength":128},"context_length":{"type":"integer","minimum":1,"maximum":100000000},"max_prompt_tokens":{"type":["integer","null"],"minimum":0,"maximum":100000000},"max_completion_tokens":{"type":["integer","null"],"minimum":0,"maximum":100000000},"quantization":{"enum":["int4","int8","fp4","mxfp4","nvfp4","fp6","fp8","mxfp8","fp16","bf16","fp32","unknown"],"description":"Current endpoint quantization value accepted in provider.quantizations."},"supported_parameters":{"type":"array","maxItems":128,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"}},"supports_implicit_caching":{"type":"boolean"}},"additionalProperties":false}},"next_cursor":{"type":["string","null"],"pattern":"^[0-9]+$"},"total":{"type":"integer","minimum":0,"maximum":256},"disclaimer":{"type":"string"}},"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"404":{"description":"Model not found, unavailable, or not eligible for endpoint discovery","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"X-RateLimit-Limit":{"schema":{"type":"integer","minimum":1}},"X-RateLimit-Remaining":{"schema":{"type":"integer","minimum":0}},"X-RateLimit-Reset":{"description":"Seconds until the shared fixed window resets.","schema":{"type":"integer","minimum":1}},"Retry-After":{"description":"Required retry delay in seconds.","schema":{"type":"integer","minimum":1}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"503":{"description":"Fresh provider endpoint discovery is temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Retry-After":{"description":"Suggested retry delay in seconds.","schema":{"type":"integer","minimum":1}}}}}}},"/api/v1/embeddings/models":{"get":{"tags":["Models"],"operationId":"listEmbeddingModels","summary":"List embedding models","security":[],"responses":{"200":{"description":"Current embedding model catalog and retail prices in RUB","content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","required":["id","object","owned_by","pricing"],"properties":{"id":{"type":"string"},"object":{"const":"model"},"created":{"type":"integer"},"owned_by":{"type":"string"},"name":{"type":"string"},"modality":{"type":"string"},"input_modalities":{"type":"array","items":{"type":"string"}},"output_modalities":{"type":"array","items":{"type":"string"}},"supported_endpoints":{"type":"array","items":{"type":"string"}},"supported_provider_preferences":{"type":"array","description":"Provider preference fields accepted for this model. Empty for non-OpenRouter-backed models.","items":{"enum":["only","ignore","order","quantizations","sort","allow_fallbacks","data_collection","zdr","require_parameters"]}},"provider_endpoints_url":{"type":"string","pattern":"^/api/v1/models/[A-Za-z0-9][A-Za-z0-9._-]{0,127}/[A-Za-z0-9][A-Za-z0-9._-]{0,127}/endpoints$","description":"Inference-key-authenticated discovery URL for current OpenRouter endpoint provider slugs eligible for provider.only, provider.ignore, and provider.order, plus quantization values eligible for provider.quantizations."},"context_length":{"type":["integer","null"]},"pricing":{"type":"object","required":["input_per_m","output_per_m"],"properties":{"input_per_m":{"type":"number","minimum":0},"output_per_m":{"type":"number","minimum":0},"request_rub_per_inference":{"type":"number","minimum":0},"image_rub_per_image_per_inference":{"type":["number","null"],"minimum":0},"web_search_rub_per_use":{"type":["number","null"],"minimum":0}}}},"additionalProperties":true}}},"additionalProperties":false}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/chat/completions":{"post":{"tags":["Inference"],"operationId":"createChatCompletion","summary":"Create an OpenAI-compatible chat completion","description":"Optionally accepts Idempotency-Key for managed non-streaming requests; every BYOK request requires it on the first attempt. Adding a key only after an unkeyed request times out cannot associate with or deduplicate that original request and may cause a second paid provider call. A retry must use the same zpr_ inference credential, Idempotency-Key, and parsed JSON body. Rotating credentials or changing the body creates a distinct scope or a conflict. Every attempt, including a replay, must pass authentication and rate limiting before idempotency lookup; a pre-lookup HTTP 401, 429, or 503 may omit Idempotency-Replayed and use an attempt-local X-Request-ID. For 24 hours from the first request, terminal pre-stream JSON responses of at most 256 KiB can be replayed exactly without another provider call. Within Chat Completions, OpenRouter BYOK may combine stream=true with Idempotency-Key. Its first SSE response is returned once with Idempotency-Replayed: false, and the durable record becomes terminal idempotency_replay_unavailable before the stream is returned; Zapros stores no SSE transcript and provides no resume or Last-Event-ID support. A retry of that OpenRouter BYOK streaming key returns HTTP 409 idempotency_replay_unavailable with the stable X-Request-ID and without redispatching to the provider, whether the first client disconnected, cancelled, saw a stream error, or completed normally. If an operation is still in progress before an SSE response is established, retry the same key after the HTTP 409 idempotency_in_progress response's Retry-After: 2. Reusing a key with a changed body returns HTTP 409 idempotency_conflict. Managed streaming with Idempotency-Key remains unsupported, and every direct-provider BYOK route requires stream=false. Never retry or reuse an Idempotency-Key after the 24-hour window: after record cleanup it can be accepted as a new paid provider call. Use a new key only for a genuinely new intended generation, except when idempotency_abandoned explicitly proves that the provider was not called. As a bounded Zapros extension, the whole primary model may be @preset/<UUIDv4>, using the private value copied from a Chat Playground Project preset. Browser-local presets are not callable. The reference is resolved only inside the authenticated zpr_ key's exact organization, workspace, and project. Foreign, deleted, malformed, or nested saved references return the same opaque HTTP 404 project_request_preset_not_found; a lookup failure returns HTTP 503 project_request_preset_unavailable. The saved model is the model default. Only when the raw request has no own messages property does a non-empty saved prompt become one user message. Explicit messages always win, including null, empty, or malformed values that normal Chat validation rejects. Fallback models entries cannot be preset references. A separate top-level preset field returns HTTP 400 unsupported_preset, and combined model-id@preset/... syntax returns HTTP 400 unsupported_combined_preset. This does not expose generic OpenRouter presets REST, parameter profiles, tools unioning, a system prompt, history, or version pins; the stored prompt is a user message. A new call uses the latest saved snapshot. Zapros expands the alias locally before catalog, model-allowlist, budget, routing, and billing checks, and never sends it upstream. The raw parsed body is hashed and an early idempotency replay is attempted before preset lookup. An exact same-key/body retry therefore replays the original stored JSON response even after the preset is updated or deleted; a genuinely new key uses the latest snapshot. BYOK requires a directly created (not OAuth-delegated) inference key, provider.credential_mode=byok, provider.credential_provider (openrouter, openai, anthropic, google, deepseek, or mistral), and Idempotency-Key. With credential_provider=openrouter, stream may be false or true and the full existing bounded Chat contract remains available: requested fallback models, client tools and legacy functions, structured output, image/PDF inputs, capped web-search/plugins, and every bounded OpenRouter provider preference including allow_fallbacks, only, ignore, order, and quantizations. These features still use exactly the selected stored OpenRouter credential; Zapros performs no internal retry and never switches to managed credit. For OpenRouter BYOK SSE, Zapros durably commits the fixed 0.0100 RUB fee obligation before returning the stream. The fee remains due after client cancellation, disconnect, a mid-stream error, or an ambiguous post-dispatch failure; reconciliation may finish the ledger settlement. A proven pre-dispatch failure releases the reservation without a fee. Cancellation is propagated upstream on a best-effort basis, but the external provider may continue processing or billing. The live OpenRouter-compatible stream may include its final usage chunk, but this initial slice does not promise terminal token or status analytics from Zapros. Private upstream cost fields are not forwarded. provider.only is an upstream OpenRouter provider allowlist, provider.order sets priority and is not an allowlist while allow_fallbacks=true, and neither field selects a stored credential. Direct OpenAI supports only openai/gpt-5-mini; direct Anthropic maps only the stable anthropic/claude-sonnet-5.5 model to native claude-sonnet-5-5 at Anthropic's fixed /v1/messages endpoint; direct Google AI supports only google/gemini-3.8-flash; direct DeepSeek supports only deepseek/deepseek-v4.1-flash with thinking disabled; direct Mistral supports only the Public Preview mistralai/mistral-large-4-0 model with reasoning disabled. Direct Anthropic combines one or more leading system messages into the native system field; after them the conversation must start and end with a user message, so later system messages and assistant prefills are rejected. It always uses upstream adaptive thinking with high effort; caller reasoning or thinking controls are rejected. Thinking blocks are omitted from the OpenAI-compatible response content but remain included in completion-token billing. Every direct provider supports one exact non-streaming scalar-text model without tools/functions, media, fallbacks, web search/plugins, or structured output; requires allow_fallbacks=false; and rejects the other OpenRouter preferences, including provider.only, provider.ignore, provider.order, and provider.quantizations. A direct body may contain only model, messages, stream, provider, and at most one of max_tokens or max_completion_tokens; every message must contain exactly role (system, user, or assistant) and string content. Sampling fields, reasoning or thinking controls, and store are rejected. Each direct dispatch is one-shot with no internal retry. Zapros charges 0.0100 RUB per committed upstream dispatch; the selected external provider account pays model costs. Spend-limited keys authorize and consume a conservative catalog hold separately from the Zapros wallet charge. No BYOK route falls back to Zapros' managed credential or a different credential provider; OpenRouter may only use the caller-requested bounded model and endpoint fallbacks within the same stored OpenRouter credential.","x-codeSamples":[{"lang":"Shell","label":"Project preset with replayable JSON","source":"# Set ZAPROS_API_KEY to a zpr_ secret before the first attempt.\nPRESET_MODEL=\"@preset/00000000-0000-4000-8000-000000000000\" # paste the entire Copy API reference\n# Generate once for this request and retain it for an exact retry.\nIDEMPOTENCY_KEY=\"$(uuidgen)\"\ncurl https://zapros.ai/api/v1/chat/completions \\\n  -H \"Authorization: Bearer ${ZAPROS_API_KEY:?set ZAPROS_API_KEY}\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $IDEMPOTENCY_KEY\" \\\n  -d \"{\\\"model\\\":\\\"$PRESET_MODEL\\\",\\\"stream\\\":false,\\\"max_tokens\\\":256}\""}],"security":[{"InferenceApiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional for managed non-streaming requests and required on the first attempt of every BYOK request. Supply 8-128 visible ASCII characters and retain the value for the same intended request. Within Chat Completions, OpenRouter BYOK is the streaming exception: the first SSE response is delivered once with Idempotency-Replayed: false, then the key is terminally non-replayable. Zapros stores no SSE transcript and does not support resume or Last-Event-ID. Retrying that same key and body returns HTTP 409 idempotency_replay_unavailable with the stable X-Request-ID and no provider redispatch. A concurrent retry may instead return idempotency_in_progress with Retry-After: 2. Pre-stream JSON responses are replayed exactly with Idempotency-Replayed: true. Managed streaming with this header returns HTTP 400. Direct-provider BYOK requires stream=false. Never reuse the key after 24 hours; after cleanup it can become a new paid call. Generate a new key only for a genuinely new intended generation, except after an explicit idempotency_abandoned result.","schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[\\x21-\\x7E]+$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"title":"ChatRequest","type":"object","required":["model"],"properties":{"model":{"type":"string","not":{"pattern":".+@preset"},"description":"A catalog model ID or the whole bounded Zapros Project preset reference @preset/<UUIDv4>. Combined model-id@preset/... syntax is rejected. Preset aliases are expanded locally and never sent upstream."},"models":{"type":"array","description":"Optional ordered fallback model IDs. Project preset references are supported only as the primary model and are forbidden here.","items":{"type":"string","not":{"pattern":"@preset"}}},"messages":{"type":"array","minItems":1,"items":{},"description":"Normal Chat messages. This property may be omitted only when model is a valid @preset/<UUIDv4>; if present, even as null or an empty array, it is never replaced by the saved user-message prompt and must pass normal validation."},"preset":false,"max_tokens":{"type":"integer","minimum":1},"stream":{"type":"boolean","default":false},"tools":{"type":"array","items":{}},"provider":{"$ref":"#/components/schemas/ChatProviderPreferences"}},"anyOf":[{"required":["messages"]},{"required":["model"],"properties":{"model":{"type":"string","pattern":"^@preset/[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89AaBb][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$","example":"@preset/00000000-0000-4000-8000-000000000000"}}}],"allOf":[{"if":{"required":["provider"],"properties":{"provider":{"type":"object","required":["credential_mode","credential_provider"],"properties":{"credential_mode":{"const":"byok"},"credential_provider":{"const":"openrouter"}}}}},"then":{"properties":{"stream":{"type":"boolean","default":false,"description":"Among BYOK routes, OpenRouter alone may stream. stream=true requires Idempotency-Key and is delivered once without transcript replay or resume."}}}},{"if":{"required":["provider"],"properties":{"provider":{"type":"object","required":["credential_mode","credential_provider"],"properties":{"credential_mode":{"const":"byok"},"credential_provider":{"const":"openai"}}}}},"then":{"type":"object","required":["model","provider"],"properties":{"model":{"anyOf":[{"const":"openai/gpt-5-mini"},{"type":"string","pattern":"^@preset/[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89AaBb][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$"}],"description":"Direct OpenAI's exact model ID, or a Project preset alias resolved to it before direct-provider validation."},"messages":{"type":"array","minItems":1,"maxItems":128,"items":{"type":"object","required":["role","content"],"properties":{"role":{"enum":["system","user","assistant"]},"content":{"type":"string"}},"additionalProperties":false}},"stream":{"const":false,"default":false},"max_tokens":{"type":"integer","minimum":1,"maximum":32768},"max_completion_tokens":{"type":"integer","minimum":1,"maximum":32768},"provider":{"$ref":"#/components/schemas/ChatProviderPreferences"}},"not":{"required":["max_tokens","max_completion_tokens"]},"additionalProperties":false}},{"if":{"required":["provider"],"properties":{"provider":{"type":"object","required":["credential_mode","credential_provider"],"properties":{"credential_mode":{"const":"byok"},"credential_provider":{"const":"anthropic"}}}}},"then":{"type":"object","required":["model","provider"],"properties":{"model":{"anyOf":[{"const":"anthropic/claude-sonnet-5.5"},{"type":"string","pattern":"^@preset/[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89AaBb][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$"}],"description":"Stable public model ID mapped to native claude-sonnet-5-5, or a Project preset alias resolved to that ID before direct-provider validation."},"messages":{"type":"array","minItems":1,"maxItems":128,"description":"Scalar string messages. One or more leading system messages are combined into the native system field; the conversation must then start and end with a user message, so later system messages and an assistant prefill are rejected.","items":{"type":"object","required":["role","content"],"properties":{"role":{"enum":["system","user","assistant"]},"content":{"type":"string"}},"additionalProperties":false}},"stream":{"const":false,"default":false},"max_tokens":{"type":"integer","minimum":1,"maximum":32768},"max_completion_tokens":{"type":"integer","minimum":1,"maximum":32768},"provider":{"$ref":"#/components/schemas/ChatProviderPreferences"}},"not":{"required":["max_tokens","max_completion_tokens"]},"additionalProperties":false}},{"if":{"required":["provider"],"properties":{"provider":{"type":"object","required":["credential_mode","credential_provider"],"properties":{"credential_mode":{"const":"byok"},"credential_provider":{"const":"google"}}}}},"then":{"type":"object","required":["model","provider"],"properties":{"model":{"anyOf":[{"const":"google/gemini-3.8-flash"},{"type":"string","pattern":"^@preset/[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89AaBb][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$"}],"description":"Direct Google AI's exact model ID, or a Project preset alias resolved to it before direct-provider validation."},"messages":{"type":"array","minItems":1,"maxItems":128,"items":{"type":"object","required":["role","content"],"properties":{"role":{"enum":["system","user","assistant"]},"content":{"type":"string"}},"additionalProperties":false}},"stream":{"const":false,"default":false},"max_tokens":{"type":"integer","minimum":1,"maximum":32768},"max_completion_tokens":{"type":"integer","minimum":1,"maximum":32768},"provider":{"$ref":"#/components/schemas/ChatProviderPreferences"}},"not":{"required":["max_tokens","max_completion_tokens"]},"additionalProperties":false}},{"if":{"required":["provider"],"properties":{"provider":{"type":"object","required":["credential_mode","credential_provider"],"properties":{"credential_mode":{"const":"byok"},"credential_provider":{"const":"deepseek"}}}}},"then":{"type":"object","required":["model","provider"],"properties":{"model":{"anyOf":[{"const":"deepseek/deepseek-v4.1-flash"},{"type":"string","pattern":"^@preset/[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89AaBb][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$"}],"description":"Direct DeepSeek's exact model ID, or a Project preset alias resolved to it before direct-provider validation."},"messages":{"type":"array","minItems":1,"maxItems":128,"items":{"type":"object","required":["role","content"],"properties":{"role":{"enum":["system","user","assistant"]},"content":{"type":"string"}},"additionalProperties":false}},"stream":{"const":false,"default":false},"max_tokens":{"type":"integer","minimum":1,"maximum":32768},"max_completion_tokens":{"type":"integer","minimum":1,"maximum":32768},"provider":{"$ref":"#/components/schemas/ChatProviderPreferences"}},"not":{"required":["max_tokens","max_completion_tokens"]},"additionalProperties":false}},{"if":{"required":["provider"],"properties":{"provider":{"type":"object","required":["credential_mode","credential_provider"],"properties":{"credential_mode":{"const":"byok"},"credential_provider":{"const":"mistral"}}}}},"then":{"type":"object","required":["model","provider"],"properties":{"model":{"anyOf":[{"const":"mistralai/mistral-large-4-0"},{"type":"string","pattern":"^@preset/[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89AaBb][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$"}],"description":"Direct Mistral's exact model ID, or a Project preset alias resolved to it before direct-provider validation."},"messages":{"type":"array","minItems":1,"maxItems":128,"items":{"type":"object","required":["role","content"],"properties":{"role":{"enum":["system","user","assistant"]},"content":{"type":"string"}},"additionalProperties":false}},"stream":{"const":false,"default":false},"max_tokens":{"type":"integer","minimum":1,"maximum":32768},"max_completion_tokens":{"type":"integer","minimum":1,"maximum":32768},"provider":{"$ref":"#/components/schemas/ChatProviderPreferences"}},"not":{"required":["max_tokens","max_completion_tokens"]},"additionalProperties":false}}],"additionalProperties":true},"examples":{"projectPresetDefaults":{"summary":"Use the latest Project preset model and saved user prompt","value":{"model":"@preset/00000000-0000-4000-8000-000000000000","stream":false,"max_tokens":256}},"projectPresetWithMessages":{"summary":"Use the Project preset model with explicit messages","value":{"model":"@preset/00000000-0000-4000-8000-000000000000","messages":[{"role":"user","content":"Use this message instead of the saved prompt"}],"stream":false,"max_tokens":256}}}}}},"responses":{"200":{"description":"Completion JSON or text/event-stream when stream=true. A keyed OpenRouter BYOK SSE response is delivered only once with Idempotency-Replayed: false, is terminally non-replayable before return, and has its fixed fee obligation durably committed before return; reconciliation may finish the ledger settlement.","headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when a stored workspace credential routed the request","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a BYOK fee reservation and on its replay; reports that request's immutable per-dispatch fee snapshot in RUB. For OpenRouter BYOK SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. It also remains due after an ambiguous post-dispatch failure.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}},"content":{"application/json":{"schema":{"type":"object"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when a stored workspace credential routed the request","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a BYOK fee reservation and on its replay; reports that request's immutable per-dispatch fee snapshot in RUB. For OpenRouter BYOK SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. It also remains due after an ambiguous post-dispatch failure.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when a stored workspace credential routed the request","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a BYOK fee reservation and on its replay; reports that request's immutable per-dispatch fee snapshot in RUB. For OpenRouter BYOK SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. It also remains due after an ambiguous post-dispatch failure.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"402":{"description":"Insufficient balance or key budget","headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when a stored workspace credential routed the request","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a BYOK fee reservation and on its replay; reports that request's immutable per-dispatch fee snapshot in RUB. For OpenRouter BYOK SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. It also remains due after an ambiguous post-dispatch failure.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}},"content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when a stored workspace credential routed the request","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a BYOK fee reservation and on its replay; reports that request's immutable per-dispatch fee snapshot in RUB. For OpenRouter BYOK SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. It also remains due after an ambiguous post-dispatch failure.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"404":{"description":"Model not found, or opaque project_request_preset_not_found for a malformed, foreign, deleted, or nested saved Project preset reference","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when a stored workspace credential routed the request","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a BYOK fee reservation and on its replay; reports that request's immutable per-dispatch fee snapshot in RUB. For OpenRouter BYOK SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. It also remains due after an ambiguous post-dispatch failure.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"409":{"description":"Idempotency key is still in progress, was used with a different parsed JSON body, or cannot be replayed safely (including every already-started OpenRouter BYOK SSE); a stored abandoned result proves that provider dispatch did not occur; or BYOK does not have exactly one active credential for the selected provider. No replay-unavailable result redispatches to the provider.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"When present, true if and only if an exact stored HTTP 409 body was replayed (for example idempotency_abandoned); false for in-progress or replay-unavailable results. Pre-claim conflicts, including a changed request body, may omit this header.","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable identifier for an existing durable claim. Pre-claim conflicts may instead omit it or use an attempt-local identifier.","schema":{"type":"string"}},"Retry-After":{"description":"Present as 2 seconds only when the matching idempotent operation is still in progress","schema":{"type":"string","const":"2"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when a stored workspace credential routed the request","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a BYOK fee reservation and on its replay; reports that request's immutable per-dispatch fee snapshot in RUB. For OpenRouter BYOK SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. It also remains due after an ambiguous post-dispatch failure.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when a stored workspace credential routed the request","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a BYOK fee reservation and on its replay; reports that request's immutable per-dispatch fee snapshot in RUB. For OpenRouter BYOK SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. It also remains due after an ambiguous post-dispatch failure.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"Retry-After":{"description":"Retry delay from Zapros or the selected upstream provider when available","schema":{"type":"string"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when a stored workspace credential routed the request","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a BYOK fee reservation and on its replay; reports that request's immutable per-dispatch fee snapshot in RUB. For OpenRouter BYOK SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. It also remains due after an ambiguous post-dispatch failure.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"502":{"description":"Stable provider_response_unavailable result after ambiguous provider dispatch; do not switch keys for the same intent","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when a stored workspace credential routed the request","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a BYOK fee reservation and on its replay; reports that request's immutable per-dispatch fee snapshot in RUB. For OpenRouter BYOK SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. It also remains due after an ambiguous post-dispatch failure.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"503":{"description":"Service or provider unavailable, including project_request_preset_unavailable when Project preset lookup fails; a pre-lookup infrastructure failure may omit idempotency headers, while a post-claim terminal JSON response may be stored and replayed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when a stored workspace credential routed the request","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a BYOK fee reservation and on its replay; reports that request's immutable per-dispatch fee snapshot in RUB. For OpenRouter BYOK SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. It also remains due after an ambiguous post-dispatch failure.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}}}}},"/api/v1/messages":{"post":{"tags":["Inference"],"operationId":"createAnthropicMessage","summary":"Create a native Anthropic Messages response","description":"Optionally accepts Idempotency-Key for managed non-streaming requests; every OpenRouter BYOK Messages request requires it on the first attempt. Send the key on the first attempt: adding it only after an unkeyed request times out cannot associate with or deduplicate that original request and may cause a second paid provider call. A retry must use the same zpr_ inference credential and parsed JSON body. The /v1/messages and /api/v1/messages aliases share one logical Messages scope; switching among Chat Completions, Responses, and Messages creates a distinct scope and may cause another paid provider call. Every attempt, including a replay, must pass authentication and rate limiting before idempotency lookup; a pre-lookup HTTP 401, 429, or 503 may omit Idempotency-Replayed and use an attempt-local X-Request-ID. For 24 hours, terminal JSON responses of at most 256 KiB can replay exactly with Idempotency-Replayed: true and no provider redispatch. Stored Content-Type is retained; other original provider headers such as Retry-After are not replayed. These snapshots, including 402 and 5xx errors, may be stored in plaintext; only hashes of the idempotency key and canonical request body are retained. OpenRouter BYOK Messages may combine stream=true with Idempotency-Key. Its first native Anthropic SSE response is delivered once with Idempotency-Replayed: false, and the durable record becomes terminal idempotency_replay_unavailable before the stream is returned. Zapros stores no SSE transcript and supports neither replay, resume, nor Last-Event-ID. A retry after the stream started, completed, failed, was cancelled, or disconnected returns HTTP 409 idempotency_replay_unavailable with the stable X-Request-ID and no provider redispatch. A concurrent retry before the SSE is established may return idempotency_in_progress with Retry-After: 2. Pre-stream JSON responses instead use the normal exact replay contract. Managed streaming with Idempotency-Key remains unsupported and returns HTTP 400. An ambiguous failure after provider dispatch returns a stable HTTP 502 provider_response_unavailable; never switch keys for the same intent. A stored HTTP 409 idempotency_abandoned proves no provider call occurred and is the only safe reason to retry that intent under a new key. Never retry or reuse an Idempotency-Key after the 24-hour window: after cleanup it can be accepted as a new paid provider call. Otherwise use a fresh key only for a genuinely new intended request. Accepts either Authorization: Bearer zpr_... or x-api-key: zpr_...; if both are sent they must contain the same key. The /v1/messages and /api/v1/messages aliases share the same billing and idempotency scope. Managed credit is the default. OpenRouter BYOK Messages require provider.credential_mode=byok, provider.credential_provider=openrouter, a directly created zpr_ inference key, exactly one active OpenRouter credential in the workspace, and a first-attempt Idempotency-Key. The stored OpenRouter credential is used for one upstream dispatch with no retry, credential switch, direct-Anthropic-key selection, or managed-credit fallback. Each committed BYOK dispatch charges the immutable 0.0100 RUB Zapros Messages service fee while the external OpenRouter account pays model cost separately. A spend-limited inference key authorizes and consumes a conservative catalog budget amount independently of that wallet fee. Existing native Messages fields, model fallbacks, tools, and bounded OpenRouter endpoint preferences remain available through the selected OpenRouter credential. For OpenRouter BYOK SSE, Zapros durably commits the fixed 0.0100 RUB fee obligation and makes the idempotency key terminally replay-unavailable before returning the stream. The first native Anthropic SSE is delivered once with no transcript, replay, resume, or Last-Event-ID support. The fee remains due after cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. Cancellation propagates upstream only on a best-effort basis.","security":[{"InferenceApiKey":[]},{"AnthropicInferenceApiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional for managed non-streaming Messages requests and required on the first attempt of every OpenRouter BYOK Messages request. Supply 8-128 visible ASCII characters and retain the value for the same intended request. Adding the header only after an unkeyed timeout cannot deduplicate the original request and may cause a second paid provider call. Retry with the same zpr_ credential and logical Messages endpoint; /v1/messages and /api/v1/messages share one paid-request scope, while switching among Chat Completions, Responses, and Messages creates a distinct scope. For non-streaming requests and pre-stream JSON results, a stored response up to 256 KiB replays exactly for 24 hours with Idempotency-Replayed: true. An in-progress, changed-body, non-JSON, or oversized result returns HTTP 409 without redispatch; an ambiguous post-dispatch result returns a stable HTTP 502 and likewise must not be retried under another key. OpenRouter BYOK Messages may use stream=true. Its first native Anthropic SSE response is delivered once with Idempotency-Replayed: false, then the key is terminally idempotency_replay_unavailable before return. Zapros stores no SSE transcript and supports neither replay, resume, nor Last-Event-ID. Every retry returns HTTP 409 with the stable X-Request-ID and no provider redispatch. Managed streaming with this header remains unsupported and returns HTTP 400.","schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[\\x21-\\x7E]+$"}},{"name":"Anthropic-Version","in":"header","required":false,"description":"Anthropic protocol version. Omission defaults to the only currently enabled stable version; beta query/header features fail closed.","schema":{"type":"string","enum":["2023-06-01"],"default":"2023-06-01"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","messages","max_tokens"],"properties":{"model":{"type":"string","minLength":1,"maxLength":255},"models":{"type":"array","maxItems":5,"description":"Optional ordered fallback model IDs.","items":{"type":"string","minLength":1,"maxLength":255}},"fallbacks":{"type":"array","maxItems":3,"description":"Alternative Anthropic-style fallback list; cannot be combined with models.","items":{"type":"object","required":["model"],"properties":{"model":{"type":"string","minLength":1,"maxLength":255}},"additionalProperties":false}},"messages":{"type":"array","minItems":1,"maxItems":2048,"items":{}},"system":{"oneOf":[{"type":"string"},{"type":"array","items":{}}]},"max_tokens":{"type":"integer","minimum":1,"maximum":32768},"stream":{"type":"boolean","default":false,"description":"Managed requests support native JSON or SSE, but managed SSE cannot use Idempotency-Key. OpenRouter BYOK supports native JSON or one-shot keyed SSE; a started keyed SSE cannot be replayed or resumed."},"tools":{"type":"array","maxItems":128,"items":{}},"tool_choice":{},"metadata":{"type":"object","properties":{"user_id":{"type":"string","minLength":1,"maxLength":256}},"additionalProperties":false},"temperature":{"type":"number","minimum":0,"maximum":1},"top_p":{"type":"number","minimum":0,"maximum":1},"top_k":{"type":"integer","minimum":1,"maximum":1000000},"stop_sequences":{"type":"array","maxItems":16,"items":{"type":"string","maxLength":8192}},"provider":{"$ref":"#/components/schemas/MessagesProviderPreferences"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Native Anthropic Message JSON or Anthropic text/event-stream events when stream=true. An OpenRouter BYOK SSE is delivered only once after its fixed fee obligation is durably committed and its key becomes terminally replay-unavailable; reconciliation may finish the ledger settlement.","headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}},"content":{"application/json":{"schema":{"type":"object"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"Invalid Messages request","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"402":{"description":"Insufficient balance or key budget","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"403":{"description":"API-key policy rejected the request","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"404":{"description":"The requested primary or fallback model is unavailable","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"409":{"description":"Idempotency key is still in progress, was used with a different parsed JSON body, belongs to an already-started OpenRouter BYOK SSE, the original response cannot be replayed safely, or a stored abandoned result proves that provider dispatch did not occur; each result returns without provider redispatch","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"When present, true if and only if an exact stored HTTP 409 body was replayed (for example idempotency_abandoned); false for in-progress or replay-unavailable results. Pre-claim conflicts, including a changed request body, may omit this header.","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable identifier for an existing durable claim. Pre-claim conflicts may instead omit it or use an attempt-local identifier.","schema":{"type":"string"}},"Retry-After":{"description":"Present as 2 seconds only when the matching idempotent operation is still in progress","schema":{"type":"string","const":"2"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"413":{"description":"The request body exceeds the accepted size limit","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"502":{"description":"Stable provider_response_unavailable result after ambiguous provider dispatch; do not switch keys for the same intent","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"503":{"description":"Service or provider unavailable; a pre-lookup infrastructure failure may omit idempotency headers, while a post-claim terminal JSON response may be stored and replayed","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"default":{"description":"Native provider or gateway error, including Anthropic-compatible 408, 422, 529, and upstream gateway statuses","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}}}}},"/v1/messages":{"post":{"tags":["Inference"],"operationId":"createAnthropicMessageSdkAlias","summary":"Create a native Anthropic Messages response","description":"Optionally accepts Idempotency-Key for managed non-streaming requests; every OpenRouter BYOK Messages request requires it on the first attempt. Send the key on the first attempt: adding it only after an unkeyed request times out cannot associate with or deduplicate that original request and may cause a second paid provider call. A retry must use the same zpr_ inference credential and parsed JSON body. The /v1/messages and /api/v1/messages aliases share one logical Messages scope; switching among Chat Completions, Responses, and Messages creates a distinct scope and may cause another paid provider call. Every attempt, including a replay, must pass authentication and rate limiting before idempotency lookup; a pre-lookup HTTP 401, 429, or 503 may omit Idempotency-Replayed and use an attempt-local X-Request-ID. For 24 hours, terminal JSON responses of at most 256 KiB can replay exactly with Idempotency-Replayed: true and no provider redispatch. Stored Content-Type is retained; other original provider headers such as Retry-After are not replayed. These snapshots, including 402 and 5xx errors, may be stored in plaintext; only hashes of the idempotency key and canonical request body are retained. OpenRouter BYOK Messages may combine stream=true with Idempotency-Key. Its first native Anthropic SSE response is delivered once with Idempotency-Replayed: false, and the durable record becomes terminal idempotency_replay_unavailable before the stream is returned. Zapros stores no SSE transcript and supports neither replay, resume, nor Last-Event-ID. A retry after the stream started, completed, failed, was cancelled, or disconnected returns HTTP 409 idempotency_replay_unavailable with the stable X-Request-ID and no provider redispatch. A concurrent retry before the SSE is established may return idempotency_in_progress with Retry-After: 2. Pre-stream JSON responses instead use the normal exact replay contract. Managed streaming with Idempotency-Key remains unsupported and returns HTTP 400. An ambiguous failure after provider dispatch returns a stable HTTP 502 provider_response_unavailable; never switch keys for the same intent. A stored HTTP 409 idempotency_abandoned proves no provider call occurred and is the only safe reason to retry that intent under a new key. Never retry or reuse an Idempotency-Key after the 24-hour window: after cleanup it can be accepted as a new paid provider call. Otherwise use a fresh key only for a genuinely new intended request. Accepts either Authorization: Bearer zpr_... or x-api-key: zpr_...; if both are sent they must contain the same key. The /v1/messages and /api/v1/messages aliases share the same billing and idempotency scope. Managed credit is the default. OpenRouter BYOK Messages require provider.credential_mode=byok, provider.credential_provider=openrouter, a directly created zpr_ inference key, exactly one active OpenRouter credential in the workspace, and a first-attempt Idempotency-Key. The stored OpenRouter credential is used for one upstream dispatch with no retry, credential switch, direct-Anthropic-key selection, or managed-credit fallback. Each committed BYOK dispatch charges the immutable 0.0100 RUB Zapros Messages service fee while the external OpenRouter account pays model cost separately. A spend-limited inference key authorizes and consumes a conservative catalog budget amount independently of that wallet fee. Existing native Messages fields, model fallbacks, tools, and bounded OpenRouter endpoint preferences remain available through the selected OpenRouter credential. For OpenRouter BYOK SSE, Zapros durably commits the fixed 0.0100 RUB fee obligation and makes the idempotency key terminally replay-unavailable before returning the stream. The first native Anthropic SSE is delivered once with no transcript, replay, resume, or Last-Event-ID support. The fee remains due after cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. Cancellation propagates upstream only on a best-effort basis.","security":[{"InferenceApiKey":[]},{"AnthropicInferenceApiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional for managed non-streaming Messages requests and required on the first attempt of every OpenRouter BYOK Messages request. Supply 8-128 visible ASCII characters and retain the value for the same intended request. Adding the header only after an unkeyed timeout cannot deduplicate the original request and may cause a second paid provider call. Retry with the same zpr_ credential and logical Messages endpoint; /v1/messages and /api/v1/messages share one paid-request scope, while switching among Chat Completions, Responses, and Messages creates a distinct scope. For non-streaming requests and pre-stream JSON results, a stored response up to 256 KiB replays exactly for 24 hours with Idempotency-Replayed: true. An in-progress, changed-body, non-JSON, or oversized result returns HTTP 409 without redispatch; an ambiguous post-dispatch result returns a stable HTTP 502 and likewise must not be retried under another key. OpenRouter BYOK Messages may use stream=true. Its first native Anthropic SSE response is delivered once with Idempotency-Replayed: false, then the key is terminally idempotency_replay_unavailable before return. Zapros stores no SSE transcript and supports neither replay, resume, nor Last-Event-ID. Every retry returns HTTP 409 with the stable X-Request-ID and no provider redispatch. Managed streaming with this header remains unsupported and returns HTTP 400.","schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[\\x21-\\x7E]+$"}},{"name":"Anthropic-Version","in":"header","required":false,"description":"Anthropic protocol version. Omission defaults to the only currently enabled stable version; beta query/header features fail closed.","schema":{"type":"string","enum":["2023-06-01"],"default":"2023-06-01"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","messages","max_tokens"],"properties":{"model":{"type":"string","minLength":1,"maxLength":255},"models":{"type":"array","maxItems":5,"description":"Optional ordered fallback model IDs.","items":{"type":"string","minLength":1,"maxLength":255}},"fallbacks":{"type":"array","maxItems":3,"description":"Alternative Anthropic-style fallback list; cannot be combined with models.","items":{"type":"object","required":["model"],"properties":{"model":{"type":"string","minLength":1,"maxLength":255}},"additionalProperties":false}},"messages":{"type":"array","minItems":1,"maxItems":2048,"items":{}},"system":{"oneOf":[{"type":"string"},{"type":"array","items":{}}]},"max_tokens":{"type":"integer","minimum":1,"maximum":32768},"stream":{"type":"boolean","default":false,"description":"Managed requests support native JSON or SSE, but managed SSE cannot use Idempotency-Key. OpenRouter BYOK supports native JSON or one-shot keyed SSE; a started keyed SSE cannot be replayed or resumed."},"tools":{"type":"array","maxItems":128,"items":{}},"tool_choice":{},"metadata":{"type":"object","properties":{"user_id":{"type":"string","minLength":1,"maxLength":256}},"additionalProperties":false},"temperature":{"type":"number","minimum":0,"maximum":1},"top_p":{"type":"number","minimum":0,"maximum":1},"top_k":{"type":"integer","minimum":1,"maximum":1000000},"stop_sequences":{"type":"array","maxItems":16,"items":{"type":"string","maxLength":8192}},"provider":{"$ref":"#/components/schemas/MessagesProviderPreferences"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Native Anthropic Message JSON or Anthropic text/event-stream events when stream=true. An OpenRouter BYOK SSE is delivered only once after its fixed fee obligation is durably committed and its key becomes terminally replay-unavailable; reconciliation may finish the ledger settlement.","headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}},"content":{"application/json":{"schema":{"type":"object"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"Invalid Messages request","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"402":{"description":"Insufficient balance or key budget","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"403":{"description":"API-key policy rejected the request","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"404":{"description":"The requested primary or fallback model is unavailable","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"409":{"description":"Idempotency key is still in progress, was used with a different parsed JSON body, belongs to an already-started OpenRouter BYOK SSE, the original response cannot be replayed safely, or a stored abandoned result proves that provider dispatch did not occur; each result returns without provider redispatch","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"When present, true if and only if an exact stored HTTP 409 body was replayed (for example idempotency_abandoned); false for in-progress or replay-unavailable results. Pre-claim conflicts, including a changed request body, may omit this header.","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable identifier for an existing durable claim. Pre-claim conflicts may instead omit it or use an attempt-local identifier.","schema":{"type":"string"}},"Retry-After":{"description":"Present as 2 seconds only when the matching idempotent operation is still in progress","schema":{"type":"string","const":"2"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"413":{"description":"The request body exceeds the accepted size limit","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"502":{"description":"Stable provider_response_unavailable result after ambiguous provider dispatch; do not switch keys for the same intent","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"503":{"description":"Service or provider unavailable; a pre-lookup infrastructure failure may omit idempotency headers, while a post-claim terminal JSON response may be stored and replayed","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}},"default":{"description":"Native provider or gateway error, including Anthropic-compatible 408, 422, 529, and upstream gateway statuses","content":{"application/json":{"schema":{"type":"object","required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string"},"message":{"type":"string"},"error_type":{"type":"string","description":"Stable Zapros error code on locally generated errors."}},"additionalProperties":true},"request_id":{"type":["string","null"]}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK Messages selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Messages fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}},"X-Should-Retry":{"description":"Present as false when provider dispatch may already have incurred cost. Anthropic Stainless SDKs must not automatically retry that HTTP response. An explicit non-stream retry must reuse the original Idempotency-Key; a started OpenRouter BYOK SSE is terminally non-replayable and must not be resumed or retried under another key.","schema":{"type":"string","const":"false"}}}}}}},"/api/v1/responses":{"post":{"tags":["Inference"],"operationId":"createResponse","summary":"Create an OpenAI Responses-compatible response","description":"Optionally accepts Idempotency-Key for managed non-streaming requests; every OpenRouter BYOK Responses request requires it on the first attempt. Send the key on the first attempt: adding it only after an unkeyed request times out cannot associate with or deduplicate that original request and may cause a second paid provider call. A retry must use the same zpr_ inference credential and the same logical endpoint as the first attempt, in addition to the same key and parsed JSON body. Rotating credentials or switching among Chat Completions, Responses, and Messages creates a distinct scope and may cause another paid provider call. Every attempt, including a replay, must pass authentication and rate limiting before idempotency lookup; a pre-lookup HTTP 401, 429, or 503 may omit Idempotency-Replayed and use an attempt-local X-Request-ID. For 24 hours, terminal JSON responses of at most 256 KiB can replay exactly with Idempotency-Replayed: true and no provider redispatch. Stored Content-Type is retained; other original provider headers such as Retry-After are not replayed. These snapshots, including 402 and 5xx errors, may be stored in plaintext; only hashes of the idempotency key and canonical request body are retained. OpenRouter BYOK Responses may combine stream=true with Idempotency-Key. Its first SSE response is delivered once with Idempotency-Replayed: false, and the durable record becomes terminal idempotency_replay_unavailable before the stream is returned. Zapros stores no SSE transcript and supports neither replay, resume, nor Last-Event-ID. A retry after the stream started, completed, failed, was cancelled, or disconnected returns HTTP 409 idempotency_replay_unavailable with the stable X-Request-ID and no provider redispatch. A concurrent retry before the SSE is established may return idempotency_in_progress with Retry-After: 2. Pre-stream JSON responses instead use the normal exact replay contract. Managed streaming with Idempotency-Key remains unsupported and returns HTTP 400. An ambiguous failure after provider dispatch returns a stable HTTP 502 provider_response_unavailable; never switch keys for the same intent. A stored HTTP 409 idempotency_abandoned proves no provider call occurred and is the only safe reason to retry that intent under a new key. Never retry or reuse an Idempotency-Key after the 24-hour window: after cleanup it can be accepted as a new paid provider call. Otherwise use a fresh key only for a genuinely new intended request. OpenRouter BYOK Responses require a directly created zpr_ inference key, provider.credential_mode=byok, provider.credential_provider=openrouter, exactly one active OpenRouter credential in the workspace, and a first-attempt Idempotency-Key. Both stream=false JSON and stream=true SSE are supported. Zapros makes one upstream dispatch with the selected stored credential and performs no retry or credential switch. There is no managed-credit fallback. Each committed dispatch charges the immutable 0.0100 RUB Zapros service fee; the external OpenRouter account pays model cost separately. A spend-limited inference key authorizes and consumes a conservative catalog budget amount independently of that wallet fee. The local credential selectors are never forwarded. Existing bounded OpenRouter endpoint preferences, requested model fallbacks, tools, structured output, image/PDF input, and capped web-search features remain available through the same selected OpenRouter credential. For OpenRouter BYOK SSE, Zapros durably commits the fixed 0.0100 RUB fee obligation and makes the idempotency key terminally replay-unavailable before returning the stream. The first SSE is delivered once with no transcript, replay, resume, or Last-Event-ID support. The fee remains due after cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. Cancellation propagates upstream only on a best-effort basis, and this slice does not promise terminal token or status analytics. For 24 hours, retry the same intended request with the same zpr_ key, Idempotency-Key, and identical parsed JSON body. A terminal JSON response up to 256 KiB replays without another dispatch; a started SSE or another unsafe replay returns HTTP 409 without provider redispatch, and an ambiguous post-dispatch result returns stable HTTP 502. Do not switch keys for the same intent.","security":[{"InferenceApiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional for managed non-streaming Responses requests and required on the first attempt of every OpenRouter BYOK Responses request. Supply 8-128 visible ASCII characters and retain the value for the same intended request. Adding the header only after an unkeyed timeout cannot deduplicate the original request and may cause a second paid provider call. Retry with the same zpr_ credential and logical endpoint; switching among Chat Completions, Responses, and Messages creates a distinct paid-request scope. For non-streaming requests and pre-stream JSON results, a stored response up to 256 KiB replays exactly for 24 hours with Idempotency-Replayed: true. An in-progress, changed-body, non-JSON, or oversized result returns HTTP 409 without redispatch; an ambiguous post-dispatch result returns a stable HTTP 502 and likewise must not be retried under another key. OpenRouter BYOK Responses may use stream=true. Its first SSE response is delivered once with Idempotency-Replayed: false, then the key is terminally idempotency_replay_unavailable before return. Zapros stores no SSE transcript and supports neither replay, resume, nor Last-Event-ID. Every retry returns HTTP 409 with the stable X-Request-ID and no provider redispatch. Managed streaming with this header remains unsupported and returns HTTP 400.","schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[\\x21-\\x7E]+$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string"},"models":{"type":"array","items":{"type":"string"}},"input":{"oneOf":[{"type":"string","minLength":1},{"type":"array","minItems":1,"items":{}}]},"max_output_tokens":{"type":"integer","minimum":1},"stream":{"type":"boolean","default":false},"tools":{"type":"array","items":{}},"provider":{"$ref":"#/components/schemas/ResponsesProviderPreferences"}},"allOf":[{"if":{"required":["provider"],"properties":{"provider":{"required":["credential_mode"],"properties":{"credential_mode":{"const":"byok"}}}}},"then":{"properties":{"stream":{"type":"boolean","default":false,"description":"OpenRouter BYOK supports JSON or one-shot SSE; a keyed SSE cannot be replayed or resumed."}}}}],"additionalProperties":true}}}},"responses":{"200":{"description":"Response JSON or text/event-stream when stream=true. A keyed OpenRouter BYOK SSE is delivered only once with Idempotency-Replayed: false, becomes terminally replay-unavailable before return, and has its fixed fee obligation durably committed before return; reconciliation may finish the ledger settlement.","headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the local OpenRouter BYOK selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Responses fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}},"content":{"application/json":{"schema":{"type":"object"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the local OpenRouter BYOK selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Responses fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the local OpenRouter BYOK selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Responses fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"402":{"description":"Insufficient balance or key budget","headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the local OpenRouter BYOK selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Responses fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}},"content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the local OpenRouter BYOK selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Responses fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"409":{"description":"Idempotency key is still in progress, was used with a different parsed JSON body, or the original response cannot be replayed safely, including every already-started OpenRouter BYOK SSE; each result returns without provider redispatch. A stored abandoned result proves that provider dispatch did not occur.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"When present, true if and only if an exact stored HTTP 409 body was replayed (for example idempotency_abandoned); false for in-progress or replay-unavailable results. Pre-claim conflicts, including a changed request body, may omit this header.","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable identifier for an existing durable claim. Pre-claim conflicts may instead omit it or use an attempt-local identifier.","schema":{"type":"string"}},"Retry-After":{"description":"Present as 2 seconds only when the matching idempotent operation is still in progress","schema":{"type":"string","const":"2"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the local OpenRouter BYOK selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Responses fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the local OpenRouter BYOK selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Responses fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the local OpenRouter BYOK selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Responses fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"502":{"description":"Stable provider_response_unavailable result after ambiguous provider dispatch; do not switch keys for the same intent","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the local OpenRouter BYOK selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Responses fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"503":{"description":"Service or provider unavailable; a pre-lookup infrastructure failure may omit idempotency headers, while a post-claim terminal JSON response may be stored and replayed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the local OpenRouter BYOK selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK Responses fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. For SSE, the fee obligation is durably committed before the stream is returned and remains due after client cancellation, disconnect, or a mid-stream failure; reconciliation may finish the ledger settlement. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}}}}},"/api/v1/embeddings":{"post":{"tags":["Inference"],"operationId":"createEmbedding","summary":"Create OpenAI-compatible text embeddings","description":"Creates one or more bounded, non-streaming text embeddings with managed Zapros credit by default. Input remains one non-empty string or an array of up to 256 non-empty strings; token-ID and media inputs are not accepted. Optional dimensions must be an integer from 1 through 32768. Optional input_type is a non-empty, model-specific OpenRouter value of at most 64 characters (for example, search_query or search_document); Zapros deliberately does not publish a closed enum that OpenRouter does not define. Both fields are forwarded unchanged, so the selected model or provider may still reject an unsupported value. A conservative dimensions-by-batch response-size check may require reducing dimensions or the input batch before dispatch. OpenRouter BYOK is selected only by the exact provider object {\"credential_mode\":\"byok\",\"credential_provider\":\"openrouter\"}. No other provider fields or direct-provider embedding credentials are supported in this slice. The request requires a directly created zpr_ inference key, exactly one active OpenRouter credential in its workspace, and an Idempotency-Key on the first attempt. Zapros performs one upstream dispatch with no retry, managed-credit fallback, or credential switch. Each committed BYOK dispatch charges the immutable 0.0100 RUB Zapros endpoint-fee snapshot; the external OpenRouter account pays model cost separately. A spend-limited inference key also authorizes and, after dispatch, consumes a conservative catalog budget amount independently of that wallet fee. A proven pre-dispatch failure releases both reservations; a committed or ambiguous dispatch keeps the fee and budget authorization. For 24 hours, retry the same intended BYOK embedding with the same zpr_ key, Idempotency-Key, and identical parsed JSON body. A terminal JSON response of at most 256 KiB is replayed exactly with Idempotency-Replayed: true and no upstream redispatch. A non-JSON or larger result becomes HTTP 409 idempotency_replay_unavailable on retry; an ambiguous post-dispatch result becomes stable HTTP 502 provider_response_unavailable. Neither result may be retried with another key for the same intent. An explicit idempotency_abandoned response proves that no provider call occurred. The provider selector is consumed locally and never forwarded. Responses with a durable BYOK fee reservation expose X-Zapros-Credential-Mode: byok and its immutable fee in X-Zapros-Service-Fee-Rub.","security":[{"InferenceApiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Supported only for OpenRouter BYOK embeddings and required on their first attempt; managed embeddings do not expose a replay contract. Supply 8-128 visible ASCII characters and retain the same value, directly created zpr_ inference credential, and identical parsed JSON body for retries of the same intended request. For 24 hours, a stored JSON response up to 256 KiB replays exactly without another provider dispatch. An in-progress, changed-body, non-JSON, or oversized result returns HTTP 409 without redispatch; an ambiguous post-dispatch result returns a stable HTTP 502 and likewise must not be retried under another key. After the 24-hour window the key may be accepted as a new paid call. Generate a new key only for a genuinely new intended request, except after an explicit idempotency_abandoned result proves that no provider dispatch occurred.","schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[\\x21-\\x7E]+$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string"},"input":{"oneOf":[{"type":"string","minLength":1},{"type":"array","minItems":1,"maxItems":256,"items":{"type":"string","minLength":1}}]},"encoding_format":{"enum":["float","base64"]},"dimensions":{"type":"integer","minimum":1,"maximum":32768,"description":"Optional output vector width. Forwarded unchanged; support is model- and provider-specific. Zapros also rejects dimensions-by-batch combinations that may exceed the configured bounded response size."},"input_type":{"type":"string","minLength":1,"maxLength":64,"examples":["search_query","search_document"],"description":"Optional model-specific OpenRouter task hint, forwarded unchanged. OpenRouter defines this as an open string rather than a closed enum; verify the selected model's accepted values."},"user":{"type":"string","minLength":1,"maxLength":255},"session_id":{"type":"string","minLength":1,"maxLength":255},"stream":{"const":false},"provider":{"type":"object","required":["credential_mode","credential_provider"],"properties":{"credential_mode":{"const":"byok"},"credential_provider":{"const":"openrouter"}},"additionalProperties":false,"description":"Exact local selector for OpenRouter BYOK embeddings. Both fields are required together; no routing preferences or direct-provider embedding credentials are supported. The selector is removed before upstream dispatch."}},"additionalProperties":false}}}},"responses":{"200":{"description":"Embedding list","headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK embedding selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK embedding fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}},"content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK embedding selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK embedding fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK embedding selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK embedding fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"402":{"description":"Insufficient balance or key budget","headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK embedding selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK embedding fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}},"content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK embedding selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK embedding fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"409":{"description":"Idempotency key is still in progress, was used with a different parsed JSON body, cannot replay the original response safely, or an abandoned result proves that no provider dispatch occurred; replay-unavailable results never redispatch","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"When present, true if and only if an exact stored HTTP 409 body was replayed (for example idempotency_abandoned); false for in-progress or replay-unavailable results. Pre-claim conflicts, including a changed request body, may omit this header.","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable identifier for an existing durable claim. Pre-claim conflicts may instead omit it or use an attempt-local identifier.","schema":{"type":"string"}},"Retry-After":{"description":"Present as 2 seconds only when the matching idempotent operation is still in progress","schema":{"type":"string","const":"2"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK embedding selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK embedding fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK embedding selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK embedding fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK embedding selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK embedding fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"502":{"description":"Stable provider_response_unavailable after an ambiguous committed dispatch; do not switch keys or redispatch the same intent","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK embedding selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK embedding fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"503":{"description":"Service or provider unavailable; a pre-lookup infrastructure failure may omit idempotency headers, while a post-claim terminal JSON response may be stored and replayed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Present as byok when the exact OpenRouter BYOK embedding selector was accepted; the service-fee header may still be absent before fee reservation","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after an OpenRouter BYOK embedding fee reservation and on its replay; reports the request's immutable per-dispatch Zapros service-fee snapshot in RUB. The external OpenRouter account pays model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}}}}},"/api/v1/rerank":{"post":{"tags":["Inference"],"operationId":"createRerank","summary":"Rerank text documents through OpenRouter BYOK","description":"Submits one bounded, non-streaming text rerank request through exactly one stored OpenRouter credential in the inference key's workspace. This endpoint is inherently BYOK: it requires a directly created zpr_ key and accepts no local credential selector in the JSON body. If the inference key has a non-empty model allowlist, it must contain the exact requested rerank model ID. The exact body contains model, query, and one to 100 non-empty string documents. Optional top_n defaults to the document count and cannot exceed it; optional user and session_id are bounded safe identifiers. The body is limited to 128 KiB, query text to 16384 UTF-8 bytes, and each document to 32768 UTF-8 bytes. Structured/image documents, provider routing, trace, streaming, and unknown fields are rejected. A first-attempt Idempotency-Key is required. Zapros makes one upstream dispatch without retry, managed-credit fallback, or credential switch. Each committed dispatch charges the immutable 0.0100 RUB Zapros fee; the wallet and key budget account only for that fee, while the external OpenRouter account pays model cost. A committed provider error or ambiguous dispatch keeps the fee; a proven pre-dispatch failure releases it. Managed rerank is intentionally unavailable because OpenRouter's public machine-readable catalog does not expose authoritative pre-request rerank SKU prices. Private upstream cost fields are removed; bounded search_units and total_tokens may remain. 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 for the replay window and then scheduled for deletion. A caught in-process failure after dispatch becomes replayable sanitized HTTP 502; a lost or non-persistable snapshot becomes terminal HTTP 409 idempotency_replay_unavailable through reconciliation. Neither outcome redispatches.","security":[{"InferenceApiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Required on the first attempt. Supply 8-128 visible ASCII characters and retain the same value, directly created zpr_ inference key, and identical parsed JSON body for retries of one intended rerank request. For 24 hours, a stored JSON response up to 256 KiB replays exactly without another provider dispatch. Because the rerank response echoes selected documents, their text is stored in plaintext in that replay snapshot. An in-progress or changed-body request returns HTTP 409 without redispatch. An in-process failure after dispatch becomes a sanitized JSON 502 that can be replayed when its snapshot is durable. If that snapshot cannot be persisted or the process stops after dispatch, reconciliation instead makes retries terminal HTTP 409 idempotency_replay_unavailable. Neither outcome redispatches and callers must not switch keys. After 24 hours the key may be accepted as a new paid call. Generate a new key only for a new intended request, except after an explicit idempotency_abandoned result proves no provider dispatch occurred.","schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[\\x21-\\x7E]+$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","query","documents"],"properties":{"model":{"type":"string","minLength":3,"maxLength":255,"pattern":"^[a-z0-9][a-z0-9._-]{0,127}/[a-z0-9][a-z0-9._-]{0,127}(?::[a-z0-9][a-z0-9._-]{0,63})?$","example":"cohere/rerank-v3.5"},"query":{"type":"string","minLength":1,"pattern":"^(?!\\s*$)[\\s\\S]+$","x-zapros-max-utf8-bytes":16384,"description":"Non-blank query capped at 16384 UTF-8 bytes."},"documents":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"string","minLength":1,"pattern":"^(?!\\s*$)[\\s\\S]+$","x-zapros-max-utf8-bytes":32768,"description":"Non-blank text capped at 32768 UTF-8 bytes."},"description":"Text-only documents. Query plus all documents are also subject to a 120000-byte aggregate UTF-8 cap."},"top_n":{"type":"integer","minimum":1,"maximum":100,"description":"Optional result count. Defaults to the document count and may not exceed it."},"user":{"type":"string","minLength":1,"maxLength":256,"pattern":"^(?!\\s*$)[^\\u0000-\\u001F\\u007F-\\u009F]{1,256}$"},"session_id":{"type":"string","minLength":1,"maxLength":256,"pattern":"^(?!\\s*$)[^\\u0000-\\u001F\\u007F-\\u009F]{1,256}$"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Documents ranked by relevance","headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Always byok for this endpoint; the service-fee header may be absent before a durable fee reservation.","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a rerank fee reservation and on its replay. The external OpenRouter account pays all model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}},"content":{"application/json":{"schema":{"type":"object","required":["model","results"],"properties":{"id":{"type":"string"},"model":{"type":"string"},"provider":{"type":"string"},"results":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","required":["index","relevance_score","document"],"properties":{"index":{"type":"integer","minimum":0},"relevance_score":{"type":"number"},"document":{"type":"object","required":["text"],"properties":{"text":{"type":"string"}},"additionalProperties":true}},"additionalProperties":true}},"usage":{"type":"object","properties":{"search_units":{"type":"integer","minimum":0,"maximum":10000000},"total_tokens":{"type":"integer","minimum":0,"maximum":10000000}},"description":"Optional safe usage counters. Provider-account cost fields are removed.","additionalProperties":true}},"additionalProperties":true}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Always byok for this endpoint; the service-fee header may be absent before a durable fee reservation.","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a rerank fee reservation and on its replay. The external OpenRouter account pays all model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Always byok for this endpoint; the service-fee header may be absent before a durable fee reservation.","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a rerank fee reservation and on its replay. The external OpenRouter account pays all model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"402":{"description":"Insufficient balance or inference-key budget","headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Always byok for this endpoint; the service-fee header may be absent before a durable fee reservation.","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a rerank fee reservation and on its replay. The external OpenRouter account pays all model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}},"content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Always byok for this endpoint; the service-fee header may be absent before a durable fee reservation.","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a rerank fee reservation and on its replay. The external OpenRouter account pays all model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"409":{"description":"The workspace does not have exactly one active OpenRouter credential, or the idempotency key is in progress, conflicts with another body, cannot replay safely, or records a proven pre-dispatch abandonment; no result redispatches","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"When present, true if and only if an exact stored HTTP 409 body was replayed (for example idempotency_abandoned); false for in-progress or replay-unavailable results. Pre-claim conflicts, including a changed request body, may omit this header.","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable identifier for an existing durable claim. Pre-claim conflicts may instead omit it or use an attempt-local identifier.","schema":{"type":"string"}},"Retry-After":{"description":"Present as 2 seconds only when the matching idempotent operation is still in progress","schema":{"type":"string","const":"2"}},"X-Zapros-Credential-Mode":{"description":"Always byok for this endpoint; the service-fee header may be absent before a durable fee reservation.","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a rerank fee reservation and on its replay. The external OpenRouter account pays all model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"413":{"description":"The bounded rerank request is too large","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Always byok for this endpoint; the service-fee header may be absent before a durable fee reservation.","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a rerank fee reservation and on its replay. The external OpenRouter account pays all model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Always byok for this endpoint; the service-fee header may be absent before a durable fee reservation.","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a rerank fee reservation and on its replay. The external OpenRouter account pays all model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Always byok for this endpoint; the service-fee header may be absent before a durable fee reservation.","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a rerank fee reservation and on its replay. The external OpenRouter account pays all model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"502":{"description":"A caught in-process provider response failure after committed dispatch; its sanitized JSON result is replayable when durably snapshotted, and callers must not switch keys for the same intent","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Always byok for this endpoint; the service-fee header may be absent before a durable fee reservation.","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a rerank fee reservation and on its replay. The external OpenRouter account pays all model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"503":{"description":"Credential, idempotency, rate-limit, billing, or provider service is temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Always byok for this endpoint; the service-fee header may be absent before a durable fee reservation.","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a rerank fee reservation and on its replay. The external OpenRouter account pays all model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}},"default":{"description":"OpenRouter or upstream provider error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"X-Zapros-Credential-Mode":{"description":"Always byok for this endpoint; the service-fee header may be absent before a durable fee reservation.","schema":{"type":"string","const":"byok"}},"X-Zapros-Service-Fee-Rub":{"description":"Present after a rerank fee reservation and on its replay. The external OpenRouter account pays all model cost separately.","schema":{"type":"string","pattern":"^[0-9]+\\.[0-9]{4}$","example":"0.0100"}}}}}}},"/api/v1/images":{"get":{"tags":["Images","Models"],"operationId":"listImageModels","summary":"List asynchronous image models and RUB prices","description":"Public, no-charge catalog for the bounded Zapros image-job API. This is not OpenRouter's GET /images/models contract.","security":[],"responses":{"200":{"description":"Current bounded image model catalog","headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}},"content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","minItems":1,"maxItems":1,"items":{"type":"object","required":["id","name","provider","sizes","max_images","price_per_image_rub"],"properties":{"id":{"type":"string","const":"black-forest-labs/flux-1-schnell"},"name":{"type":"string","const":"FLUX.1 Schnell"},"provider":{"type":"string","const":"Black Forest Labs"},"sizes":{"type":"array","minItems":1,"maxItems":1,"uniqueItems":true,"items":{"type":"string","const":"1024x1024"}},"max_images":{"type":"integer","const":1},"price_per_image_rub":{"type":"number","minimum":0}},"additionalProperties":false}}},"additionalProperties":false}}}},"503":{"description":"Image pricing is temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}}}},"post":{"tags":["Images"],"operationId":"createImage","summary":"Start a bounded asynchronous image generation","description":"Zapros accepts one fixed, non-streaming FLUX.1 Schnell image job and returns HTTP 202; poll the Location URL until the job becomes completed or failed. This asynchronous POST /api/v1/images contract is a Zapros extension and is deliberately not wire-compatible with OpenRouter's synchronous POST /images JSON or SSE response. Streaming, SSE, input images, multiple outputs, arbitrary sizes, and unknown fields are rejected. The stream field is not accepted; there is no resume or Last-Event-ID support. A first-attempt Idempotency-Key is mandatory. For 24 hours, retry the same intended job with the same inference key, key value, and effective image request after defaults; omitted supported options are equivalent to their explicit defaults. The small HTTP 202 job envelope is replayed without provider redispatch. Never reuse an old key after that window.","security":[{"InferenceApiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Required on the first attempt. Supply 8-128 visible ASCII characters and retain the same value, zpr_ inference credential, and effective image request after supported defaults are applied. Omitting n, size, quality, or response_format is equivalent to sending its documented default explicitly. For 24 hours, an exact effective-request retry replays the original small HTTP 202 job envelope without another provider dispatch. A concurrent retry returns HTTP 409 idempotency_in_progress with Retry-After: 2; changing any effective request value returns HTTP 409 idempotency_conflict. After the 24-hour window the key may be accepted as a new paid job. Generate a new key only for a genuinely new image, except after an explicit idempotency_abandoned result proves that no provider dispatch occurred.","schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[\\x21-\\x7E]+$"}}],"requestBody":{"required":true,"description":"A JSON object of at most 64 KiB. Omitted bounded options use the only supported values shown in their defaults.","content":{"application/json":{"schema":{"type":"object","required":["model","prompt"],"properties":{"model":{"type":"string","const":"black-forest-labs/flux-1-schnell","minLength":1,"maxLength":255},"prompt":{"type":"string","minLength":1,"maxLength":10000,"description":"A non-empty string with no leading or trailing whitespace"},"n":{"type":"integer","const":1,"default":1},"size":{"type":"string","const":"1024x1024","default":"1024x1024"},"quality":{"type":"string","const":"standard","default":"standard"},"response_format":{"type":"string","const":"url","default":"url"}},"additionalProperties":false}}}},"responses":{"202":{"description":"Image job accepted. Poll the relative Location URL after Retry-After seconds.","headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}},"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"Location":{"description":"Relative URL of the image job returned in the response body","schema":{"type":"string","pattern":"^/api/v1/images/[^/]+$"}},"Retry-After":{"description":"Suggested polling delay in seconds","schema":{"type":"string","const":"2"}}},"content":{"application/json":{"schema":{"type":"object","required":["id","status","model","cost_rub"],"properties":{"id":{"type":"string","minLength":1,"maxLength":128},"status":{"type":"string","const":"processing"},"model":{"type":"string","const":"black-forest-labs/flux-1-schnell"},"cost_rub":{"type":"number","minimum":0}},"additionalProperties":false}}}},"400":{"description":"Invalid or unsupported image input, including stream, count, size, quality, response format, or unknown fields","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"402":{"description":"Insufficient balance or inference-key budget","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"404":{"description":"Image model not found or not supported","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"409":{"description":"The idempotency key is in progress, conflicts with a different effective image request after defaults, cannot replay safely, or records a proven pre-dispatch abandonment; no result redispatches","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}},"Idempotency-Replayed":{"description":"When present, true if and only if an exact stored HTTP 409 body was replayed (for example idempotency_abandoned); false for in-progress or replay-unavailable results. Pre-claim conflicts, including a changed request body, may omit this header.","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable identifier for an existing durable claim. Pre-claim conflicts may instead omit it or use an attempt-local identifier.","schema":{"type":"string"}},"Retry-After":{"description":"Present as 2 seconds only when the matching idempotent operation is still in progress","schema":{"type":"string","const":"2"}}}},"413":{"description":"The image request exceeds the 64 KiB body limit","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"502":{"description":"Provider dispatch or response failed after cost may have been incurred; do not submit the same intent under a new idempotency key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"503":{"description":"Pricing, rate-limit, idempotency, billing, or provider service is temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}}}}},"/api/v1/images/{id}":{"get":{"tags":["Images"],"operationId":"getImage","summary":"Get and refresh an asynchronous image job","description":"Poll with an active inference key from the same organization, workspace, project, and API-key scope that created the job; an absent or foreign job returns the same HTTP 404. A known job returns HTTP 200 even when its terminal status is failed. image_url is non-null only for completed jobs; error is non-null only for failed jobs. This Zapros job resource has no OpenRouter equivalent and does not provide SSE, resume, or Last-Event-ID support.","security":[{"InferenceApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":128}}],"responses":{"200":{"description":"Current image job state; failed is represented in the body, not as an HTTP transport error","headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}},"Retry-After":{"description":"Suggested polling delay in seconds; present while the job is pending or processing","schema":{"type":"string","pattern":"^[1-9][0-9]*$"}}},"content":{"application/json":{"schema":{"type":"object","required":["id","status","model","image_url","cost_rub","error"],"properties":{"id":{"type":"string","minLength":1,"maxLength":128},"status":{"type":"string","enum":["pending","processing","completed","failed"]},"model":{"type":"string","const":"black-forest-labs/flux-1-schnell"},"image_url":{"type":["string","null"],"format":"uri","pattern":"^https://","description":"Non-null only when status is completed. This provider-hosted HTTPS URL may expire; download and persist the result promptly. Zapros neither proxies nor stores the generated image bytes."},"cost_rub":{"type":"number","minimum":0},"error":{"type":["string","null"],"description":"Sanitized failure text; non-null only when status is failed"}},"additionalProperties":false}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"404":{"description":"Image job not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Image catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}}}}},"/api/v1/audio":{"get":{"tags":["Audio","Models"],"operationId":"listAudioModels","summary":"List asynchronous speech models and RUB prices","description":"Public, no-charge catalog for the bounded Zapros audio-job API. price_per_1000_characters_rub is the authoritative current retail tariff. Request quotes count the decoded input with JavaScript string.length, including its original leading and trailing whitespace, then round up to whole kopeks with a 0.01 RUB minimum. This Zapros catalog is not an OpenAI or OpenRouter audio-model discovery contract.","security":[],"responses":{"200":{"description":"Current bounded speech model catalog","headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}},"content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","minItems":1,"maxItems":1,"items":{"type":"object","required":["id","name","provider","voices","formats","max_input_characters","price_per_1000_characters_rub"],"properties":{"id":{"type":"string","const":"minimax/speech-02-hd"},"name":{"type":"string","const":"MiniMax Speech-02-HD"},"provider":{"type":"string","const":"MiniMax"},"voices":{"type":"array","minItems":1,"maxItems":1,"uniqueItems":true,"items":{"type":"string","const":"wise-woman"}},"formats":{"type":"array","minItems":1,"maxItems":1,"uniqueItems":true,"items":{"type":"string","const":"mp3"}},"max_input_characters":{"type":"integer","const":5000,"description":"Maximum decoded input length in JavaScript UTF-16 code units"},"price_per_1000_characters_rub":{"type":"number","minimum":0.01,"multipleOf":0.01,"description":"Current retail RUB tariff per 1,000 JavaScript UTF-16 code units"}},"additionalProperties":false}}},"additionalProperties":false}}}},"503":{"description":"Audio pricing is temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}}}},"post":{"tags":["Audio"],"operationId":"createAudio","summary":"Start a bounded asynchronous text-to-speech generation","description":"Zapros accepts one fixed, non-streaming MiniMax Speech-02-HD job and returns HTTP 202; poll the Location URL until the job becomes completed or failed. This asynchronous GET/POST /api/v1/audio contract is a Zapros extension. It is deliberately not wire-compatible with OpenAI or OpenRouter POST /audio/speech, which returns raw audio synchronously. Only text-to-speech with one fixed voice, MP3 format, and speed is supported. Streaming, SSE, voice cloning, reference audio, file uploads, arbitrary voices or formats, and unknown fields are rejected; there is no resume or Last-Event-ID support. A first-attempt Idempotency-Key is mandatory. For 24 hours, retry the same intended job with the same inference key, key value, and effective audio request after defaults; omitted supported options are equivalent to their explicit defaults. The small HTTP 202 job envelope is replayed without provider redispatch. Never reuse an old key after that window. The immutable cost_rub quote counts JavaScript UTF-16 code units in the original decoded input, including leading and trailing whitespace, applies the live catalog tariff, and rounds up to whole kopeks with a 0.01 RUB minimum.","security":[{"InferenceApiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Required on the first attempt. Supply 8-128 visible ASCII characters and retain the same value, zpr_ inference credential, and effective audio request after supported defaults are applied. Omitting voice, response_format, or speed is equivalent to sending its documented default explicitly. For 24 hours, an exact effective-request retry replays the original small HTTP 202 job envelope without another provider dispatch. A concurrent retry returns HTTP 409 idempotency_in_progress with Retry-After: 2; changing any effective request value returns HTTP 409 idempotency_conflict. After the 24-hour window the key may be accepted as a new paid job. Generate a new key only for genuinely new speech, except after an explicit idempotency_abandoned result proves that no provider dispatch occurred.","schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[\\x21-\\x7E]+$"}}],"requestBody":{"required":true,"description":"A strict JSON object of at most 64 KiB. Defaults are applied before idempotency hashing and price calculation.","content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","const":"minimax/speech-02-hd"},"input":{"type":"string","minLength":1,"maxLength":5000,"x-zapros-length-unit":"utf16-code-unit","description":"Text measured as 1-5,000 JavaScript UTF-16 code units. Original whitespace is preserved and billed; a whitespace-only value is rejected."},"voice":{"type":"string","const":"wise-woman","default":"wise-woman","description":"Stable Zapros voice alias; it maps to MiniMax Wise_Woman internally"},"response_format":{"type":"string","const":"mp3","default":"mp3"},"speed":{"type":"number","const":1,"default":1}},"additionalProperties":false}}}},"responses":{"202":{"description":"Audio job accepted. Poll the relative Location URL after Retry-After seconds.","headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}},"Idempotency-Replayed":{"description":"Present only when this attempt successfully matches or creates the durable idempotency record: false when the response body was not replayed; true if and only if the exact stored response body was replayed","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier only when this attempt successfully matches or creates the durable idempotency record","schema":{"type":"string"}},"Location":{"description":"Relative URL of the audio job returned in the response body","schema":{"type":"string","pattern":"^/api/v1/audio/[^/]+$"}},"Retry-After":{"description":"Suggested polling delay in seconds","schema":{"type":"string","const":"2"}}},"content":{"application/json":{"schema":{"type":"object","required":["id","status","model","cost_rub"],"properties":{"id":{"type":"string","minLength":1,"maxLength":128},"status":{"type":"string","const":"processing"},"model":{"type":"string","const":"minimax/speech-02-hd"},"cost_rub":{"type":"number","minimum":0.01,"multipleOf":0.01,"description":"Immutable request quote in RUB, rounded up to kopeks"}},"additionalProperties":false}}}},"400":{"description":"Invalid or unsupported audio input, including whitespace-only text, voice, response format, speed, streaming, or unknown fields","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"402":{"description":"Insufficient balance or inference-key budget","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"404":{"description":"Audio model not found or not supported","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"409":{"description":"The idempotency key is in progress, conflicts with a different effective audio request after defaults, cannot replay safely, or records a proven pre-dispatch abandonment; no result redispatches","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}},"Idempotency-Replayed":{"description":"When present, true if and only if an exact stored HTTP 409 body was replayed (for example idempotency_abandoned); false for in-progress or replay-unavailable results. Pre-claim conflicts, including a changed request body, may omit this header.","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable identifier for an existing durable claim. Pre-claim conflicts may instead omit it or use an attempt-local identifier.","schema":{"type":"string"}},"Retry-After":{"description":"Present as 2 seconds only when the matching idempotent operation is still in progress","schema":{"type":"string","const":"2"}}}},"413":{"description":"The audio request exceeds the 64 KiB body limit","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"502":{"description":"Provider dispatch or response failed after cost may have been incurred; do not submit the same intent under a new idempotency key","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"503":{"description":"Pricing, rate-limit, idempotency, billing, or provider service is temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}}}}},"/api/v1/audio/{id}":{"get":{"tags":["Audio"],"operationId":"getAudio","summary":"Get and refresh an asynchronous audio job","description":"Poll with the exact active inference API key, organization, workspace, and project that created the job; an absent or foreign job returns the same HTTP 404. A known job returns HTTP 200 even when its terminal status is failed. audio_url is non-null only for completed jobs; error is non-null only for failed jobs. The provider-hosted HTTPS audio_url may expire. Download and persist the MP3 promptly; Zapros neither proxies nor stores the generated audio bytes. This Zapros job resource has no OpenAI or OpenRouter equivalent and does not provide streaming, SSE, resume, or Last-Event-ID support.","security":[{"InferenceApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":128}}],"responses":{"200":{"description":"Current audio job state; failed is represented in the body, not as an HTTP transport error","headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}},"Retry-After":{"description":"Suggested polling delay in seconds; present while the job is pending or processing","schema":{"type":"string","pattern":"^[1-9][0-9]*$"}}},"content":{"application/json":{"schema":{"type":"object","required":["id","status","model","audio_url","cost_rub","error"],"properties":{"id":{"type":"string","minLength":1,"maxLength":128},"status":{"type":"string","enum":["pending","processing","completed","failed"]},"model":{"type":"string","const":"minimax/speech-02-hd"},"audio_url":{"type":["string","null"],"format":"uri","pattern":"^https://","description":"Non-null only when status is completed. This provider-hosted HTTPS URL may expire; download and persist the MP3 promptly. Zapros neither proxies nor stores the generated audio bytes."},"cost_rub":{"type":"number","minimum":0.01,"multipleOf":0.01,"description":"Immutable request quote in RUB, rounded up to kopeks"},"error":{"type":["string","null"],"description":"Sanitized failure text; non-null only when status is failed"}},"additionalProperties":false}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"404":{"description":"Audio job not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Cache-Control":{"description":"Audio catalogs and job state are never stored by shared caches","schema":{"type":"string","const":"no-store"}}}}}}},"/api/v1/videos":{"get":{"tags":["Video","Models"],"operationId":"listVideoModels","summary":"List asynchronous video models and prices","security":[],"responses":{"200":{"description":"Video model catalog","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"tags":["Video"],"operationId":"createVideo","summary":"Start an asynchronous video generation","description":"Requires an Idempotency-Key. Generate a unique key for each intended video job. When retrying the same job within 24 hours of the first request, reuse the same key with the identical JSON body; reusing it with a different body returns HTTP 409. Do not retry an old key after the 24-hour replay window.","security":[{"InferenceApiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"8-128 visible ASCII characters. Use a unique value for each intended video job. For a retry within 24 hours of the first request, send the same key with the identical JSON body so the original result can be replayed safely. Do not retry an old key after that window.","schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[\\x21-\\x7E]+$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","prompt"],"properties":{"model":{"type":"string","minLength":1,"maxLength":255},"prompt":{"type":"string","minLength":1,"maxLength":20000},"duration":{"type":"integer","minimum":1},"audio":{"type":"boolean"},"image_url":{"type":"string","format":"uri","pattern":"^https?://","minLength":1,"maxLength":8192}},"additionalProperties":false}}}},"responses":{"202":{"description":"Video job created","headers":{"Idempotency-Replayed":{"description":"true when this response safely replays a prior request","schema":{"type":"string","enum":["true","false"]}},"X-Request-ID":{"description":"Stable request identifier for the idempotent operation","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"402":{"description":"Insufficient balance or key budget","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"409":{"description":"Idempotency key is already in use or was used with a different request body","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/videos/{id}":{"get":{"tags":["Video"],"operationId":"getVideo","summary":"Get and refresh a video job","security":[{"InferenceApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Video job state","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"404":{"description":"Job not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/management/account":{"get":{"tags":["Management"],"operationId":"getAccount","summary":"Get the account balance and identity","description":"Requires account:read. Accepts a manual zpm_ token or a zpo_ token bound to the Management API resource.","security":[{"ManagementOAuth":["account:read"]},{"ManagementToken":[]}],"x-zapros-required-scopes":["account:read"],"responses":{"200":{"description":"Account summary","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/management/projects":{"get":{"tags":["Management"],"operationId":"listManagementProjects","summary":"List personal projects available for inference keys or usage filters","description":"Available with any key-management scope or usage:read. Returns only personal projects. Shared agency keys and their organization-wallet billing are live in authenticated dashboard sessions, but zpm_, OAuth, and MCP credentials remain personal-only until they carry organization-bound consent and one-time-secret claim reauthorization. Project discovery is read-only: creating or repairing the personal default project still requires keys:create.","security":[{"ManagementOAuth":["keys:read"]},{"ManagementOAuth":["keys:create"]},{"ManagementOAuth":["keys:update"]},{"ManagementOAuth":["keys:revoke"]},{"ManagementOAuth":["usage:read"]},{"ManagementToken":[]}],"x-zapros-any-scope":["keys:read","keys:create","keys:update","keys:revoke","usage:read"],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","description":"Numeric cursor returned by the preceding page.","schema":{"type":"string","pattern":"^[0-9]+$"}}],"responses":{"200":{"description":"Bounded page of personal projects exposed to management credentials","content":{"application/json":{"schema":{"type":"object","required":["object","data","next_cursor","total"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","required":["id","object","name","is_default","organization_id","organization_name","organization_kind","workspace_id","workspace_name","workspace_kind","workspace_is_default"],"properties":{"id":{"type":"string","minLength":1,"maxLength":191},"object":{"const":"project"},"name":{"type":"string"},"is_default":{"type":"boolean"},"organization_id":{"type":"string","minLength":1,"maxLength":191},"organization_name":{"type":"string"},"organization_kind":{"const":"personal"},"workspace_id":{"type":"string","minLength":1,"maxLength":191},"workspace_name":{"type":["string","null"]},"workspace_kind":{"enum":["internal","client"]},"workspace_is_default":{"type":"boolean"}},"additionalProperties":false}},"next_cursor":{"type":["string","null"],"pattern":"^[0-9]+$"},"total":{"type":"integer","minimum":0}},"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"409":{"description":"Stored personal tenancy is inconsistent","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"503":{"description":"Tenancy service is temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/management/projects/default":{"post":{"tags":["Management"],"operationId":"ensureManagementDefaultProject","summary":"Ensure the personal default project exists","description":"Requires keys:create. Idempotently creates or repairs the deterministic personal organization, workspace, wallet, and default project, then returns the project. Safe to repeat.","security":[{"ManagementOAuth":["keys:create"]},{"ManagementToken":[]}],"x-zapros-required-scopes":["keys:create"],"responses":{"200":{"description":"Existing or newly ensured default project","content":{"application/json":{"schema":{"type":"object","required":["id","object","name","is_default","organization_id","organization_name","organization_kind","workspace_id","workspace_name","workspace_kind","workspace_is_default"],"properties":{"id":{"type":"string","minLength":1,"maxLength":191},"object":{"const":"project"},"name":{"type":"string"},"is_default":{"type":"boolean"},"organization_id":{"type":"string","minLength":1,"maxLength":191},"organization_name":{"type":"string"},"organization_kind":{"const":"personal"},"workspace_id":{"type":"string","minLength":1,"maxLength":191},"workspace_name":{"type":["string","null"]},"workspace_kind":{"enum":["internal","client"]},"workspace_is_default":{"type":"boolean"}},"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"404":{"description":"Account not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"409":{"description":"Personal tenancy could not be created or repaired","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"503":{"description":"Tenancy service is temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/management/models":{"get":{"tags":["Management"],"operationId":"listManagementModels","summary":"List a bounded page of chat, embedding, or video models","description":"Requires models:read. Returns the same current catalog and retail RUB pricing used by the MCP list_models tool.","security":[{"ManagementOAuth":["models:read"]},{"ManagementToken":[]}],"x-zapros-required-scopes":["models:read"],"parameters":[{"name":"kind","in":"query","schema":{"enum":["all","chat","embedding","video"],"default":"all"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","description":"Numeric cursor returned by the preceding page.","schema":{"type":"string","pattern":"^[0-9]+$"}}],"responses":{"200":{"description":"Bounded model catalog page with current retail RUB pricing","content":{"application/json":{"schema":{"type":"object","required":["object","data","next_cursor","total"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object","required":["id","object","kind","name","provider","pricing"],"properties":{"id":{"type":"string"},"object":{"const":"model"},"kind":{"enum":["chat","embedding","video"]},"name":{"type":"string"},"provider":{"type":"string"},"input_modalities":{"type":"array","items":{"type":"string"}},"output_modalities":{"type":"array","items":{"type":"string"}},"context_length":{"type":["integer","null"]},"mode":{"enum":["text","image"]},"durations":{"type":"array","items":{"type":"integer","minimum":1}},"supports_audio":{"type":"boolean"},"pricing":{"type":"object","required":["currency"],"properties":{"currency":{"const":"RUB"},"input_per_million_tokens":{"type":"number","minimum":0},"output_per_million_tokens":{"type":"number","minimum":0},"request_per_inference":{"type":"number","minimum":0},"image_per_input_per_inference":{"type":["number","null"],"minimum":0},"web_search_per_use":{"type":["number","null"],"minimum":0},"examples_by_duration":{"type":"object","additionalProperties":true}},"additionalProperties":false}},"additionalProperties":false}},"next_cursor":{"type":["string","null"],"pattern":"^[0-9]+$"},"total":{"type":"integer","minimum":0}},"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/management/models/endpoints":{"get":{"tags":["Management"],"operationId":"listManagementModelProviderEndpoints","summary":"List provider endpoint capabilities for one chat model","description":"Requires models:read. Returns a fresh, bounded, field-by-field projection of OpenRouter endpoint capabilities for one active OpenRouter-backed Zapros chat model identified by its canonical base provider/model ID without a routing suffix. This cached metadata lookup does not run inference, reserve balance, or charge the account. It deliberately omits upstream prices, performance and status telemetry, retention claims, internal routing or credential state, and provider-specific tier controls. Each provider_slug is an exact base-provider value accepted by provider.only, provider.ignore, and provider.order; each quantization is accepted by provider.quantizations. Availability and capabilities remain observations rather than an SLA.","security":[{"ManagementOAuth":["models:read"]},{"ManagementToken":[]}],"x-zapros-required-scopes":["models:read"],"parameters":[{"name":"model","in":"query","required":true,"schema":{"type":"string","minLength":3,"maxLength":255,"pattern":"^[A-Za-z0-9][A-Za-z0-9._-]{0,127}/[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","description":"Numeric cursor returned by the preceding page.","schema":{"type":"string","pattern":"^[0-9]+$"}}],"responses":{"200":{"description":"Fresh, sanitized OpenRouter endpoint observations for one current Zapros chat model","content":{"application/json":{"schema":{"type":"object","required":["object","model","source","fresh","observed_at","fresh_until","data","next_cursor","total","disclaimer"],"properties":{"object":{"const":"list"},"model":{"type":"string","minLength":1,"maxLength":255},"source":{"const":"openrouter"},"fresh":{"const":true},"observed_at":{"type":"string","format":"date-time"},"fresh_until":{"type":"string","format":"date-time"},"data":{"type":"array","maxItems":100,"items":{"type":"object","required":["object","provider_slug","provider_name","context_length","max_prompt_tokens","max_completion_tokens","quantization","supported_parameters","supports_implicit_caching"],"properties":{"object":{"const":"provider_endpoint"},"provider_slug":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[a-z0-9][a-z0-9._-]{0,127}$","description":"Exact base-provider slug accepted in provider.only, provider.ignore, and provider.order. Availability and capabilities remain point-in-time observations, not an SLA."},"provider_name":{"type":"string","minLength":1,"maxLength":128},"context_length":{"type":"integer","minimum":1,"maximum":100000000},"max_prompt_tokens":{"type":["integer","null"],"minimum":0,"maximum":100000000},"max_completion_tokens":{"type":["integer","null"],"minimum":0,"maximum":100000000},"quantization":{"enum":["int4","int8","fp4","mxfp4","nvfp4","fp6","fp8","mxfp8","fp16","bf16","fp32","unknown"],"description":"Current endpoint quantization value accepted in provider.quantizations."},"supported_parameters":{"type":"array","maxItems":128,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"}},"supports_implicit_caching":{"type":"boolean"}},"additionalProperties":false}},"next_cursor":{"type":["string","null"],"pattern":"^[0-9]+$"},"total":{"type":"integer","minimum":0,"maximum":256},"disclaimer":{"type":"string"}},"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"404":{"description":"Model not found, unavailable, or not eligible for endpoint discovery","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"503":{"description":"Fresh provider endpoint discovery is temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}},"headers":{"Retry-After":{"description":"Suggested retry delay in seconds.","schema":{"type":"integer","minimum":1}}}}}}},"/api/v1/management/cost-estimates":{"post":{"tags":["Management"],"operationId":"estimateManagementCost","summary":"Estimate bounded inference cost from the current catalog","description":"Requires models:read. Computes a retail RUB estimate without calling a provider, reserving balance, or charging the account. Actual accepted requests are settled from measured usage and may differ.","security":[{"ManagementOAuth":["models:read"]},{"ManagementToken":[]}],"x-zapros-required-scopes":["models:read"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","oneOf":[{"description":"input_tokens plus output_tokens must not exceed the selected model's context window.","required":["endpoint","model"],"properties":{"endpoint":{"const":"chat"},"model":{"type":"string","minLength":1,"maxLength":255},"input_tokens":{"type":"integer","minimum":0,"maximum":10000000},"output_tokens":{"type":"integer","minimum":0,"maximum":32768},"image_inputs":{"type":"integer","minimum":0,"maximum":4},"web_search_uses":{"type":"integer","minimum":0,"maximum":3},"web_search_engine":{"enum":["exa","parallel","perplexity"]}},"additionalProperties":false},{"description":"input_tokens plus output_tokens must not exceed the selected model's context window.","required":["endpoint","model"],"properties":{"endpoint":{"const":"responses"},"model":{"type":"string","minLength":1,"maxLength":255},"input_tokens":{"type":"integer","minimum":0,"maximum":10000000},"output_tokens":{"type":"integer","minimum":0,"maximum":32768},"image_inputs":{"type":"integer","minimum":0,"maximum":4},"web_search_uses":{"type":"integer","minimum":0,"maximum":3},"web_search_engine":{"enum":["exa","parallel","perplexity"]}},"additionalProperties":false},{"description":"Anthropic Messages estimate. Web search is unavailable; input_tokens plus output_tokens must not exceed the selected model's context window.","required":["endpoint","model"],"properties":{"endpoint":{"const":"messages"},"model":{"type":"string","minLength":1,"maxLength":255},"input_tokens":{"type":"integer","minimum":0,"maximum":10000000},"output_tokens":{"type":"integer","minimum":0,"maximum":32768},"image_inputs":{"type":"integer","minimum":0,"maximum":4}},"additionalProperties":false},{"required":["endpoint","model"],"properties":{"endpoint":{"const":"embeddings"},"model":{"type":"string","minLength":1,"maxLength":255},"input_tokens":{"type":"integer","minimum":0,"maximum":10000000}},"additionalProperties":false},{"required":["endpoint","model"],"properties":{"endpoint":{"const":"videos"},"model":{"type":"string","minLength":1,"maxLength":255},"duration_seconds":{"type":"integer","minimum":1,"maximum":3600},"audio":{"type":"boolean"}},"additionalProperties":false}]}}}},"responses":{"200":{"description":"Catalog-based RUB estimate only; no provider call, reservation, or charge occurs","content":{"application/json":{"schema":{"type":"object","required":["object","currency","endpoint","model","estimated_cost_rub","assumptions","charged","disclaimer"],"properties":{"object":{"const":"cost_estimate"},"currency":{"const":"RUB"},"endpoint":{"enum":["chat","messages","responses","embeddings","videos"]},"model":{"type":"string"},"estimated_cost_rub":{"type":"number","minimum":0},"breakdown":{"type":"object","additionalProperties":true},"assumptions":{"type":"object","additionalProperties":true},"charged":{"const":false},"disclaimer":{"type":"string"}},"additionalProperties":false}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"404":{"description":"Model not found or unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"413":{"description":"Request body is too large","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/management/keys":{"get":{"tags":["Management"],"operationId":"listApiKeys","summary":"List inference keys without revealing their secrets","description":"Requires keys:read and an explicit project_id. Manual zpm_ callers see keys in that authorized project; Management OAuth callers see only project keys created by that exact grant. Secrets are never listed.","security":[{"ManagementOAuth":["keys:read"]},{"ManagementToken":[]}],"x-zapros-required-scopes":["keys:read"],"parameters":[{"$ref":"#/components/parameters/ProjectId"}],"responses":{"200":{"description":"Inference key list","content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}},"post":{"tags":["Management"],"operationId":"createApiKey","summary":"Create an inference key","description":"Requires keys:create and an explicit project_id in the request body. A manually provisioned zpm_ token receives the new zpr_ secret once when it creates through REST. A zpo_ token bound to the Management API never receives the raw zpr_ secret; it receives a short-lived owner-authenticated dashboard claim. If an MCP claim for the same zpm_ idempotent operation was already acknowledged or expired, REST replay returns that terminal claim metadata and never restores the erased secret. An explicit monthly budget, per-request cap, and non-empty model allowlist are required.","security":[{"ManagementOAuth":["keys:create"]},{"ManagementToken":[]}],"x-zapros-required-scopes":["keys:create"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","minProperties":2,"properties":{"project_id":{"type":"string","minLength":1,"maxLength":191,"description":"Project that owns the inference key."},"name":{"type":"string","minLength":1,"maxLength":100},"monthlyBudgetRub":{"type":"number","minimum":0,"maximum":99999999.9999},"maxRequestRub":{"type":"number","exclusiveMinimum":0,"maximum":99999999.9999},"allowedModels":{"type":"array","minItems":1,"maxItems":500,"items":{"type":"string","minLength":1,"maxLength":255},"description":"Management-token delegation requires a non-empty model allowlist."}},"additionalProperties":false,"required":["project_id","monthlyBudgetRub","maxRequestRub","allowedModels"]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"8-128 visible ASCII characters. Reusing the same value with the same credential and body prevents duplicate creation for 24 hours. A one-time secret can be replayed only while it remains encrypted; acknowledging or expiring a dashboard claim permanently erases it.","schema":{"type":"string","minLength":8,"maxLength":128}}],"responses":{"201":{"description":"New key. A direct zpm_ REST creation receives a one-time raw secret. Management OAuth callers—and zpm_ replays whose same MCP claim is already terminal—receive dashboard-claim metadata without a raw secret.","headers":{"Idempotency-Replayed":{"description":"true when this safely replays a prior creation","schema":{"type":"string","const":"true"}}},"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ApiKeyWithOneTimeSecret"},{"$ref":"#/components/schemas/DelegatedApiKeyClaim"}]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"409":{"description":"Idempotency conflict or account key-count limit reached","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"413":{"description":"Request body is too large","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/management/keys/{id}":{"patch":{"tags":["Management"],"operationId":"updateApiKey","summary":"Update an inference key's name or limits","description":"Requires keys:update and an explicit project_id in the request body. Manual zpm_ callers may update keys in that authorized project; Management OAuth callers may update only project keys created by that exact grant. Delegated updates cannot exceed the grant policy or remove mandatory limits.","security":[{"ManagementOAuth":["keys:update"]},{"ManagementToken":[]}],"x-zapros-required-scopes":["keys:update"],"parameters":[{"$ref":"#/components/parameters/ApiKeyId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","minProperties":2,"properties":{"project_id":{"type":"string","minLength":1,"maxLength":191,"description":"Project that owns the inference key."},"name":{"type":"string","minLength":1,"maxLength":100},"monthlyBudgetRub":{"type":"number","minimum":0,"maximum":99999999.9999},"maxRequestRub":{"type":"number","exclusiveMinimum":0,"maximum":99999999.9999},"allowedModels":{"type":"array","minItems":1,"maxItems":500,"items":{"type":"string","minLength":1,"maxLength":255},"description":"Management-token delegation requires a non-empty model allowlist."}},"additionalProperties":false,"required":["project_id"]}}}},"responses":{"200":{"description":"Updated key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKey"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"404":{"description":"Key not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"413":{"description":"Request body is too large","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}},"delete":{"tags":["Management"],"operationId":"revokeApiKey","summary":"Revoke an inference key","description":"Requires keys:revoke and an explicit project_id query parameter. Manual zpm_ callers may revoke keys in that authorized project; Management OAuth callers may revoke only project keys created by that exact grant. Revocation is idempotent.","security":[{"ManagementOAuth":["keys:revoke"]},{"ManagementToken":[]}],"x-zapros-required-scopes":["keys:revoke"],"parameters":[{"$ref":"#/components/parameters/ApiKeyId"},{"$ref":"#/components/parameters/ProjectId"}],"responses":{"200":{"description":"Revocation result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"404":{"description":"Key not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/management/usage":{"get":{"tags":["Management"],"operationId":"getUsage","summary":"Get bounded usage aggregates and recent requests","description":"Requires usage:read. Without project_id, manual zpm_ callers receive only their authoritative personal-organization usage; creator attribution never exposes shared agency traffic. Management OAuth callers are additionally limited to keys created by that exact grant. Optional project_id only narrows those personal or exact-grant boundaries and never adds usage from other project members, accounts, OAuth grants, or agency projects. Shared agency usage is available through an authenticated dashboard session with live project RBAC.","security":[{"ManagementOAuth":["usage:read"]},{"ManagementToken":[]}],"x-zapros-required-scopes":["usage:read"],"parameters":[{"name":"days","in":"query","schema":{"type":"integer","minimum":1,"maximum":365,"default":30}},{"name":"limit","in":"query","description":"Maximum number of recent request rows.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"$ref":"#/components/parameters/UsageProjectId"}],"responses":{"200":{"description":"Usage summary","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/management/compute/offers":{"get":{"tags":["Management"],"operationId":"listComputeOffers","summary":"List compute offers","description":"Requires compute:read. The initial catalog may be empty until compute hosting is enabled.","security":[{"ManagementOAuth":["compute:read"]},{"ManagementToken":[]}],"x-zapros-required-scopes":["compute:read"],"responses":{"200":{"description":"Compute offer list","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/management/compute/instances":{"get":{"tags":["Management"],"operationId":"listComputeInstances","summary":"List account compute instances","description":"Requires compute:read. The initial list may be empty until compute hosting is enabled.","security":[{"ManagementOAuth":["compute:read"]},{"ManagementToken":[]}],"x-zapros-required-scopes":["compute:read"],"responses":{"200":{"description":"Compute instance list","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/management/tokens":{"get":{"tags":["Management"],"operationId":"listManagementTokens","summary":"List management tokens","description":"Dashboard-session only. Management tokens cannot create more management tokens.","security":[{"SecureSessionCookie":[]},{"SessionCookie":[]}],"responses":{"200":{"description":"Management token metadata; secrets are never returned","content":{"application/json":{"schema":{"type":"object","required":["object","data"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"type":"object"}}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}},"post":{"tags":["Management"],"operationId":"createManagementToken","summary":"Create a scoped management token","description":"Dashboard-session and exact same-Origin only. The zpm_ secret is returned once. This operation is intentionally unavailable through MCP.","security":[{"SecureSessionCookie":[]},{"SessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","scopes","expiresAt"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100},"scopes":{"type":"array","minItems":1,"uniqueItems":true,"items":{"enum":["account:read","keys:read","keys:create","keys:update","keys:revoke","usage:read","models:read","compute:read"]}},"expiresAt":{"type":["string","null"],"format":"date-time","description":"Future ISO 8601 timestamp no more than 366 days away, or explicit null for no expiry. At most 20 active and 100 total management tokens are allowed per account."}},"additionalProperties":false}}}},"responses":{"201":{"description":"New token, including its one-time secret","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"409":{"description":"Active or total management-token limit reached","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"413":{"description":"Request body is too large","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/management/tokens/{id}":{"delete":{"tags":["Management"],"operationId":"revokeManagementToken","summary":"Revoke a management token","description":"Dashboard-session and exact same-Origin only.","security":[{"SecureSessionCookie":[]},{"SessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Revocation result","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"404":{"description":"Management token not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/.well-known/oauth-protected-resource/mcp":{"get":{"tags":["OAuth"],"operationId":"getMcpProtectedResourceMetadata","summary":"Discover OAuth protection for the MCP resource","description":"RFC 9728 protected-resource metadata for the exact resource https://zapros.ai/mcp.","security":[],"responses":{"200":{"description":"Protected-resource metadata","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/.well-known/oauth-protected-resource/api/v1/management":{"get":{"tags":["OAuth"],"operationId":"getManagementProtectedResourceMetadata","summary":"Discover OAuth protection for the Management API resource","description":"RFC 9728 protected-resource metadata for the exact resource https://zapros.ai/api/v1/management.","security":[],"responses":{"200":{"description":"Protected-resource metadata","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/.well-known/oauth-authorization-server":{"get":{"tags":["OAuth"],"operationId":"getOAuthAuthorizationServerMetadata","summary":"Discover Agent Connect authorization endpoints","description":"RFC 8414 authorization-server metadata. Zapros supports Client ID Metadata Documents and secretless Dynamic Client Registration for public clients, plus authorization_code, refresh_token, RFC 7009 token revocation, and S256 PKCE; client secrets are not accepted.","security":[],"responses":{"200":{"description":"Authorization-server metadata","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/oauth/authorize":{"get":{"tags":["OAuth"],"operationId":"authorizeAgentConnect","summary":"Start authorization-code consent","description":"Starts interactive consent for a public client. redirect_uri must exactly match the client metadata, resource must select exactly one supported audience, and code_challenge_method must be S256. MCP and Management API access require separate grants.","security":[],"parameters":[{"name":"response_type","in":"query","required":true,"schema":{"const":"code"}},{"name":"client_id","in":"query","required":true,"schema":{"type":"string"}},{"name":"redirect_uri","in":"query","required":true,"schema":{"type":"string","format":"uri"}},{"name":"scope","in":"query","required":false,"schema":{"type":"string"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","maxLength":1024}},{"name":"response_mode","in":"query","required":false,"schema":{"const":"query"}},{"name":"ui_locales","in":"query","required":false,"schema":{"type":"string","maxLength":128}},{"name":"resource","in":"query","required":true,"schema":{"enum":["https://zapros.ai/mcp","https://zapros.ai/api/v1/management"]}},{"name":"code_challenge","in":"query","required":true,"schema":{"type":"string","minLength":43,"maxLength":128}},{"name":"code_challenge_method","in":"query","required":true,"schema":{"const":"S256"}}],"responses":{"303":{"description":"Redirect to Zapros login or consent"},"400":{"description":"Invalid authorization request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Invalid client metadata","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"OAuth pre-authorization rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/oauth/register":{"post":{"tags":["OAuth"],"operationId":"registerAgentConnectClient","summary":"Dynamically register a public OAuth client","description":"Secretless Dynamic Client Registration for Agent Connect clients, including MCP clients such as Cursor and Management API integrations. Only authorization-code public clients using token_endpoint_auth_method=none are accepted. The JSON body is limited to 16 KiB; redirect URIs and requested scopes are strictly bounded. Standard optional descriptive fields are validated for client compatibility but may be omitted from storage and the response. Zapros never issues or accepts a client secret at this endpoint.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["redirect_uris"],"maxProperties":14,"properties":{"client_name":{"type":"string","minLength":1,"maxLength":191,"default":"MCP client"},"client_uri":{"type":"string","format":"uri","maxLength":2048,"description":"Optional public HTTPS homepage for the client."},"redirect_uris":{"type":"array","minItems":1,"maxItems":20,"uniqueItems":true,"items":{"type":"string","format":"uri","maxLength":2048},"description":"Exact callback URIs. HTTPS is required except for HTTP loopback callbacks on localhost, *.localhost, 127.0.0.1, or ::1. Fragments and userinfo are rejected."},"token_endpoint_auth_method":{"const":"none","default":"none"},"grant_types":{"type":"array","minItems":1,"maxItems":2,"uniqueItems":true,"items":{"enum":["authorization_code","refresh_token"]},"contains":{"const":"authorization_code"},"minContains":1,"maxContains":1,"default":["authorization_code","refresh_token"],"description":"authorization_code is required; refresh_token is the only optional additional grant."},"response_types":{"type":"array","minItems":1,"maxItems":1,"uniqueItems":true,"items":{"const":"code"},"default":["code"]},"scope":{"type":"string","minLength":1,"maxLength":1024,"description":"Space-delimited subset of account:read, models:read, usage:read, compute:read, keys:read, keys:create, keys:update, and keys:revoke. Omission registers the full supported set; consent still bounds the resulting grant."},"application_type":{"enum":["native","web"]},"contacts":{"type":"array","maxItems":5,"items":{"type":"string","minLength":1,"maxLength":254}},"logo_uri":{"type":"string","format":"uri","maxLength":2048},"policy_uri":{"type":"string","format":"uri","maxLength":2048},"tos_uri":{"type":"string","format":"uri","maxLength":2048},"software_id":{"type":"string","minLength":1,"maxLength":191},"software_version":{"type":"string","minLength":1,"maxLength":64}},"additionalProperties":false}}}},"responses":{"201":{"description":"Registered public client metadata. The response is non-cacheable and contains no client secret.","headers":{"Cache-Control":{"description":"Always no-store.","schema":{"const":"no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DynamicClientRegistration"}}}},"400":{"description":"Invalid client metadata, unsupported scope, or redirect URI","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"413":{"description":"Registration body exceeds 16 KiB","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Dynamic registration rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/oauth/token":{"post":{"tags":["OAuth"],"operationId":"exchangeAgentConnectToken","summary":"Exchange an authorization code or rotate a refresh token","description":"Public-client token endpoint. Every request must bind exactly one resource: https://zapros.ai/mcp or https://zapros.ai/api/v1/management. The requested resource must exactly match the authorization code, refresh token, and grant; it cannot be switched during exchange. Access tokens use the zpo_ namespace and normally expire after 15 minutes. Every refresh exchanges the supplied refresh token for a new one; reuse revokes that grant.","security":[],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"oneOf":[{"type":"object","required":["grant_type","client_id","resource","code","redirect_uri","code_verifier"],"properties":{"grant_type":{"const":"authorization_code"},"client_id":{"type":"string"},"resource":{"enum":["https://zapros.ai/mcp","https://zapros.ai/api/v1/management"]},"code":{"type":"string"},"redirect_uri":{"type":"string","format":"uri"},"code_verifier":{"type":"string","minLength":43,"maxLength":128}},"additionalProperties":false},{"type":"object","required":["grant_type","client_id","resource","refresh_token"],"properties":{"grant_type":{"const":"refresh_token"},"client_id":{"type":"string"},"resource":{"enum":["https://zapros.ai/mcp","https://zapros.ai/api/v1/management"]},"refresh_token":{"type":"string"},"scope":{"type":"string"}},"additionalProperties":false}]}}}},"responses":{"200":{"description":"Short-lived access token and rotated refresh token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthTokenResponse"}}}},"400":{"description":"Invalid OAuth grant or request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Invalid public client","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"OAuth pre-authorization rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/oauth/revoke":{"post":{"tags":["OAuth"],"operationId":"revokeAgentConnectToken","summary":"Revoke an Agent Connect token and its grant","description":"RFC 7009 revocation for secretless public clients. The body is limited to 8 KiB and accepts only token, client_id, and an optional token_type_hint. An access or refresh token owned by the client revokes the entire grant, all of its tokens, and active inference keys created by that grant. Malformed or unsupported token values, unknown tokens, tokens owned by another valid client, and repeated requests all return the same empty 200 response after client validation.","security":[],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["token","client_id"],"properties":{"token":{"type":"string","pattern":"^(?:zpo_[A-Za-z0-9_-]{48}|zprf_[A-Za-z0-9_-]{48})$","x-sensitive":true},"client_id":{"type":"string","minLength":1,"maxLength":512},"token_type_hint":{"enum":["access_token","refresh_token"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Empty, non-cacheable response for successful, invalid, unknown, wrong-client, or repeated revocation","headers":{"Cache-Control":{"description":"Always no-store.","schema":{"const":"no-store"}}}},"400":{"description":"Invalid revocation request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Invalid public client","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"413":{"description":"Revocation body exceeds 8 KiB","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"OAuth pre-authorization rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/oauth/grants":{"get":{"tags":["OAuth"],"operationId":"listConnectedApps","summary":"List connected OAuth applications","description":"Dashboard-session only; token secrets are never returned.","security":[{"SecureSessionCookie":[]},{"SessionCookie":[]}],"responses":{"200":{"description":"Connected applications and their scopes, policy, and status","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/oauth/grants/{id}":{"delete":{"tags":["OAuth"],"operationId":"revokeConnectedApp","summary":"Revoke a connected OAuth application","description":"Dashboard-session and exact same-Origin only. Revokes all access and refresh tokens and disables active inference keys created by this grant.","security":[{"SecureSessionCookie":[]},{"SessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Revoked grant","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"404":{"description":"OAuth grant not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/api/v1/management/key-claims/{id}":{"post":{"tags":["Management","OAuth"],"operationId":"revealAgentCreatedApiKey","summary":"Reveal an agent-created inference-key secret","description":"Dashboard-session and exact same-Origin only. MCP never returns a raw zpr_ secret in model-facing output; it returns a 15-minute claim URL instead. Reveal is safely replayable by the signed-in owner until explicit acknowledgement or expiry.","security":[{"SecureSessionCookie":[]},{"SessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Replayable owner-only zpr_ reveal","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"404":{"description":"Claim not found or no longer available","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"409":{"description":"Claim consumed or expired","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}},"delete":{"tags":["Management","OAuth"],"operationId":"acknowledgeAgentCreatedApiKey","summary":"Acknowledge that an inference-key secret was saved","description":"Dashboard-session and exact same-Origin only. After the owner confirms the revealed key was saved, acknowledgement atomically erases encrypted secret copies and leaves an idempotent consumed tombstone. Repeating acknowledgement is safe.","security":[{"SecureSessionCookie":[]},{"SessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Claim acknowledged or terminal expiry acknowledged","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"403":{"description":"The credential lacks the required scope or policy access","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"404":{"description":"Claim not found","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"409":{"description":"Claim has not been revealed yet","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true}}}}}}},"/mcp":{"post":{"tags":["MCP"],"operationId":"mcp","summary":"Use the stateless Zapros MCP server","description":"Accepts either an Agent Connect zpo_ OAuth token for resource https://zapros.ai/mcp or a manually provisioned scoped zpm_ bearer token. OAuth clients discover RFC 9728 protected-resource metadata and RFC 8414 authorization-server metadata, then use authorization code with S256 PKCE. Supports MCP 2026-07-28 and safe compatibility with 2025-11-25 and 2025-06-18. Tool availability is scope-filtered. OAuth grants can manage only keys created by that same grant and stay within the aggregate consent budget, per-request cap, model allowlist, and maximum active-key count. create_api_key returns a 15-minute owner-only dashboard claim rather than a raw zpr_ secret; Reveal is replayable until explicit ACK. Payments and management-token creation are never exposed.","security":[{"AgentOAuth":[]},{"ManagementToken":[]}],"parameters":[{"name":"MCP-Protocol-Version","in":"header","required":false,"description":"Conditionally required on every MCP 2026-07-28 request; legacy initialize negotiates in-band.","schema":{"enum":["2026-07-28","2025-11-25","2025-06-18"]}},{"name":"Accept","in":"header","required":false,"description":"Conditionally required in MCP 2026-07-28 and must list both application/json and text/event-stream, although this stateless server returns JSON.","schema":{"type":"string","example":"application/json, text/event-stream"}},{"name":"Mcp-Method","in":"header","required":false,"description":"Conditionally required in MCP 2026-07-28 and must match body.method.","schema":{"type":"string"}},{"name":"Mcp-Name","in":"header","required":false,"description":"Conditionally required for tools/call in MCP 2026-07-28. Unsafe or non-ASCII names use the =?base64?...?= sentinel encoding.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","method"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"oneOf":[{"type":"string","maxLength":200},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}],"description":"Omit for a notification. Explicit null is invalid."},"method":{"type":"string","minLength":1,"maxLength":200},"params":{"type":"object","description":"For MCP 2026-07-28, _meta must contain io.modelcontextprotocol/protocolVersion=2026-07-28 and an io.modelcontextprotocol/clientCapabilities object.","additionalProperties":true}},"additionalProperties":true}}}},"responses":{"200":{"description":"JSON-RPC 2.0 response","content":{"application/json":{"schema":{"oneOf":[{"type":"object","required":["jsonrpc","id","result"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"oneOf":[{"type":"string","maxLength":200},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"result":{}},"additionalProperties":false},{"type":"object","required":["jsonrpc","id","error"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"oneOf":[{"type":"string","maxLength":200},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{}},"additionalProperties":false}},"additionalProperties":false}]}}}},"202":{"description":"Notification accepted"},"400":{"description":"Invalid JSON-RPC or MCP envelope","content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","id","error"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"oneOf":[{"type":"string","maxLength":200},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{}},"additionalProperties":false}},"additionalProperties":false}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","id","error"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"oneOf":[{"type":"string","maxLength":200},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{}},"additionalProperties":false}},"additionalProperties":false}}}},"403":{"description":"Origin rejected or scope denied","content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","id","error"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"oneOf":[{"type":"string","maxLength":200},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{}},"additionalProperties":false}},"additionalProperties":false}}}},"404":{"description":"Unknown modern MCP method","content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","id","error"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"oneOf":[{"type":"string","maxLength":200},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{}},"additionalProperties":false}},"additionalProperties":false}}}},"406":{"description":"Required Accept media types missing","content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","id","error"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"oneOf":[{"type":"string","maxLength":200},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{}},"additionalProperties":false}},"additionalProperties":false}}}},"413":{"description":"Request body is too large","content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","id","error"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"oneOf":[{"type":"string","maxLength":200},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{}},"additionalProperties":false}},"additionalProperties":false}}}},"415":{"description":"Content-Type must be application/json","content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","id","error"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"oneOf":[{"type":"string","maxLength":200},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{}},"additionalProperties":false}},"additionalProperties":false}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","id","error"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"oneOf":[{"type":"string","maxLength":200},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{}},"additionalProperties":false}},"additionalProperties":false}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","id","error"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"oneOf":[{"type":"string","maxLength":200},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{}},"additionalProperties":false}},"additionalProperties":false}}}}}}}},"components":{"securitySchemes":{"InferenceApiKey":{"type":"http","scheme":"bearer","bearerFormat":"zpr_...","description":"Inference key created in the dashboard or management API."},"AnthropicInferenceApiKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"The same zpr_ inference key, accepted on Anthropic Messages routes for official Anthropic SDK compatibility. If Authorization is also present, both credentials must match exactly."},"ManagementToken":{"type":"http","scheme":"bearer","bearerFormat":"zpm_...","description":"Manually provisioned scoped management token. Accepted by management REST and MCP; never share it with an untrusted model or application."},"AgentOAuth":{"type":"oauth2","description":"Agent Connect public-client OAuth for the exact MCP resource https://zapros.ai/mcp. Its short-lived zpo_ tokens are accepted only by MCP, never by Management REST.","x-zapros-resource":"https://zapros.ai/mcp","x-zapros-protected-resource-metadata":"https://zapros.ai/.well-known/oauth-protected-resource/mcp","flows":{"authorizationCode":{"authorizationUrl":"https://zapros.ai/oauth/authorize","tokenUrl":"https://zapros.ai/oauth/token","scopes":{"account:read":"Read account identity and RUB balance","models:read":"Read catalogs and estimate inference cost","usage:read":"Read usage attributed to this connection plus personal organization, workspace, and project names and IDs","compute:read":"Read compute offers and instances","keys:read":"List keys created by this connection","keys:create":"Create bounded inference keys","keys:update":"Update keys created by this connection","keys:revoke":"Revoke keys created by this connection"}}}},"ManagementOAuth":{"type":"oauth2","description":"Public-client OAuth for the exact Management API resource https://zapros.ai/api/v1/management. Its short-lived zpo_ tokens are accepted only by Management REST, never by MCP. This is a separate grant and token family even when the same client also connects to MCP.","x-zapros-resource":"https://zapros.ai/api/v1/management","x-zapros-protected-resource-metadata":"https://zapros.ai/.well-known/oauth-protected-resource/api/v1/management","flows":{"authorizationCode":{"authorizationUrl":"https://zapros.ai/oauth/authorize","tokenUrl":"https://zapros.ai/oauth/token","scopes":{"account:read":"Read account identity and RUB balance","models:read":"Read catalogs and estimate inference cost","usage:read":"Read usage attributed to this grant plus personal organization, workspace, and project names and IDs","compute:read":"Read compute offers and account instances","keys:read":"List keys created by this grant","keys:create":"Create bounded inference keys","keys:update":"Update keys created by this grant","keys:revoke":"Revoke keys created by this grant"}}}},"SessionCookie":{"type":"apiKey","in":"cookie","name":"next-auth.session-token","description":"Interactive dashboard session cookie used on local HTTP."},"SecureSessionCookie":{"type":"apiKey","in":"cookie","name":"__Secure-next-auth.session-token","description":"Interactive dashboard session cookie used on production HTTPS."}},"parameters":{"ApiKeyId":{"name":"id","in":"path","required":true,"schema":{"type":"string"}},"ProjectId":{"name":"project_id","in":"query","required":true,"description":"Project that owns the inference key.","schema":{"type":"string","minLength":1,"maxLength":191}},"UsageProjectId":{"name":"project_id","in":"query","required":false,"description":"Optional authorized-project filter. It only narrows the caller's existing account or exact OAuth-grant usage boundary; it never grants project-wide access to other members' usage.","schema":{"type":"string","minLength":1,"maxLength":191}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object","required":["message"],"properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"additionalProperties":true}]},"code":{"type":"string"}},"additionalProperties":true},"JsonRpcError":{"type":"object","required":["jsonrpc","id","error"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"oneOf":[{"type":"string","maxLength":200},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{}},"additionalProperties":false}},"additionalProperties":false},"OpenRouterProviderPreferences":{"type":"object","description":"Bounded OpenRouter endpoint preferences. only, ignore, and order accept one to eight unique lowercase base-provider slugs without endpoint or paid-tier suffixes; order sets priority and is not an allowlist while allow_fallbacks is true. quantizations accepts the current documented OpenRouter levels. Zapros always adds require_parameters=true and a server-computed max_price. These preferences can reduce availability or change the final charge within the reserved ceiling. ZDR and data_collection apply to inference endpoints, not third-party tool backends.","properties":{"only":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,127}$"},"description":"Exact OpenRouter base-provider allowlist. Values are provider slugs returned by provider endpoint discovery. Array order does not express priority; paid tier suffixes containing '/' are not supported."},"ignore":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,127}$"},"description":"Exact OpenRouter base-provider denylist, merged with account-wide ignored providers. Values are provider slugs returned by provider endpoint discovery; paid tier suffixes containing '/' are not supported."},"order":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,127}$"},"description":"Preferred OpenRouter base-provider order. This prioritizes providers but is not an allowlist while allow_fallbacks is true; combine it with allow_fallbacks=false to restrict fallback outside the ordered list. When order is present, OpenRouter does not apply sort."},"quantizations":{"type":"array","minItems":1,"maxItems":12,"uniqueItems":true,"items":{"enum":["int4","int8","fp4","mxfp4","nvfp4","fp6","fp8","mxfp8","fp16","bf16","fp32","unknown"]},"description":"Restricts eligible OpenRouter endpoints to one of the requested quantization levels."},"sort":{"enum":["price","throughput","latency"]},"allow_fallbacks":{"type":"boolean"},"data_collection":{"const":"deny","description":"May only tighten routing to endpoints that do not collect data."},"zdr":{"const":true,"description":"May only tighten routing to zero-data-retention endpoints."},"require_parameters":{"const":true,"description":"Optional compatibility assertion; Zapros always enforces true."}},"additionalProperties":false},"MessagesProviderPreferences":{"type":"object","description":"Bounded OpenRouter endpoint preferences plus explicit Zapros credential routing for native Anthropic Messages. credential_mode and credential_provider are consumed locally and never forwarded upstream. managed is the default. credential_mode=byok requires credential_provider=openrouter, the workspace's sole active OpenRouter key, a directly created inference key, and a first-attempt Idempotency-Key. Both native JSON and one-shot Anthropic SSE retain all bounded OpenRouter routing preferences, which are forwarded separately.","properties":{"only":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,127}$"},"description":"Exact OpenRouter base-provider allowlist. Values are provider slugs returned by provider endpoint discovery. Array order does not express priority; paid tier suffixes containing '/' are not supported."},"ignore":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,127}$"},"description":"Exact OpenRouter base-provider denylist, merged with account-wide ignored providers. Values are provider slugs returned by provider endpoint discovery; paid tier suffixes containing '/' are not supported."},"order":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,127}$"},"description":"Preferred OpenRouter base-provider order. This prioritizes providers but is not an allowlist while allow_fallbacks is true; combine it with allow_fallbacks=false to restrict fallback outside the ordered list. When order is present, OpenRouter does not apply sort."},"quantizations":{"type":"array","minItems":1,"maxItems":12,"uniqueItems":true,"items":{"enum":["int4","int8","fp4","mxfp4","nvfp4","fp6","fp8","mxfp8","fp16","bf16","fp32","unknown"]},"description":"Restricts eligible OpenRouter endpoints to one of the requested quantization levels."},"sort":{"enum":["price","throughput","latency"]},"allow_fallbacks":{"type":"boolean"},"data_collection":{"const":"deny","description":"May only tighten routing to endpoints that do not collect data."},"zdr":{"const":true,"description":"May only tighten routing to zero-data-retention endpoints."},"require_parameters":{"const":true,"description":"Optional compatibility assertion; Zapros always enforces true."},"credential_mode":{"enum":["managed","byok"],"default":"managed","description":"managed uses Zapros provider credit; byok uses exactly one active workspace OpenRouter credential and never falls back to managed credit."},"credential_provider":{"const":"openrouter","description":"Required local credential selector for BYOK Messages. Native Messages never select a stored direct Anthropic credential. This field is removed before upstream dispatch."}},"additionalProperties":false,"allOf":[{"if":{"required":["credential_mode"],"properties":{"credential_mode":{"const":"byok"}}},"then":{"required":["credential_provider"]}},{"if":{"required":["credential_provider"]},"then":{"required":["credential_mode"],"properties":{"credential_mode":{"const":"byok"}}}}]},"ResponsesProviderPreferences":{"type":"object","description":"Bounded OpenRouter endpoint preferences plus explicit Zapros credential routing for Responses. credential_mode and credential_provider are consumed locally and never forwarded upstream. credential_mode=byok requires credential_provider=openrouter, the workspace's sole active OpenRouter key, a directly created inference key, and a first-attempt Idempotency-Key. Both JSON and one-shot SSE retain all bounded OpenRouter routing preferences, which are forwarded separately.","properties":{"only":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,127}$"},"description":"Exact OpenRouter base-provider allowlist. Values are provider slugs returned by provider endpoint discovery. Array order does not express priority; paid tier suffixes containing '/' are not supported."},"ignore":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,127}$"},"description":"Exact OpenRouter base-provider denylist, merged with account-wide ignored providers. Values are provider slugs returned by provider endpoint discovery; paid tier suffixes containing '/' are not supported."},"order":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,127}$"},"description":"Preferred OpenRouter base-provider order. This prioritizes providers but is not an allowlist while allow_fallbacks is true; combine it with allow_fallbacks=false to restrict fallback outside the ordered list. When order is present, OpenRouter does not apply sort."},"quantizations":{"type":"array","minItems":1,"maxItems":12,"uniqueItems":true,"items":{"enum":["int4","int8","fp4","mxfp4","nvfp4","fp6","fp8","mxfp8","fp16","bf16","fp32","unknown"]},"description":"Restricts eligible OpenRouter endpoints to one of the requested quantization levels."},"sort":{"enum":["price","throughput","latency"]},"allow_fallbacks":{"type":"boolean"},"data_collection":{"const":"deny","description":"May only tighten routing to endpoints that do not collect data."},"zdr":{"const":true,"description":"May only tighten routing to zero-data-retention endpoints."},"require_parameters":{"const":true,"description":"Optional compatibility assertion; Zapros always enforces true."},"credential_mode":{"enum":["managed","byok"],"default":"managed","description":"managed uses Zapros provider credit; byok uses exactly one active workspace OpenRouter credential and never falls back to managed credit."},"credential_provider":{"const":"openrouter","description":"Required local credential selector for BYOK Responses. It is removed before upstream dispatch."}},"additionalProperties":false,"allOf":[{"if":{"required":["credential_mode"],"properties":{"credential_mode":{"const":"byok"}}},"then":{"required":["credential_provider"]}},{"if":{"required":["credential_provider"]},"then":{"required":["credential_mode"],"properties":{"credential_mode":{"const":"byok"}}}}]},"ChatProviderPreferences":{"type":"object","description":"Bounded OpenRouter endpoint preferences plus explicit Zapros credential routing for Chat Completions. credential_mode=byok requires credential_provider, the workspace's sole active key for that provider, a directly created inference key, and a first-attempt Idempotency-Key. credential_provider=openrouter may use stream=false or stream=true and retains all bounded OpenRouter preferences, including only, ignore, order, quantizations, and allow_fallbacks. Direct provider routes require stream=false and allow_fallbacks=false and reject the other OpenRouter-only preferences. only remains an upstream provider allowlist, while order is merely priority unless allow_fallbacks=false; both are forwarded only when dispatch uses OpenRouter, with managed credit or credential_provider=openrouter.","properties":{"only":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,127}$"},"description":"Exact OpenRouter base-provider allowlist. Values are provider slugs returned by provider endpoint discovery. Array order does not express priority; paid tier suffixes containing '/' are not supported."},"ignore":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,127}$"},"description":"Exact OpenRouter base-provider denylist, merged with account-wide ignored providers. Values are provider slugs returned by provider endpoint discovery; paid tier suffixes containing '/' are not supported."},"order":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]{0,127}$"},"description":"Preferred OpenRouter base-provider order. This prioritizes providers but is not an allowlist while allow_fallbacks is true; combine it with allow_fallbacks=false to restrict fallback outside the ordered list. When order is present, OpenRouter does not apply sort."},"quantizations":{"type":"array","minItems":1,"maxItems":12,"uniqueItems":true,"items":{"enum":["int4","int8","fp4","mxfp4","nvfp4","fp6","fp8","mxfp8","fp16","bf16","fp32","unknown"]},"description":"Restricts eligible OpenRouter endpoints to one of the requested quantization levels."},"sort":{"enum":["price","throughput","latency"]},"allow_fallbacks":{"type":"boolean"},"data_collection":{"const":"deny","description":"May only tighten routing to endpoints that do not collect data."},"zdr":{"const":true,"description":"May only tighten routing to zero-data-retention endpoints."},"require_parameters":{"const":true,"description":"Optional compatibility assertion; Zapros always enforces true."},"credential_mode":{"enum":["managed","byok"],"default":"managed","description":"managed uses Zapros provider credit; byok uses exactly one active workspace credential for credential_provider and never falls back to managed credit."},"credential_provider":{"enum":["openrouter","openai","anthropic","google","deepseek","mistral"],"description":"Required local credential selector for BYOK. openrouter preserves the existing bounded Chat contract for both JSON and SSE: public model IDs, requested fallback models, client tools/functions, structured output, image/PDF input, capped web-search/plugins, and all bounded OpenRouter provider preferences. Its stream=true mode requires first-attempt idempotency but is delivered only once without transcript replay or resume. Direct openai supports only openai/gpt-5-mini; direct anthropic maps only anthropic/claude-sonnet-5.5 to native claude-sonnet-5-5 through the Messages API with server-fixed adaptive thinking and high effort; direct google supports only google/gemini-3.8-flash; direct deepseek supports only deepseek/deepseek-v4.1-flash with thinking disabled; and direct mistral supports only the Public Preview mistralai/mistral-large-4-0 model with reasoning disabled. Direct providers require stream=false and allow_fallbacks=false and reject other OpenRouter-only fields including only, ignore, order, and quantizations."}},"additionalProperties":false,"allOf":[{"if":{"required":["credential_mode"],"properties":{"credential_mode":{"const":"byok"}}},"then":{"required":["credential_provider"]}},{"if":{"required":["credential_provider"]},"then":{"required":["credential_mode"],"properties":{"credential_mode":{"const":"byok"}}}},{"if":{"required":["credential_provider"],"properties":{"credential_provider":{"enum":["openai","anthropic","google","deepseek","mistral"]}}},"then":{"properties":{"allow_fallbacks":{"const":false}},"not":{"anyOf":[{"required":["only"]},{"required":["ignore"]},{"required":["order"]},{"required":["quantizations"]},{"required":["sort"]},{"required":["data_collection"]},{"required":["zdr"]},{"required":["require_parameters"]}]}}}]},"ApiKeyLimits":{"type":"object","required":["monthly_budget_rub","max_request_rub","allowed_models"],"properties":{"monthly_budget_rub":{"type":["number","null"],"minimum":0,"maximum":99999999.9999},"max_request_rub":{"type":["number","null"],"exclusiveMinimum":0,"maximum":99999999.9999},"allowed_models":{"type":"array","maxItems":500,"items":{"type":"string","minLength":1,"maxLength":255},"description":"An empty array allows all currently supported models."}},"additionalProperties":false},"ManagementProject":{"type":"object","required":["id","object","name","is_default","organization_id","organization_name","organization_kind","workspace_id","workspace_name","workspace_kind","workspace_is_default"],"properties":{"id":{"type":"string","minLength":1,"maxLength":191},"object":{"const":"project"},"name":{"type":"string"},"is_default":{"type":"boolean"},"organization_id":{"type":"string","minLength":1,"maxLength":191},"organization_name":{"type":"string"},"organization_kind":{"const":"personal"},"workspace_id":{"type":"string","minLength":1,"maxLength":191},"workspace_name":{"type":["string","null"]},"workspace_kind":{"enum":["internal","client"]},"workspace_is_default":{"type":"boolean"}},"additionalProperties":false},"ApiKey":{"type":"object","required":["id","object","organization_id","workspace_id","project_id","prefix","name","active","limits"],"properties":{"id":{"type":"string"},"object":{"const":"api_key"},"organization_id":{"type":"string"},"workspace_id":{"type":"string"},"project_id":{"type":"string"},"prefix":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"limits":{"type":"object","required":["monthly_budget_rub","max_request_rub","allowed_models"],"properties":{"monthly_budget_rub":{"type":["number","null"],"minimum":0,"maximum":99999999.9999},"max_request_rub":{"type":["number","null"],"exclusiveMinimum":0,"maximum":99999999.9999},"allowed_models":{"type":"array","maxItems":500,"items":{"type":"string","minLength":1,"maxLength":255},"description":"An empty array allows all currently supported models."}},"additionalProperties":false},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"additionalProperties":true},"ApiKeyWithOneTimeSecret":{"allOf":[{"$ref":"#/components/schemas/ApiKey"},{"type":"object","required":["key"],"properties":{"key":{"type":"string","pattern":"^zpr_[A-Za-z0-9_-]{48}$","x-sensitive":true,"description":"Returned once to a trusted zpm_ caller. Never returned to an OAuth caller."}}}]},"DelegatedApiKeyClaim":{"allOf":[{"$ref":"#/components/schemas/ApiKey"},{"type":"object","description":"Dashboard claim delivery. Terminal consumed or expired metadata may also be returned to a zpm_ REST replay after the same operation was completed through MCP.","required":["idempotency_replayed","secret_delivery"],"properties":{"idempotency_replayed":{"type":"boolean"},"secret_delivery":{"type":"object","required":["method","claim_id","claim_url","claim_expires_at","state"],"properties":{"method":{"const":"dashboard_claim"},"claim_id":{"type":"string","pattern":"^zpc_[A-Za-z0-9_-]{43}$"},"claim_url":{"type":"string","format":"uri"},"claim_expires_at":{"type":"string","format":"date-time"},"state":{"enum":["available","revealed","consumed","expired"]}},"additionalProperties":false}},"not":{"required":["key"]}}]},"OAuthTokenResponse":{"type":"object","required":["access_token","token_type","expires_in","refresh_token","scope","resource"],"properties":{"access_token":{"type":"string","pattern":"^zpo_"},"token_type":{"const":"Bearer"},"expires_in":{"type":"integer","minimum":1,"maximum":900},"refresh_token":{"type":"string","pattern":"^zprf_"},"scope":{"type":"string"},"resource":{"enum":["https://zapros.ai/mcp","https://zapros.ai/api/v1/management"]}},"additionalProperties":false},"DynamicClientRegistration":{"type":"object","required":["client_id","client_id_issued_at","client_name","redirect_uris","token_endpoint_auth_method","grant_types","response_types","scope"],"properties":{"client_id":{"type":"string","pattern":"^zpc_[A-Za-z0-9_-]{43}$","description":"Opaque public client identifier. This value is not a credential or secret."},"client_id_issued_at":{"type":"integer","minimum":0},"client_name":{"type":"string","minLength":1,"maxLength":191},"client_uri":{"type":"string","format":"uri","maxLength":2048},"redirect_uris":{"type":"array","minItems":1,"maxItems":20,"uniqueItems":true,"items":{"type":"string","format":"uri","maxLength":2048}},"token_endpoint_auth_method":{"const":"none"},"grant_types":{"type":"array","prefixItems":[{"const":"authorization_code"},{"const":"refresh_token"}],"minItems":2,"maxItems":2},"response_types":{"type":"array","prefixItems":[{"const":"code"}],"minItems":1,"maxItems":1},"scope":{"type":"string"}},"additionalProperties":false},"Model":{"type":"object","required":["id","object","owned_by","pricing"],"properties":{"id":{"type":"string"},"object":{"const":"model"},"created":{"type":"integer"},"owned_by":{"type":"string"},"name":{"type":"string"},"modality":{"type":"string"},"input_modalities":{"type":"array","items":{"type":"string"}},"output_modalities":{"type":"array","items":{"type":"string"}},"supported_endpoints":{"type":"array","items":{"type":"string"}},"supported_provider_preferences":{"type":"array","description":"Provider preference fields accepted for this model. Empty for non-OpenRouter-backed models.","items":{"enum":["only","ignore","order","quantizations","sort","allow_fallbacks","data_collection","zdr","require_parameters"]}},"provider_endpoints_url":{"type":"string","pattern":"^/api/v1/models/[A-Za-z0-9][A-Za-z0-9._-]{0,127}/[A-Za-z0-9][A-Za-z0-9._-]{0,127}/endpoints$","description":"Inference-key-authenticated discovery URL for current OpenRouter endpoint provider slugs eligible for provider.only, provider.ignore, and provider.order, plus quantization values eligible for provider.quantizations."},"context_length":{"type":["integer","null"]},"pricing":{"type":"object","required":["input_per_m","output_per_m"],"properties":{"input_per_m":{"type":"number","minimum":0},"output_per_m":{"type":"number","minimum":0},"request_rub_per_inference":{"type":"number","minimum":0},"image_rub_per_image_per_inference":{"type":["number","null"],"minimum":0},"web_search_rub_per_use":{"type":["number","null"],"minimum":0}}}},"additionalProperties":true}}}}