{"openapi":"3.1.0","info":{"title":"Varity AI Gateway API","version":"2026-09-17","description":"Provider-neutral managed inference, served by the Varity AI Gateway at ai.varity.app. The text chat, streaming and tool-call surfaces are OpenAI-compatible. The image-edit and transcription routes take either the OpenAI SDK's multipart/form-data upload (file fields image or image[] and mask; file) or an application/json body with inline base64 parts (image.data, audio.data); both are validated as one contract. Tool execution and orchestration are client-managed."},"externalDocs":{"description":"Varity AI Gateway guide","url":"https://docs.varity.so/ai-gateway/"},"x-varity-capability-matrix":{"text_chat_completions":"supported","streaming_text":"supported","tool_call_generation_and_transport":"eligible_models","hosted_tool_execution":"unsupported","portable_reasoning_controls":"eligible_models","structured_output":"eligible_models","vision_input":"eligible_models","document_input":"eligible_models","file_input":"unsupported","image_generation":"eligible_models","image_editing":"eligible_models","embeddings":"supported","audio_transcription":"supported","audio_speech":"supported","batch":"unsupported"},"x-varity-commercial-contract":{"managed_rate":"provider_cost_times_1_05","funding_service_fee_percent":0,"minimum_refill_usd":20,"maximum_refill_usd":1000,"payment_method_required":true,"automatic_signup_credit":false,"byok":"unavailable"},"x-varity-catalog-exclusions":{"row_reasons":{"e2ee_transport_unattested":"The model runs in a TEE whose GPU attestation did not pass this gateway's own fresh check (or is not a text model); it is not served until a check passes. Client-encrypted (E2EE) requests are not relayed.","tee_gateway_only":"The model's attestation covers only an aggregator gateway, not the GPU inference host, so it is never offered as confidential.","no_neutral_operation":"No public operation of this API serves the model (for example image upscaling)."},"unserved_types":{"video":"Video generation is an asynchronous job API; this gateway does not serve it yet.","music":"Music and sound-effect generation is an asynchronous job API; this gateway does not serve it yet.","decision":"Decision models (for example jev-latest) have no operation in this API."}},"x-varity-data-handling":{"inference_metadata_retention_days":30,"stored_content":[],"content_never_stored":["prompts","responses","tool_arguments","uploaded_content","generated_image_bytes","playground_conversations"],"generated_image_retention":"inline_only","end_user_identifier":{"stored":"request_metadata","retention_days":30,"sent_to_suppliers":false,"telemetry":"keyed_hash"},"financial_and_security_records":"separate_retention_classes"},"servers":[{"url":"https://ai.varity.app"}],"security":[{"VarityApiKey":[]}],"paths":{"/v1/keys":{"get":{"security":[{"PrivySession":[]}],"operationId":"listInferenceKeys","summary":"List the authenticated owner's inference keys","description":"Developer Portal session required. Returns inference-only key metadata without plaintext or hashes.","responses":{"200":{"description":"Owned inference key metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceKeyList"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}},"post":{"security":[{"PrivySession":[]}],"operationId":"createInferenceKey","summary":"Create a scoped inference key for the authenticated owner","description":"Developer Portal session required. Plaintext is returned only once. An anonymized key requires the account's durable anonymized-processing consent; callers cannot supply owner, tier or services.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceKeyCreateRequest"}}}},"responses":{"200":{"description":"The new plaintext key and owner-scoped metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceKeyCreation"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/keys/audit":{"get":{"security":[{"PrivySession":[]}],"operationId":"listInferenceKeyAudit","summary":"List the authenticated owner's key lifecycle events","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}}],"responses":{"200":{"description":"Secret-free owner-scoped key lifecycle events","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceKeyAudit"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/keys/{id}/revoke":{"post":{"security":[{"PrivySession":[]}],"operationId":"revokeInferenceKey","summary":"Revoke a key owned by the authenticated account","description":"Developer Portal session required. The current replica forgets its cached verdict after Credential Proxy replies. Revocation does not promise cancellation or a refund for work already started.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^vki_[A-Za-z0-9_-]{20,64}$"}}],"responses":{"200":{"description":"The owner-scoped revocation result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceKeyRevocation"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/billing/balance":{"get":{"security":[{"PrivySession":[]}],"operationId":"getInferenceBalance","summary":"Get the authenticated owner's prepaid balance","responses":{"200":{"description":"The authenticated owner's current prepaid balance and settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceBalance"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/billing/transactions":{"get":{"security":[{"PrivySession":[]}],"operationId":"listInferenceBalanceTransactions","summary":"Get the authenticated owner's balance transactions","description":"USD amounts are returned for funding only. Usage, refunds and adjustments carry null USD amounts.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"maximum":10000,"default":0}}],"responses":{"200":{"description":"Customer-safe balance history and pagination","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceBalanceTransactions"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/billing/settings":{"patch":{"security":[{"PrivySession":[]}],"summary":"Update the authenticated owner's prepaid balance settings","description":"Requires a Developer Portal session. Both monthlySpendingLimitCents and all autoReload fields are required; thresholdCents must be less than amountCents. Does not fund the balance.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceBalanceSettings"}}}},"responses":{"200":{"description":"The authenticated owner's current prepaid balance and settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceBalance"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"operationId":"configureInferenceBalance"},"post":{"security":[{"PrivySession":[]}],"summary":"Update the authenticated owner's prepaid balance settings","description":"Requires a Developer Portal session. Both monthlySpendingLimitCents and all autoReload fields are required; thresholdCents must be less than amountCents. Does not fund the balance.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceBalanceSettings"}}}},"responses":{"200":{"description":"The authenticated owner's current prepaid balance and settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceBalance"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"operationId":"configureInferenceBalanceViaPost"}},"/v1/billing/top-up":{"post":{"security":[{"PrivySession":[]}],"operationId":"createInferenceBalanceCheckout","summary":"Create an owned card checkout to fund the prepaid balance","description":"Developer Portal session and an email verified as owned by that account are required. Replaying the same owner-scoped Idempotency-Key and payload returns the original checkout; a changed payload conflicts. A successful checkout creation is not proof of payment or credited balance.","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":16,"maxLength":200,"pattern":"^[A-Za-z0-9._~-]{16,200}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceBalanceTopUp"}}}},"responses":{"200":{"description":"Checkout URL and quoted funding amounts in cents; no funding service fee","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceBalanceCheckout"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/billing/checkout/{id}/reconcile":{"post":{"security":[{"PrivySession":[]}],"operationId":"reconcileInferenceBalanceCheckout","summary":"Reconcile an already-paid checkout owned by the authenticated account","description":"Developer Portal session required. Verifies checkout ownership, payment and the recorded funding amounts before idempotent credit; an unpaid or foreign checkout is refused. Does not submit a new payment.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^cs_(?:test|live)_[A-Za-z0-9]{1,250}$"}}],"responses":{"200":{"description":"Verified checkout funding reconciliation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceBalanceCheckoutReconciliation"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/openapi.json":{"get":{"security":[],"operationId":"getInferenceOpenApi","summary":"Get the AI Gateway contract","responses":{"200":{"description":"OpenAPI document","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/v1/models":{"get":{"security":[],"operationId":"listInferenceModels","summary":"List freshness-bounded models admitted by Varity","description":"Anonymous public discovery: the full admitted catalog projected at the anonymized privacy floor. Account, credential and per-request privacy policy are enforced on the authenticated routes, so the response privacy_scope is always anonymized here.","responses":{"200":{"description":"Admitted model inventory","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["object","privacy_scope","data"],"properties":{"object":{"const":"list"},"privacy_scope":{"type":"string","enum":["private","anonymized","tee"],"description":"Effective privacy floor used to project this catalog."},"data":{"type":"array","items":{"$ref":"#/components/schemas/Model"}}}}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/models/{model}":{"get":{"security":[],"operationId":"retrieveInferenceModel","summary":"Retrieve one admitted model","description":"One entry of the anonymous /v1/models catalog, by its Varity model id (OpenAI SDK models.retrieve). An id the catalog does not list answers 404 model_not_found.","parameters":[{"name":"model","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The admitted model","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Model"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/responses":{"post":{"operationId":"createResponse","summary":"Create a model response (OpenAI Responses contract)","description":"The OpenAI Responses request translated onto the chat route for every model chat serves: same routing, limits and billing. input is a string or message, function_call, function_call_output and reasoning items; function tools only. Varity stores no responses, so previous_response_id, store:true and background:true are refused by name. Streaming answers Responses SSE events (response.created ... response.completed); reasoning text arrives as a reasoning item where the supplier returns it.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Deadline"},{"$ref":"#/components/parameters/Job"},{"$ref":"#/components/parameters/EndUser"},{"$ref":"#/components/parameters/EndUserBudget"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string"},"input":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object"}}]},"instructions":{"type":"string"},"max_output_tokens":{"type":"integer","minimum":1},"stream":{"type":"boolean"},"tools":{"type":"array","items":{"type":"object"}},"reasoning":{"type":"object","properties":{"effort":{"type":"string"}}}}}}}},"responses":{"200":{"description":"Response JSON, or Responses SSE events when stream is true","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","required":["id","object","status","output"]}},"text/event-stream":{"schema":{"type":"string"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/messages":{"post":{"operationId":"createAnthropicMessage","summary":"Create a message (Anthropic Messages contract)","description":"The Anthropic Messages request translated onto the chat route for every model chat serves: same routing, privacy floor, limits and billing. system is a string or text blocks; messages carry text, image and tool_result/tool_use blocks; Anthropic tools map to OpenAI function tools. tool_choice accepts the string aliases and the object forms, including disable_parallel_tool_use. A non-streaming answer is an Anthropic message object. Stream true answers the Anthropic SSE sequence (message_start, content_block_start/delta/stop, message_delta, message_stop); message_start.model is the served model, not the requested alias. stop_sequences is refused 400 because the chat contract cannot report which sequence matched. The credential may be Authorization: Bearer or x-api-key. Errors use the Anthropic error body with the matching status.","security":[{"VarityApiKey":[]},{"AnthropicApiKey":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Deadline"},{"$ref":"#/components/parameters/Job"},{"$ref":"#/components/parameters/EndUser"},{"$ref":"#/components/parameters/EndUserBudget"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicMessagesRequest"}}}},"responses":{"200":{"description":"Anthropic message JSON, or Anthropic SSE events when stream is true","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicMessage"}},"text/event-stream":{"schema":{"type":"string","description":"Anthropic event frames in order: message_start, content_block_start, content_block_delta (text_delta or input_json_delta), content_block_stop, message_delta (stop_reason and usage), message_stop. A failure after the 200 is an error event."}}}},"default":{"description":"Anthropic error envelope: invalid_request_error, authentication_error, rate_limit_error or api_error, with the matching HTTP status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnthropicError"}}}}}}},"/v1/web/search":{"post":{"operationId":"createWebSearch","summary":"Ground a question in a live web search and return its cited sources","description":"Runs one non-streaming grounded completion through the same chat engine, routing, privacy floor, admission and billing as /v1/chat/completions. The routed model is a published model whose capabilities.web_search is true. results contains exactly the provider-reported citations, truncated to count; an answer with no citations returns results: [], never an invented source. Provider, authentication and budget failures use the same error envelope as chat.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Deadline"},{"$ref":"#/components/parameters/Job"},{"$ref":"#/components/parameters/EndUser"},{"$ref":"#/components/parameters/EndUserBudget"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebSearchRequest"}}}},"responses":{"200":{"description":"Cited web search results","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebSearchResponse"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/web/fetch":{"post":{"operationId":"createWebFetch","summary":"Fetch a public page and return its readable text","description":"A server-side fetch with no provider cost and no billing. Only http(s) URLs are accepted. A request-phase non-http(s) scheme, embedded credential or non-web port is 400 invalid_request; any target (including after every redirect) resolving to loopback, private, link-local, CGNAT, multicast, unspecified or IPv6 ULA addresses, and a redirect to a non-http(s) scheme, embedded credential or non-web port, is 403 web_fetch_blocked. At most three redirects, a 10 second total deadline and a 2,000,000 byte response cap apply; exceeding one is web_fetch_limit_exceeded (502 for the DNS/redirect/byte limit, 504 for the 10 second deadline) and is a Varity limit, not a supplier failure. The caller's own deadline is 504 deadline_exceeded and a caller disconnect is 499 request_cancelled. Only HTML/XHTML, plain text, Markdown and JSON are extracted; another media type is 415 web_fetch_unsupported_type. A target that answers an error, resets the connection or fails TLS is 502 web_fetch_failed. The route records url host, status, response bytes and duration only, never the query string or page body.","parameters":[{"$ref":"#/components/parameters/Deadline"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebFetchRequest"}}}},"responses":{"200":{"description":"Readable page text","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebFetchResponse"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/chat/completions":{"post":{"operationId":"createChatCompletion","summary":"Create a finite text chat completion","description":"Creates a streaming or non-streaming text response. Tool-call generation and transport supported on eligible models. Tool execution and orchestration are client-managed.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Deadline"},{"$ref":"#/components/parameters/Job"},{"$ref":"#/components/parameters/EndUser"},{"$ref":"#/components/parameters/EndUserBudget"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionRequest"},"examples":{"non_streaming":{"summary":"Non-streaming text completion","value":{"model":"qwen-3-6-35b-a3b","messages":[{"role":"user","content":"Explain this API in one sentence."}],"max_completion_tokens":256,"stream":false}},"streaming":{"summary":"Streaming text completion","value":{"model":"qwen-3-6-35b-a3b","messages":[{"role":"user","content":"Write a short TypeScript example."}],"max_completion_tokens":512,"stream":true}}}}}},"responses":{"200":{"description":"Completion JSON, or SSE when stream is true","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletion"}},"text/event-stream":{"schema":{"type":"string","description":"OpenAI-compatible data frames ending in data: [DONE], preceded by a usage chunk with empty choices when stream_options.include_usage is true. Every chunk carries the same id (chatcmpl-{request_id}) and created as a non-streaming completion would."}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/embeddings":{"post":{"operationId":"createEmbedding","summary":"Create embeddings with an admitted embedding model","description":"Returns one OpenAI-compatible embedding vector per input string. Only a model whose projected capabilities advertise output_modalities [\"embedding\"] is routable; a chat-only model is rejected.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Deadline"},{"$ref":"#/components/parameters/Job"},{"$ref":"#/components/parameters/EndUser"},{"$ref":"#/components/parameters/EndUserBudget"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["model","input"],"properties":{"model":{"type":"string"},"input":{"oneOf":[{"type":"string"},{"type":"array","minItems":1,"maxItems":2048,"items":{"type":"string"}}]},"encoding_format":{"type":"string","enum":["float","base64"],"default":"float"},"dimensions":{"type":"integer","minimum":1,"maximum":32768}}}}}},"responses":{"200":{"description":"Embedding vectors","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["object","data","model","usage"],"properties":{"object":{"const":"list"},"model":{"type":"string"},"data":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["object","embedding","index"],"properties":{"object":{"const":"embedding"},"index":{"type":"integer","minimum":0},"embedding":{"oneOf":[{"type":"array","items":{"type":"number"}},{"type":"string"}]}}}},"usage":{"type":"object","additionalProperties":false,"required":["prompt_tokens","total_tokens"],"properties":{"prompt_tokens":{"type":"integer","minimum":0},"total_tokens":{"type":"integer","minimum":0}}}}}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/images/generations":{"post":{"operationId":"createImageGeneration","summary":"Generate images from a text prompt","description":"Provider-neutral image generation on image-capable models. Results are returned inline as base64; Varity does not persist generated image bytes. The declared mime_type is the type of the returned bytes, and the returned image's size is the one encoded in those bytes: a model may quantize the requested size to one it supports, as the 2026-09-16 live flux-2-pro route did. Billing is the provider per-image price plus the managed rate.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Deadline"},{"$ref":"#/components/parameters/Job"},{"$ref":"#/components/parameters/EndUser"},{"$ref":"#/components/parameters/EndUserBudget"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["model","prompt"],"properties":{"model":{"type":"string"},"prompt":{"type":"string","maxLength":7500},"size":{"type":"string","description":"Requested WIDTHxHEIGHT. The model may return a different pixel size; the authoritative size is the one encoded in the returned bytes. Defaults to 1024x1024."},"n":{"type":"integer","minimum":1,"maximum":4,"default":1},"response_format":{"type":"string","enum":["b64_json"],"description":"Accepted for OpenAI SDK parity. Images are always returned inline as b64_json; Varity hosts no image URLs, so url is refused."},"varity_extensions":{"type":"object","additionalProperties":false,"properties":{"privacy_floor":{"type":"string","enum":["private","anonymized","tee"],"description":"Requires this privacy class or stronger for this request. It cannot weaken the account floor (403 privacy_policy_violation), and a model with no route meeting it answers 403 privacy_route_unavailable."}}}}},"examples":{"generation":{"summary":"Generate two images","value":{"model":"grok-imagine-image","prompt":"A red cube on a table","size":"512x512","n":2}}}}}},"responses":{"200":{"description":"Provider-neutral image result with inline base64 images","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["created","model","data","content_violation","blurred"],"properties":{"created":{"type":"integer"},"model":{"type":"string"},"data":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["b64_json","mime_type"],"properties":{"b64_json":{"type":"string","description":"Inline base64 image bytes; never persisted by Varity."},"mime_type":{"type":"string","enum":["image/png","image/jpeg","image/webp"]}}}},"content_violation":{"type":"boolean","description":"The provider returned output that violates its content policy."},"blurred":{"type":"boolean","description":"Safe mode returned a blurred image."}}}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/images/edits":{"post":{"operationId":"createImageEdit","summary":"Edit an image from a source image and prompt","description":"Provider-neutral image editing on image-capable models. Send the OpenAI SDK multipart/form-data upload (one source image in image or image[], optional mask) or application/json with the source image as image.data (base64) and image.mime_type; both are validated as one contract. More than one source image is rejected (param $.image). A source image or mask above 25 MB is rejected.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Deadline"},{"$ref":"#/components/parameters/Job"},{"$ref":"#/components/parameters/EndUser"},{"$ref":"#/components/parameters/EndUserBudget"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["model","prompt","image"],"properties":{"model":{"type":"string"},"prompt":{"type":"string","maxLength":32768},"image":{"$ref":"#/components/schemas/ImageInput"},"mask":{"$ref":"#/components/schemas/ImageInput"},"size":{"type":"string"},"varity_extensions":{"type":"object","additionalProperties":false,"properties":{"privacy_floor":{"type":"string","enum":["private","anonymized","tee"],"description":"Requires this privacy class or stronger for this request. It cannot weaken the account floor (403 privacy_policy_violation), and a model with no route meeting it answers 403 privacy_route_unavailable."}}}}}},"multipart/form-data":{"schema":{"type":"object","additionalProperties":false,"required":["model","prompt","image"],"properties":{"model":{"type":"string"},"prompt":{"type":"string","maxLength":32768},"image":{"type":"string","format":"binary","description":"The one source image; image[] with exactly one file is the same field."},"mask":{"type":"string","format":"binary"},"size":{"type":"string"},"varity_extensions":{"type":"string","description":"The same object as the JSON body, as JSON text, for example {\"privacy_floor\":\"private\"}."}}}}}},"responses":{"200":{"description":"Provider-neutral image result with inline base64 images","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["created","model","data","content_violation","blurred"],"properties":{"created":{"type":"integer"},"model":{"type":"string"},"data":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":false,"required":["b64_json","mime_type"],"properties":{"b64_json":{"type":"string","description":"Inline base64 image bytes; never persisted by Varity."},"mime_type":{"type":"string","enum":["image/png","image/jpeg","image/webp"]}}}},"content_violation":{"type":"boolean","description":"The provider returned output that violates its content policy."},"blurred":{"type":"boolean","description":"Safe mode returned a blurred image."}}}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/audio/transcriptions":{"post":{"operationId":"createAudioTranscription","summary":"Transcribe audio into text","description":"Send the OpenAI SDK multipart/form-data upload (file field file; the part type, else the filename extension, is the media type) or application/json with the audio as audio.data (base64) and audio.media_type; both are validated as one contract. The accepted media types, the 25 MB byte ceiling, and the 600-second audio-duration admission bound are the provider-neutral contract; the model id must advertise capabilities.transcription. Returns JSON (or plain text when response_format is text). Transcription is request/response with no streaming mode.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Deadline"},{"$ref":"#/components/parameters/Job"},{"$ref":"#/components/parameters/EndUser"},{"$ref":"#/components/parameters/EndUserBudget"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudioTranscriptionRequest"},"examples":{"wav":{"summary":"Transcribe a WAV recording","value":{"model":"whisper-large-v3","audio":{"data":"<base64 audio bytes>","media_type":"audio/wav","filename":"note.wav"},"response_format":"json"}}}},"multipart/form-data":{"schema":{"type":"object","additionalProperties":false,"required":["model","file"],"properties":{"model":{"type":"string"},"file":{"type":"string","format":"binary"},"response_format":{"type":"string","enum":["json","text"]},"language":{"type":"string"}}}}}},"responses":{"200":{"description":"Transcription JSON, or text/plain when response_format is text","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudioTranscription"}},"text/plain":{"schema":{"type":"string"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/audio/speech":{"post":{"operationId":"createAudioSpeech","summary":"Generate speech audio from text","description":"Returns audio bytes in the requested format (the model default when omitted), with the matching audio/* content type. The model id must advertise capabilities.speech, and the format must be one the model publishes in capabilities.speech_formats. Set stream true for a chunked binary response; there is no SSE framing.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"},{"$ref":"#/components/parameters/Deadline"},{"$ref":"#/components/parameters/Job"},{"$ref":"#/components/parameters/EndUser"},{"$ref":"#/components/parameters/EndUserBudget"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudioSpeechRequest"},"examples":{"speech":{"summary":"Generate an MP3 clip","value":{"model":"tts-kokoro","input":"Hello from Varity.","response_format":"mp3","voice":"af_sky","speed":1}}}}}},"responses":{"200":{"description":"Audio bytes in the requested format","headers":{"X-Request-Id":{"$ref":"#/components/headers/RequestId"}},"content":{"audio/mpeg":{"schema":{"type":"string","format":"binary"}},"audio/opus":{"schema":{"type":"string","format":"binary"}},"audio/aac":{"schema":{"type":"string","format":"binary"}},"audio/flac":{"schema":{"type":"string","format":"binary"}},"audio/wav":{"schema":{"type":"string","format":"binary"}},"audio/pcm":{"schema":{"type":"string","format":"binary"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/inference/requests":{"get":{"operationId":"listInferenceRequests","summary":"List recent owner-scoped inference request metadata","description":"Returns metadata only for the authenticated owner and current key or workload attachment scope. Returns no prompt, response, provider identity, upstream cost, reservation, secret, or idempotency key. Request metadata is retained for 30 days, then deleted; money records outlive it in the billing ledger.","parameters":[{"$ref":"#/components/parameters/RequestLogLimit"},{"$ref":"#/components/parameters/RequestLogCursor"},{"$ref":"#/components/parameters/RequestId"},{"$ref":"#/components/parameters/RequestModel"},{"$ref":"#/components/parameters/RequestState"},{"$ref":"#/components/parameters/RequestCreatedAfter"},{"$ref":"#/components/parameters/RequestCreatedBefore"},{"$ref":"#/components/parameters/RequestKey"},{"$ref":"#/components/parameters/RequestProject"},{"$ref":"#/components/parameters/RequestApplication"},{"$ref":"#/components/parameters/RequestDeployment"},{"$ref":"#/components/parameters/RequestEnvironment"},{"$ref":"#/components/parameters/RequestEndUser"}],"responses":{"200":{"description":"Recent metadata-only inference requests","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["object","data","has_more","next_cursor"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/InferenceRequest"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"],"format":"uuid"}}}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/inference/usage":{"get":{"operationId":"getInferenceUsage","summary":"Get owner-scoped inference usage","description":"Returns authoritative customer spend from settled AI Gateway API charges plus the separate prepaid Gateway balance. Chat and Build requests are billed from the prepaid balance and are not included here. Provider identity and upstream cost never cross this interface.","responses":{"200":{"description":"Current tenant policy-period usage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceUsage"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/inference/policy":{"get":{"operationId":"getInferenceTenantPolicy","summary":"Get the authenticated tenant privacy policy","description":"Returns the privacy floor enforced by the managed-inference admission authority. With a scoped API key the effective floor is reported beside the account floor, so a key can never be read as looser than it is.","responses":{"200":{"description":"Owner-scoped tenant policy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferenceTenantPolicy"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}},"/v1/inference/performance":{"get":{"operationId":"getInferencePerformance","summary":"Get owner-scoped aggregate inference performance","description":"Returns direct ledger aggregates without provider identity, upstream cost, prompt content, or response content. Percentiles remain null until the documented sample floor is reached, and source freshness is explicit.","parameters":[{"$ref":"#/components/parameters/PerformanceWindow"}],"responses":{"200":{"description":"Customer-safe aggregate inference performance","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferencePerformance"}}}},"default":{"description":"Normalized error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}}}}},"components":{"securitySchemes":{"VarityApiKey":{"type":"http","scheme":"bearer","description":"An owner-bound Varity API key with an inference service scope. Provider credentials are never accepted."},"PrivySession":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"An authenticated Developer Portal Privy access token for the account owner. API keys cannot authorize these key-management or billing operations."},"AnthropicApiKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"The same Varity inference key as the bearer token, sent in the header Anthropic SDKs use when configured with an API key. Accepted only on /v1/messages."}},"headers":{"RequestId":{"description":"The request id: the caller's canonical UUID X-Request-Id when one was sent, otherwise one minted UUID. A chat completion's id is chatcmpl- followed by this value.","required":true,"schema":{"type":"string","format":"uuid"}}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":8,"maxLength":200},"description":"Opaque tenant-scoped key. Send the same key when retrying: reuse is rejected with 409 duplicate_request rather than charging twice, and Varity persists only an owner-bound digest. Omit it and Varity issues a key per request, so each call is admitted and billed independently."},"Deadline":{"name":"X-Varity-Deadline-Ms","in":"header","required":false,"schema":{"type":"integer","minimum":1},"description":"Optional absolute Unix-epoch deadline in milliseconds, chosen by the caller. Varity has no total response-time limit: without this header a request runs until the model finishes or the client disconnects. A provider that sends nothing for 300 seconds fails the request 504 upstream_timeout (every chat request except a web_search one, whose answer the provider returns only whole). With it, a request still running at that instant ends 504 deadline_exceeded. A malformed or already-past value is refused 400 invalid_request before any provider effect or charge."},"Job":{"name":"X-Varity-Job","in":"header","required":false,"schema":{"type":"string","enum":["build","chat","api"]},"description":"Optional label for which job the request serves: build (vibe coding), chat (Private Chat), or api (your own API call). Used only to group Varity's request telemetry; it changes no routing, limit, price, or permission. An absent or unlisted value is recorded as api for an API-key request and unknown otherwise; it is never refused."},"EndUser":{"name":"X-Varity-End-User","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[\\x20-\\x7e]{1,64}$"},"description":"Your own end user for this request (1-64 printable ASCII characters; send a stable pseudonym, not an email). Overrides the body fields `safety_identifier` and then `user`. Used to attribute usage (`end_user` on /v1/inference/requests) and to apply X-Varity-End-User-Budget-Usd. Never forwarded to a supplier. A malformed value is refused 400 invalid_request."},"EndUserBudget":{"name":"X-Varity-End-User-Budget-Usd","in":"header","required":false,"schema":{"type":"string","pattern":"^\\d{1,5}(\\.\\d{1,8})?$"},"description":"Optional cap, in USD from 0 to 10000, on this end user's spend in the current policy period. The spend counted is the same as the account budget: the supplier cost of each settled request plus the reservation of each open one, over every request this end user made in the period (with or without this header). A request that would exceed it is refused 429 budget_exceeded, \"The end-user inference budget is exhausted.\", before any provider effect. Requires an end user (X-Varity-End-User, safety_identifier or user); without one, or malformed, it is refused 400 invalid_request. Set it from your server: it is not sent by browsers cross-origin."},"RequestEndUser":{"name":"end_user","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":64},"description":"Only requests made for this end user (as sent in X-Varity-End-User, safety_identifier or user)."},"RequestLogLimit":{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},"RequestLogCursor":{"name":"cursor","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"The last request_id from the previous page."},"RequestId":{"name":"request_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Exactly one request: the X-Request-Id its response carried. Returns at most one row."},"RequestModel":{"name":"model","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":256}},"RequestState":{"name":"state","in":"query","required":false,"schema":{"type":"string","enum":["reserved","started","succeeded","failed","unreconciled"]}},"RequestCreatedAfter":{"name":"created_after","in":"query","required":false,"description":"RFC 3339 UTC timestamp, fractional seconds optional: 2026-09-16T13:00:00Z or 2026-09-16T13:00:00.000Z. Offsets are rejected.","schema":{"type":"string","format":"date-time"}},"RequestCreatedBefore":{"name":"created_before","in":"query","required":false,"description":"Same format as created_after; must be later than it.","schema":{"type":"string","format":"date-time"}},"RequestKey":{"name":"key_id","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":128}},"RequestProject":{"name":"project_id","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":128}},"RequestApplication":{"name":"application_id","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":128}},"RequestDeployment":{"name":"deployment_id","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":128}},"RequestEnvironment":{"name":"environment","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":128}},"PerformanceWindow":{"name":"window","in":"query","required":false,"schema":{"type":"string","enum":["1h","24h","7d","30d"],"default":"24h"}}},"schemas":{"InferenceKeyCreateRequest":{"type":"object","additionalProperties":false,"required":["name","allowed_models","privacy_floor"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[^\\u0000-\\u001f\\u007f]+$"},"project_id":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9:._-]{0,127}$"},"application_id":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9:._-]{0,127}$"},"environment":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9:._-]{0,127}$"},"allowed_models":{"type":"array","maxItems":64,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9.-]{0,95}$"},"description":"Canonical Varity model ids, at most 4096 characters combined. An empty list adds no model restriction."},"privacy_floor":{"type":"string","enum":["private","anonymized","tee"]},"upstream_budget_usd":{"type":"number","minimum":0,"maximum":10000},"requests_per_minute":{"type":"integer","minimum":1,"maximum":10000},"concurrency_limit":{"type":"integer","minimum":1,"maximum":1000},"expires_at":{"type":"number","minimum":0,"maximum":9007199254740991,"description":"Unix seconds. Credential Proxy requires a future instant no more than 366 days away; fractions are accepted."}}},"InferenceKey":{"type":"object","additionalProperties":false,"required":["id","name","tier","principal_type","services","allowed_models","privacy_floor","rotation_generation","active"],"description":"Owner-scoped Credential Proxy metadata. Plaintext, hashes and secret references are not returned by list or audit.","properties":{"id":{"type":"string","pattern":"^vki_[A-Za-z0-9_-]{20,64}$"},"name":{"type":"string"},"tier":{"type":"string"},"principal_type":{"type":"string"},"services":{"type":"array","minItems":1,"maxItems":1,"items":{"const":"inference"}},"project_id":{"type":["string","null"]},"application_id":{"type":["string","null"]},"deployment_id":{"type":["string","null"]},"environment":{"type":["string","null"]},"allowed_models":{"type":"array","items":{"type":"string"}},"privacy_floor":{"type":"string","enum":["private","anonymized","tee"]},"upstream_budget_usd":{"type":["number","null"],"minimum":0},"requests_per_minute":{"type":["integer","null"],"minimum":1},"concurrency_limit":{"type":["integer","null"],"minimum":1},"expires_at":{"type":["number","null"]},"attachment_id":{"type":["string","null"]},"rotation_generation":{"type":"integer","minimum":0},"created_at":{"type":["number","null"]},"last_used_at":{"type":["number","null"]},"revoked_at":{"type":["number","null"]},"active":{"type":"boolean"}}},"InferenceKeyCreation":{"type":"object","additionalProperties":false,"required":["api_key","key"],"properties":{"api_key":{"type":"string","description":"Plaintext key, returned only at creation. Store it securely; it cannot be retrieved later."},"key":{"$ref":"#/components/schemas/InferenceKey"}}},"InferenceKeyList":{"type":"object","additionalProperties":false,"required":["api_keys"],"properties":{"api_keys":{"type":"array","items":{"$ref":"#/components/schemas/InferenceKey"}}}},"InferenceKeyAudit":{"type":"object","additionalProperties":false,"required":["events"],"properties":{"events":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","type","key_id","principal_type","occurred_at"],"properties":{"id":{"type":"string"},"type":{"type":"string"},"key_id":{"type":"string","pattern":"^vki_[A-Za-z0-9_-]{20,64}$"},"principal_type":{"type":"string"},"project_id":{"type":["string","null"]},"application_id":{"type":["string","null"]},"deployment_id":{"type":["string","null"]},"attachment_id":{"type":["string","null"]},"occurred_at":{"type":"number","minimum":0,"description":"Unix seconds."}}}}}},"InferenceKeyRevocation":{"type":"object","additionalProperties":false,"required":["revoked"],"properties":{"revoked":{"type":"boolean","description":"Whether an owned key was revoked. A key outside this owner is never changed."}}},"InferenceBalance":{"type":"object","additionalProperties":false,"required":["status","currency","accessState","cashBalanceUsd","promotionalBalanceUsd","reservedUsd","availableBalanceUsd","spendThisMonthUsd","monthlySpendingLimitUsd","remainingMonthlySpendUsd","autoReload"],"properties":{"status":{"const":"configured"},"currency":{"const":"usd"},"accessState":{"type":"string","enum":["active","frozen"]},"cashBalanceUsd":{"type":"number","description":"Signed cash balance; negative cash does not become an unavailable or zero balance."},"promotionalBalanceUsd":{"type":"number","minimum":0},"reservedUsd":{"type":"number","minimum":0},"availableBalanceUsd":{"type":"number"},"spendThisMonthUsd":{"type":"number","minimum":0},"monthlySpendingLimitUsd":{"type":["number","null"],"minimum":0},"remainingMonthlySpendUsd":{"type":["number","null"],"minimum":0},"autoReload":{"type":"object","additionalProperties":false,"required":["enabled","thresholdUsd","amountUsd","status","failureCode"],"properties":{"enabled":{"type":"boolean"},"thresholdUsd":{"type":"number","minimum":0},"amountUsd":{"type":"number","minimum":0},"status":{"type":"string","enum":["idle","pending","action_required"]},"failureCode":{"type":["string","null"]}}}}},"InferenceBalanceSettings":{"type":"object","additionalProperties":false,"required":["monthlySpendingLimitCents","autoReload"],"properties":{"monthlySpendingLimitCents":{"type":["integer","null"],"minimum":100,"maximum":10000000},"autoReload":{"type":"object","additionalProperties":false,"required":["enabled","thresholdCents","amountCents"],"description":"thresholdCents must be strictly less than amountCents, including when disabled.","properties":{"enabled":{"type":"boolean"},"thresholdCents":{"type":"integer","minimum":0,"maximum":10000000},"amountCents":{"type":"integer","minimum":2000,"maximum":100000}}}}},"InferenceBalanceTopUp":{"type":"object","required":["email","balanceCents"],"properties":{"email":{"type":"string","minLength":1,"maxLength":254,"description":"An email address verified as owned by the authenticated account."},"balanceCents":{"type":"integer","minimum":2000,"maximum":100000},"successUrl":{"type":"string","description":"HTTPS return URL on varity.so, varity.app or a subdomain; other values use the Portal fallback. The checkout session id is appended."},"cancelUrl":{"type":"string","description":"HTTPS return URL on varity.so, varity.app or a subdomain; other values use the Portal fallback."}}},"InferenceBalanceCheckout":{"type":"object","additionalProperties":false,"required":["url","sessionId","balanceCents","serviceFeeCents","totalCents"],"properties":{"url":{"type":["string","null"]},"sessionId":{"type":"string"},"balanceCents":{"type":"integer","minimum":2000,"maximum":100000},"serviceFeeCents":{"const":0},"totalCents":{"type":"integer","minimum":2000,"maximum":100000}}},"InferenceBalanceCheckoutReconciliation":{"type":"object","additionalProperties":false,"required":["sessionId","funded"],"properties":{"sessionId":{"type":"string"},"funded":{"const":true}}},"InferenceBalanceTransactions":{"type":"object","additionalProperties":false,"required":["transactions","pagination"],"properties":{"transactions":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","type","balance","amountUsd","serviceFeeUsd","taxUsd","totalUsd","source","grantAuthority","grantReason","createdAt"],"properties":{"id":{"type":"string"},"type":{"type":"string","enum":["funding","usage","refund","adjustment"]},"balance":{"type":"string","enum":["cash","promotional","mixed"]},"amountUsd":{"type":["number","null"]},"serviceFeeUsd":{"type":["number","null"]},"taxUsd":{"type":["number","null"]},"totalUsd":{"type":["number","null"]},"source":{"type":"string","enum":["inference","card_refund","auto_reload","card","promotion","adjustment"]},"grantAuthority":{"type":["string","null"]},"grantReason":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}},"description":"USD amounts are present for funding only; usage, refunds and adjustments return null amounts. No prompt, content or internal rate card is returned."}},"pagination":{"type":"object","additionalProperties":false,"required":["limit","offset","hasMore"],"properties":{"limit":{"type":"integer","minimum":1,"maximum":100},"offset":{"type":"integer","minimum":0,"maximum":10000},"hasMore":{"type":"boolean"}}}}},"ImageInput":{"type":"object","additionalProperties":false,"required":["data","mime_type"],"description":"Inline image bytes for an application/json body (bare base64). A multipart/form-data request sends the file itself instead.","properties":{"data":{"type":"string","description":"Base64-encoded image bytes."},"mime_type":{"type":"string","enum":["image/png","image/jpeg","image/webp"]}}},"InferenceTenantPolicy":{"type":"object","additionalProperties":false,"required":["object","privacy_floor"],"properties":{"object":{"const":"inference.tenant_policy"},"privacy_floor":{"type":"string","enum":["private","anonymized","tee"]},"credential_privacy_floor":{"type":["string","null"],"enum":["private","anonymized","tee",null]},"effective_privacy_floor":{"type":"string","enum":["private","anonymized","tee"]},"limit_tier":{"type":"string","enum":["standard","enterprise"]},"requests_per_minute":{"type":"integer","minimum":1},"concurrency_limit":{"type":"integer","minimum":1},"limits_scope":{"const":"account"},"credential_requests_per_minute":{"type":["integer","null"],"minimum":1},"credential_concurrency_limit":{"type":["integer","null"],"minimum":1}}},"ErrorEnvelope":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"object","additionalProperties":false,"required":["message","type","code","param","retryable","request_id"],"properties":{"message":{"type":"string"},"type":{"type":"string","enum":["invalid_request_error","authentication_error","rate_limit_error","api_error"]},"code":{"type":"string"},"param":{"type":["string","null"]},"retryable":{"type":"boolean"},"request_id":{"type":"string"},"dependency":{"type":"string","description":"Present on a 503 when a named verifier or dependency was unavailable, except on `authentication_unavailable` 503s, where it is absent; that name is available only in readiness and server-side telemetry."},"diagnostic_code":{"type":"string","description":"Present when the code is a managed-inference failure cause: ai_gateway.<code>."},"failure_cause":{"type":"string"},"failure_domain":{"type":"string","enum":["varity_projection","supplier_observed","dependency_observed"],"description":"Who decided the failure: Varity, an inference supplier, or an unavailable Varity-operated dependency. On `authentication_unavailable` 503s `dependency` is absent; the name is available only in readiness and server-side telemetry."},"lifecycle_stage":{"type":"string","enum":["admission","provider_attempt","settlement","terminal"]},"action":{"type":"string"}}}}},"Usage":{"type":"object","additionalProperties":false,"required":["prompt_tokens","completion_tokens","total_tokens"],"properties":{"prompt_tokens":{"type":"integer","minimum":0},"completion_tokens":{"type":"integer","minimum":0},"total_tokens":{"type":"integer","minimum":0,"description":"Authoritative total tokens; never less than prompt_tokens plus completion_tokens."},"prompt_tokens_details":{"type":"object","additionalProperties":false,"required":["cached_tokens"],"properties":{"cached_tokens":{"type":"integer","minimum":0,"description":"Prompt tokens served from a provider cache and included in prompt_tokens."}}},"completion_tokens_details":{"type":"object","additionalProperties":false,"required":["reasoning_tokens"],"properties":{"reasoning_tokens":{"type":"integer","minimum":0,"description":"Completion tokens the model spent reasoning, as the provider reported them; included in completion_tokens. Absent when the provider did not report it."}}}}},"CustomerCharge":{"oneOf":[{"type":"object","additionalProperties":false,"required":["status","currency","amount_usd","price_version"],"properties":{"status":{"const":"not_configured"},"currency":{"type":"null"},"amount_usd":{"type":"null"},"price_version":{"type":"null"}}},{"type":"object","additionalProperties":false,"required":["status","currency","amount_usd","price_version"],"properties":{"status":{"type":"string","enum":["reserved","released"]},"currency":{"const":"usd"},"amount_usd":{"type":"null"},"price_version":{"type":"string","minLength":1}}},{"type":"object","additionalProperties":false,"required":["status","currency","amount_usd","price_version"],"properties":{"status":{"type":"string","enum":["pending","charged"]},"currency":{"const":"usd"},"amount_usd":{"type":"number","minimum":0},"price_version":{"type":"string","minLength":1}}}],"description":"Versioned customer charge state. A request is charged its provider cost on its rate card and never more than the reserved maximum. A request that failed or was cancelled before provider effect is released without a charge; an interrupted request is charged only the usage observed before the interruption."},"CustomerBilling":{"oneOf":[{"type":"object","additionalProperties":false,"required":["status"],"properties":{"status":{"const":"not_configured"}}},{"type":"object","additionalProperties":false,"required":["status"],"properties":{"status":{"const":"unavailable"}},"description":"The balance ledger is configured but could not be read for this response: balances are unknown, not zero."},{"type":"object","additionalProperties":false,"required":["status","currency","access_state","cash_balance_usd","promotional_balance_usd","reserved_usd","available_balance_usd","spend_this_month_usd","monthly_spending_limit_usd","remaining_monthly_spend_usd","auto_reload"],"properties":{"status":{"const":"configured"},"currency":{"const":"usd"},"access_state":{"type":"string","enum":["active","frozen"]},"cash_balance_usd":{"type":"number","description":"Negative when a request cost more than its reservation; new requests are refused until balance is added."},"promotional_balance_usd":{"type":"number","minimum":0},"reserved_usd":{"type":"number","minimum":0},"available_balance_usd":{"type":"number"},"spend_this_month_usd":{"type":"number","minimum":0},"monthly_spending_limit_usd":{"type":["number","null"],"minimum":0},"remaining_monthly_spend_usd":{"type":["number","null"],"minimum":0},"auto_reload":{"type":"object","additionalProperties":false,"required":["enabled","threshold_usd","amount_usd"],"properties":{"enabled":{"type":"boolean"},"threshold_usd":{"type":"number","minimum":0},"amount_usd":{"type":"number","minimum":0}}}}}],"description":"The prepaid AI Gateway balance. It is financially isolated from Varity Cloud billing and promotional value."},"CustomerPrice":{"oneOf":[{"type":"object","additionalProperties":false,"required":["status"],"properties":{"status":{"const":"not_configured"}}},{"type":"object","additionalProperties":false,"required":["status","version","observed_at","currency","unit","input","output","cached_input"],"properties":{"status":{"const":"configured"},"version":{"type":"string","minLength":1},"observed_at":{"type":"string","format":"date-time"},"currency":{"const":"usd"},"unit":{"type":"string","enum":["per_million_tokens","per_image","per_million_characters","per_audio_second"],"description":"per_million_tokens carries token rates; per_image a flat per-image request; per_million_characters (speech) and per_audio_second (transcription) carry their rate in input with output and cached_input at 0."},"input":{"type":"number","minimum":0},"output":{"type":"number","minimum":0},"cached_input":{"type":"number","minimum":0},"request":{"type":"number","minimum":0}}}],"description":"Current managed customer rates for the preferred qualified route, observed at the stated time and identified by an immutable price version. The rates are the API-key card (provider cost x 1.05, cache-read discount included). Top-ups carry no funding fee."},"InferenceRequest":{"type":"object","additionalProperties":false,"required":["request_id","model","state","usage","streamed","ttft_ms","duration_ms","output_throughput_tokens_per_second","fallback_count","error_code","upstream_effect_possible","created_at","completed_at","key_id","principal_type","project_id","application_id","deployment_id","environment","attachment_id","end_user","privacy_floor","privacy_class","customer_charge"],"properties":{"request_id":{"type":"string","format":"uuid","description":"Server-generated support and correlation identity."},"model":{"type":"string"},"state":{"type":"string","enum":["reserved","started","succeeded","failed","unreconciled"]},"usage":{"anyOf":[{"$ref":"#/components/schemas/Usage"},{"type":"null"}]},"streamed":{"type":["boolean","null"],"description":"Null only for historical rows created before streaming attribution."},"ttft_ms":{"type":["integer","null"],"minimum":0,"description":"Real time to first emitted content/tool token for streams; null for non-streaming or unobserved output."},"duration_ms":{"type":["integer","null"],"minimum":0,"description":"Total Varity managed-inference duration across any safe fallback."},"output_throughput_tokens_per_second":{"type":["number","null"],"minimum":0,"description":"Streamed completion tokens per second after the first output token; null when TTFT is unavailable."},"fallback_count":{"type":"integer","minimum":0},"error_code":{"type":["string","null"]},"upstream_effect_possible":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"key_id":{"type":["string","null"]},"principal_type":{"type":["string","null"],"enum":["human","workload",null]},"project_id":{"type":["string","null"]},"application_id":{"type":["string","null"]},"deployment_id":{"type":["string","null"]},"environment":{"type":["string","null"]},"attachment_id":{"type":["string","null"]},"end_user":{"type":["string","null"],"description":"The end user this request was made for, as sent; null when none was sent. A `user` value outside 1-64 printable characters is shown as its digest."},"privacy_floor":{"type":"string","enum":["private","anonymized","tee","legacy_unknown"],"description":"The privacy floor the request required. legacy_unknown only for requests recorded before floors were enforced."},"privacy_class":{"type":["string","null"],"enum":["private","anonymized","tee",null],"description":"The privacy class of the route that served the request. Null when the request was never dispatched to a route, or was recorded before this field existed."},"customer_charge":{"oneOf":[{"$ref":"#/components/schemas/CustomerCharge"},{"type":"null"}],"description":"Null for a request made from the Varity Chat or Build product (a signed-in Portal session), which is billed from the prepaid balance and not itemized here."}}},"InferenceUsage":{"type":"object","additionalProperties":false,"required":["object","period_started_at","period_ends_at","requests","tokens","breakdowns","spend_usd","customer_billing"],"properties":{"object":{"const":"inference.usage"},"period_started_at":{"type":"string","format":"date-time"},"period_ends_at":{"type":"string","format":"date-time"},"requests":{"type":"object","additionalProperties":false,"required":["total","active","succeeded","failed","unreconciled"],"properties":{"total":{"type":"integer","minimum":0},"active":{"type":"integer","minimum":0},"succeeded":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"unreconciled":{"type":"integer","minimum":0}}},"tokens":{"$ref":"#/components/schemas/Usage"},"breakdowns":{"type":"array","items":{"$ref":"#/components/schemas/InferenceUsageBreakdown"}},"spend_usd":{"type":"number","minimum":0},"customer_billing":{"$ref":"#/components/schemas/CustomerBilling"}}},"InferenceUsageBreakdown":{"type":"object","additionalProperties":false,"required":["dimension","value","requests","tokens","spend_usd"],"properties":{"dimension":{"type":"string","enum":["model","project","application","environment","key"]},"value":{"type":["string","null"]},"requests":{"type":"object","additionalProperties":false,"required":["total","active","succeeded","failed","unreconciled"],"properties":{"total":{"type":"integer","minimum":0},"active":{"type":"integer","minimum":0},"succeeded":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"unreconciled":{"type":"integer","minimum":0}}},"tokens":{"$ref":"#/components/schemas/Usage"},"spend_usd":{"type":"number","minimum":0}}},"PercentileMetric":{"type":"object","additionalProperties":false,"description":"Percentiles are available only at 20 or more samples; insufficient_samples covers 1–19 samples and empty covers zero.","required":["status","sample_count","p50","p95","p99"],"properties":{"status":{"type":"string","enum":["available","insufficient_samples","empty"]},"sample_count":{"type":"integer","minimum":0},"p50":{"type":["number","null"],"minimum":0},"p95":{"type":["number","null"],"minimum":0},"p99":{"type":["number","null"],"minimum":0}}},"InferencePerformance":{"type":"object","additionalProperties":false,"required":["object","window_started_at","window_ends_at","calculated_at","latest_sample_at","freshness","requests","success_rate","fallback_rate","normalized_error_rate","tokens","ttft_ms","duration_ms","output_throughput_tokens_per_second","customer_billing"],"properties":{"object":{"const":"inference.performance"},"window_started_at":{"type":"string","format":"date-time"},"window_ends_at":{"type":"string","format":"date-time"},"calculated_at":{"type":"string","format":"date-time"},"latest_sample_at":{"type":["string","null"],"format":"date-time"},"freshness":{"type":"object","additionalProperties":false,"required":["status","stale_after_seconds"],"properties":{"status":{"type":"string","enum":["fresh","stale","empty"]},"stale_after_seconds":{"type":"integer","minimum":1}}},"requests":{"type":"object","additionalProperties":false,"required":["total","active","succeeded","failed","unreconciled"],"properties":{"total":{"type":"integer","minimum":0},"active":{"type":"integer","minimum":0},"succeeded":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"unreconciled":{"type":"integer","minimum":0}}},"success_rate":{"type":["number","null"],"minimum":0,"maximum":1},"fallback_rate":{"type":["number","null"],"minimum":0,"maximum":1},"normalized_error_rate":{"type":["number","null"],"minimum":0,"maximum":1},"tokens":{"$ref":"#/components/schemas/Usage"},"ttft_ms":{"$ref":"#/components/schemas/PercentileMetric"},"duration_ms":{"$ref":"#/components/schemas/PercentileMetric"},"output_throughput_tokens_per_second":{"$ref":"#/components/schemas/PercentileMetric"},"customer_billing":{"$ref":"#/components/schemas/CustomerBilling"}}},"ToolCall":{"type":"object","additionalProperties":false,"required":["id","type","function"],"properties":{"id":{"type":"string","minLength":1},"type":{"const":"function"},"function":{"type":"object","additionalProperties":false,"required":["name","arguments"],"properties":{"name":{"type":"string","minLength":1},"arguments":{"type":"string","description":"Untrusted JSON text supplied by the model."}}}}},"CacheControl":{"type":"object","additionalProperties":false,"required":["type"],"description":"Provider-native prompt-caching marker. Forwarded unchanged to a route that supports prompt caching and dropped for one that does not; cached prompt tokens bill at customer_pricing.cached_input.","properties":{"type":{"const":"ephemeral"},"ttl":{"type":"string","minLength":1}}},"ContentPart":{"description":"One part of a multimodal user message. Images and documents are transient request input: Varity never stores their bytes, in any database, object store, cache, or log.","oneOf":[{"type":"object","additionalProperties":false,"required":["type","text"],"properties":{"type":{"const":"text"},"text":{"type":"string"},"cache_control":{"$ref":"#/components/schemas/CacheControl"}}},{"type":"object","additionalProperties":false,"required":["type","image_url"],"properties":{"type":{"const":"image_url"},"image_url":{"type":"object","additionalProperties":false,"required":["url"],"properties":{"url":{"type":"string","minLength":1,"description":"An http(s) URL the provider can fetch, or a data:image/<mime>;base64,... URL."},"detail":{"type":"string","description":"OpenAI vision hint; accepted and ignored."}}},"cache_control":{"$ref":"#/components/schemas/CacheControl"}}},{"type":"object","additionalProperties":false,"required":["type","document"],"description":"A document the model reads. Routed only to models whose capabilities.input_modalities include `document`. The provider extracts it to text before the model sees it, and that text is billed as prompt tokens at the route's provider cost. Accepted: PDF, EPUB, DOCX, PPTX, XLSX, XLS, plain text, Markdown, CSV, JSON and common source-code files. A data URL is limited to about 768 KB decoded (the 2 MB request body limit, base64-encoded); a public URL is fetched by the provider, up to 25 MB. One message may carry at most capabilities.max_documents_per_message document parts when the model publishes that bound; a message above it is refused with 400 `too_many_documents` before any supplier call, so put the rest in a later message.","properties":{"type":{"const":"document"},"document":{"type":"object","additionalProperties":false,"required":["url"],"properties":{"url":{"type":"string","minLength":1,"description":"A public http(s) URL whose path ends in an accepted extension, or a data:<mime>;base64,... URL."},"filename":{"type":"string","description":"Helps the model refer to the file; required to name the format of an application/octet-stream data URL."}}},"cache_control":{"$ref":"#/components/schemas/CacheControl","description":"Accepted and not forwarded: the provider file part carries no cache marker."}}}]},"Message":{"type":"object","additionalProperties":false,"required":["role"],"properties":{"role":{"type":"string","enum":["system","developer","user","assistant","tool"],"description":"developer is treated as system."},"cache_control":{"$ref":"#/components/schemas/CacheControl","description":"Accepted for client compatibility and normalized away; only a content part marker is forwarded."},"content":{"description":"Plain text, or — for a user message — a typed parts array carrying images or documents. Required, except on an assistant message that carries tool_calls, where omitting it is the same as null (OpenAI).","oneOf":[{"type":"string"},{"type":"null"},{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/ContentPart"}}]},"name":{"type":"string","minLength":1},"tool_call_id":{"type":"string","minLength":1},"tool_calls":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/ToolCall"}},"reasoning_content":{"type":"string","description":"Assistant output only: the model's reasoning text, present when the supplier returned it (streamed as delta.reasoning_content). Relayed, never stored. Accepted and dropped when a client replays the assistant message."}}},"Tool":{"type":"object","additionalProperties":false,"description":"A client-managed function definition. Varity transports eligible tool calls but does not execute or orchestrate the tool.","required":["type","function"],"properties":{"type":{"const":"function"},"function":{"type":"object","additionalProperties":false,"required":["name","parameters"],"properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"parameters":{"type":"object"},"strict":{"type":"boolean"}}}}},"ChatCompletionRequest":{"type":"object","additionalProperties":false,"required":["model","messages"],"properties":{"model":{"type":"string","minLength":1,"description":"A model id from /v1/models, or `auto`: Varity tries its Auto models in order (each within your privacy floor, certified and healthy) and moves to the next only when one failed before any output. The response `model` names the model that served, and the charge is that model's."},"messages":{"type":"array","minItems":1,"maxItems":512,"items":{"$ref":"#/components/schemas/Message"}},"max_completion_tokens":{"type":"integer","minimum":1,"maximum":1000000,"default":2048,"description":"Upper bound on generated tokens. Varity reserves against this bound before dispatch and forwards it as the upstream hard cap, so a response may stop with finish_reason \"length\" — including when the provider reported another reason for an answer that used the whole bound. Defaults to 2048 when neither this nor max_tokens is sent."},"max_tokens":{"type":"integer","minimum":1,"maximum":1000000,"description":"Accepted as an alias of max_completion_tokens for OpenAI compatibility. Sending both with different values is rejected."},"stream":{"type":"boolean","default":false},"temperature":{"type":"number","minimum":0,"maximum":2},"top_p":{"type":"number","minimum":0,"maximum":1},"stop":{"oneOf":[{"type":"string"},{"type":"array","minItems":1,"maxItems":4,"items":{"type":"string"}}]},"seed":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"response_format":{"description":"Structured output. json_schema is honoured on models whose capabilities.structured_outputs is supported; text is the default.","oneOf":[{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["text"]}}},{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["json_object"]}}},{"type":"object","additionalProperties":false,"required":["type","json_schema"],"properties":{"type":{"type":"string","enum":["json_schema"]},"json_schema":{"type":"object"}}}]},"user":{"description":"OpenAI's end-user field. Any string is accepted; it identifies the end user when neither X-Varity-End-User nor safety_identifier is sent (a value outside 1-64 printable characters is replaced by its digest). Never forwarded to a supplier. null is the same as absent.","type":["string","null"]},"safety_identifier":{"description":"OpenAI's stable end-user identifier: 1-64 printable characters, else 400. Identifies the end user unless X-Varity-End-User is sent. Never forwarded to a supplier. null is the same as absent.","type":["string","null"],"maxLength":64},"prompt_cache_key":{"description":"Groups requests that share a prompt prefix so a supplier that routes on it can reuse its cache (see customer_pricing.cached_input). Varity replaces it with a key scoped to your account before forwarding, and forwards it only to routes that support prompt caching. null is the same as absent.","type":["string","null"],"minLength":1,"maxLength":256},"n":{"description":"Only 1 is supported; any other value is rejected.","type":"integer","enum":[1]},"frequency_penalty":{"description":"Only 0 is accepted; any other value is rejected.","type":"number","enum":[0]},"presence_penalty":{"description":"Only 0 is accepted; any other value is rejected.","type":"number","enum":[0]},"logprobs":{"description":"Only false is accepted; log probabilities are not returned.","type":"boolean","enum":[false]},"logit_bias":{"description":"Only an empty object or null is accepted; token biasing is not supported.","type":["object","null"],"maxProperties":0},"stream_options":{"description":"OpenAI streaming options. With include_usage true, the stream ends with one usage chunk whose choices array is empty, before data: [DONE]. Without it, no empty-choices chunk is sent. Billing uses the provider-reported usage either way.","type":"object","additionalProperties":false,"properties":{"include_usage":{"type":"boolean"}}},"reasoning_effort":{"description":"Portable reasoning control, honoured on models whose capabilities.reasoning_effort is supported. Which values a model accepts is per model; a value the model does not list is refused before any upstream call. Omitting it means the model default.","type":"string","enum":["none","minimal","low","medium","high","xhigh","max"]},"tools":{"type":"array","minItems":1,"maxItems":512,"items":{"$ref":"#/components/schemas/Tool"}},"tool_choice":{"oneOf":[{"type":"string","enum":["none","auto","required"]},{"type":"object","additionalProperties":false,"required":["type","function"],"properties":{"type":{"const":"function"},"function":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","minLength":1}}}}}]},"parallel_tool_calls":{"type":"boolean"},"varity_extensions":{"type":"object","additionalProperties":false,"properties":{"system_prompt_mode":{"type":"string","enum":["provider_default","caller_only"]},"privacy_floor":{"type":"string","enum":["private","anonymized","tee"],"description":"Per-request privacy floor. It may only tighten the account policy."},"web_search":{"type":"boolean","description":"Ground the answer in a live web search. Honoured only by models whose published `capabilities.web_search` is true; the provider default is off."},"x_search":{"type":"boolean","description":"Ground the answer in the provider's X (Twitter) search. Same rule as `web_search`."},"web_scraping":{"type":"boolean","description":"Read the pages linked from the latest user message (up to 5 URLs) into the model context. Refused with 400 when no route of the model can read links. Billed at the provider cost of the request, which includes the provider fee per successfully read page; the provider default is off."}}}}},"ChatCompletion":{"type":"object","additionalProperties":false,"required":["id","object","created","model","choices","usage"],"properties":{"id":{"type":"string","pattern":"^chatcmpl-[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$","description":"`chatcmpl-{request_id}`: the same request id as the X-Request-Id response header, the error envelope request_id and the request log. Every chunk of a stream carries this same id. The upstream provider's id is never returned."},"object":{"const":"chat.completion"},"created":{"type":"integer","description":"Unix seconds when Varity received the request; one value for the body and every chunk of a stream."},"model":{"type":"string"},"choices":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["index","message","finish_reason"],"properties":{"index":{"type":"integer","minimum":0},"message":{"$ref":"#/components/schemas/Message"},"finish_reason":{"type":["string","null"],"enum":["stop","length","tool_calls","content_filter",null]}}}},"usage":{"$ref":"#/components/schemas/Usage"},"citations":{"type":"array","minItems":1,"description":"The sources a `varity_extensions.web_search` answer drew on, exactly as the provider reported them. Optional: present only when the provider reported at least one source, so a client must treat absence as \"none reported\". Carried on non-streaming responses; a streamed response does not carry it.","items":{"type":"object","additionalProperties":false,"required":["url","title"],"properties":{"url":{"type":"string","minLength":1},"title":{"type":"string"},"content":{"type":"string","description":"Excerpt of the source the provider used, when reported."},"date":{"type":"string","description":"Source date as the provider reported it, when reported; not normalized."}}}}}},"CapabilityEvidence":{"type":"object","additionalProperties":false,"required":["state","source","observed_at"],"description":"Tri-state justification for one capability boolean. A boolean cannot say WHY it is false: `unsupported` is proven by a provider catalog or a failed route certification, while `unknown` is merely not measured. Only a proven `unsupported` withholds a capability; an `unknown` must never be rendered as unsupported.","properties":{"state":{"type":"string","enum":["supported","unsupported","unknown"]},"source":{"type":"string","enum":["provider_catalog","route_verification","unobserved"],"description":"Where the state was read. `unobserved` is the honest default when nothing has read it; it is never inferred from the boolean."},"observed_at":{"type":"string","format":"date-time","description":"When this state was last evaluated."},"reason":{"type":"string","description":"Present only on `unsupported`/`unknown`, naming what withheld or blocked the capability. Free text so a producer can add a reason without a schema change."}}},"CapabilityEvidenceMap":{"type":"object","additionalProperties":false,"description":"ADDITIVE and optional capability evidence. A producer that predates the map omits it entirely, so absence means \"no evidence published\", never `supported`. A capability name this gateway does not publish is dropped rather than rejected, so the map carries exactly these six keys.","properties":{"chat_completions":{"$ref":"#/components/schemas/CapabilityEvidence"},"streaming_text":{"$ref":"#/components/schemas/CapabilityEvidence"},"tool_calls":{"$ref":"#/components/schemas/CapabilityEvidence"},"streaming_tool_calls":{"$ref":"#/components/schemas/CapabilityEvidence"},"structured_outputs":{"$ref":"#/components/schemas/CapabilityEvidence"},"json_schema":{"$ref":"#/components/schemas/CapabilityEvidence"}}},"Availability":{"type":"object","additionalProperties":false,"required":["status","observed_at"],"properties":{"status":{"type":"string","enum":["available","last_known_available","temporarily_unavailable","unverified","verification_stale"]},"observed_at":{"type":"string","format":"date-time"},"reason":{"type":"string","enum":["route_temporarily_unavailable","route_unverified","route_verification_stale"]}}},"Model":{"type":"object","additionalProperties":false,"required":["id","display_name","object","created","owned_by","maker","capabilities","context_window","max_completion_tokens","privacy","privacy_routes","availability","refreshed_at","customer_pricing"],"properties":{"id":{"type":"string","description":"Provider-neutral Varity model id. The seven curated ids are stable identities. Other opaque model-* ids may change until an alias, replacement, and deprecation registry is published."},"display_name":{"type":"string"},"object":{"const":"model"},"created":{"type":"integer"},"owned_by":{"const":"varity"},"maker":{"type":"object","additionalProperties":false,"required":["key","label"],"properties":{"key":{"type":"string","minLength":1,"description":"Stable slug of who built the model, as the supplier reports it; `unreported` when no evidence was observed."},"label":{"type":"string","minLength":1}},"description":"Who built the model, never who serves it (owned_by is always varity). A supplier brand is never a maker."},"capabilities":{"type":"object","additionalProperties":false,"description":"Production-verified Gateway Core capabilities for the current route contract, in the versioned projection the AI Gateway publishes. Tool calls mean generation and transport only; execution is client-managed. The binding fields (context_window, privacy, availability) are duplicated from the model top level so both public catalogs publish one shape; customer_pricing is published once, at the model top level. An EVIDENCED capability boolean (chat_completions, streaming/streaming_text, tool_calls, streaming_tool_calls, structured_outputs, json_schema) is present only for a proven state; an `unknown` omits it, and its `evidence` entry is the authority.","required":["version","input_modalities","output_modalities","transcription","speech","speech_formats","parallel_tool_calls","reasoning_controls","reasoning_effort","web_search","x_search","optimized_for_code","uncensored","log_probs","temperature","top_p","seed","stop","context_window","max_completion_tokens","privacy","privacy_routes","availability","refreshed_at"],"properties":{"version":{"const":1,"description":"Capability shape version; bumped only on a breaking change."},"input_modalities":{"type":"array","uniqueItems":true,"items":{"type":"string","enum":["text","image","document","audio","video"]},"description":"Request input modalities every routable candidate accepts."},"output_modalities":{"type":"array","uniqueItems":true,"items":{"type":"string","enum":["text","image","audio","embedding"]},"description":"Response modalities this model can produce."},"chat_completions":{"type":"boolean","description":"Present only when proven. Absent means the state is `unknown`, never unsupported."},"transcription":{"type":"boolean","description":"True when POST /v1/audio/transcriptions accepts this model. An audio model has chat_completions false."},"speech":{"type":"boolean","description":"True when POST /v1/audio/speech accepts this model."},"speech_formats":{"type":"array","uniqueItems":true,"items":{"type":"string","enum":["mp3","opus","aac","flac","wav","pcm"]},"description":"Output audio formats this speech model can produce. Empty unless speech is true."},"streaming":{"type":"boolean","description":"Legacy alias of streaming_text, served so clients written against the pre-versioned four-boolean shape keep working. Always equal to streaming_text and present exactly when it is."},"streaming_text":{"type":"boolean","description":"Present only when proven. Absent means the state is `unknown`, never unsupported."},"tool_calls":{"type":"boolean","description":"Present only when proven. Absent means the state is `unknown`, never unsupported."},"streaming_tool_calls":{"type":"boolean","description":"Present only when proven. Absent means the state is `unknown`, never unsupported."},"parallel_tool_calls":{"type":"boolean"},"max_tools":{"type":"integer","minimum":1,"description":"The most tools one chat request may carry: the smallest bound known for any route of the model. A request above it is refused with 400 `too_many_tools` before any supplier call. Absent means no bound is known (none published, none measured), never unlimited."},"max_documents_per_message":{"type":"integer","minimum":1,"description":"The most `document` parts one message may carry: the smallest bound known for any route of the model. Counted per message, not per request, and images are not counted. A message above it is refused with 400 `too_many_documents` before any supplier call. Absent means no bound is known (none published, none measured), never unlimited."},"structured_outputs":{"type":"boolean","description":"Present only when proven. Absent means the state is `unknown`, never unsupported."},"json_schema":{"type":"boolean","description":"Present only when proven. Absent means the state is `unknown`, never unsupported."},"reasoning_controls":{"type":"boolean"},"reasoning_effort":{"type":"boolean"},"web_search":{"type":"boolean"},"x_search":{"type":"boolean"},"optimized_for_code":{"type":"boolean"},"uncensored":{"type":"boolean","description":"True when at least one published route of this model is classified uncensored by its supplier (for example Venice `model_spec.uncensored`). A client that must avoid such models filters on this field; it is never inferred from a model name."},"log_probs":{"type":"boolean"},"temperature":{"type":"boolean"},"top_p":{"type":"boolean"},"seed":{"type":"boolean"},"stop":{"type":"boolean"},"context_window":{"type":"integer","minimum":0},"max_completion_tokens":{"type":"integer","minimum":0},"privacy":{"type":"string","enum":["private","anonymized","tee"],"description":"Strongest currently available route class, duplicated from the model top level."},"privacy_routes":{"type":"array","uniqueItems":true,"items":{"type":"string","enum":["private","anonymized","tee"]},"description":"Provider-hidden route-level privacy classes, duplicated from the model top level."},"availability":{"$ref":"#/components/schemas/Availability"},"refreshed_at":{"type":"string","format":"date-time"},"evidence":{"$ref":"#/components/schemas/CapabilityEvidenceMap"}}},"context_window":{"type":"integer","minimum":0},"max_completion_tokens":{"type":"integer","minimum":0},"privacy":{"type":"string","enum":["private","anonymized","tee"],"description":"Strongest currently available route class. TEE means this route has current Varity-verified hardware attestation and is served in TEE mode; attestation and signature scopes are stated in confidential.verification. Private means the provider contract supports the required retention and training posture; it is not confidential compute. Anonymized means Varity withholds direct Varity identity and raw key data, while the provider still processes the content under its disclosed handling terms."},"privacy_routes":{"type":"array","uniqueItems":true,"items":{"type":"string","enum":["private","anonymized","tee"]},"description":"Routing tries every route whose privacy class satisfies the effective floor, strongest class first. A weaker class the floor allows serves only when a stronger route is out of capacity, held or failing; a `private` floor is never served by an `anonymized` route, and a `tee` floor only uses currently hardware-attested TEE routes. `privacy_routes` lists every class that can serve under the caller's floor; `customer_pricing` is the strongest class's price, and a fallback route that would cost more than it is not used."},"deprecation":{"type":"object","additionalProperties":false,"required":["removes_at"],"description":"Present only while the model is retiring. It stays callable, at its published price and privacy, until `removes_at`, and is withheld (404 `model_not_found`) after it. `replacement` is the suggested successor model id, present only when that model is published; requests are never remapped to it, so its price and privacy may differ.","properties":{"removes_at":{"type":"string","format":"date-time","description":"When the supplier stops serving this model."},"replacement":{"type":"string","description":"Published id of the suggested successor model."}}},"confidential":{"type":"object","additionalProperties":false,"required":["modes","attestation_scope","attested_at","verification"],"description":"Present only on a confidential model (its own id, suffixed `-confidential`; it never shares routes with the standard model). `tee`: the prompt is sent in plaintext over this API to a hardware enclave (Intel TDX with NVIDIA confidential computing). Varity requests its attestation with a fresh nonce and itself verifies the Intel TDX quote (Intel DCAP) and the NVIDIA GPU attestation (NRAS tokens checked against NVIDIA keys); see `verification`. It is not end-to-end encryption; answers without the provider TEE confirmation fail 502 `confidential_attestation_unbound`. Web search, X search, link reading and the provider system prompt are refused (400 `confidential_feature_unsupported`). When the attestation is not fresh the model answers 503 `confidential_attestation_unavailable` and is never served by another route.","properties":{"modes":{"type":"array","uniqueItems":true,"items":{"type":"string","enum":["tee"]}},"attestation_scope":{"type":"string","enum":["gpu"],"description":"The attested machine carried NVIDIA GPU evidence (not an aggregator gateway)."},"attested_at":{"type":"string","format":"date-time","description":"When this replica last passed the attestation check."},"verification":{"type":"object","additionalProperties":false,"required":["quote","gpu","response_signature","request_binding"],"description":"What Varity itself checked. Only these claims may be made about the model.","properties":{"quote":{"type":"string","enum":["varity_verified","varity_verified_tcb_advisory"],"description":"`varity_verified`: Varity verified the Intel TDX quote with Intel DCAP (signature and certificate chain to Intel's root, TCB `UpToDate`, debug off) and that it binds the signing key and Varity's fresh nonce. `varity_verified_tcb_advisory`: the same, with an Intel TCB advisory (`SWHardeningNeeded` or `ConfigurationNeeded`)."},"gpu":{"type":"string","enum":["varity_verified"],"description":"Varity verified every NVIDIA attestation token (NRAS) against NVIDIA's keys: it carries Varity's nonce, and every GPU reports matched measurements, secure boot and debug disabled."},"response_signature":{"type":"string","enum":["varity_verified_signer_sampled"],"description":"After an answer is delivered, for a sample bounded by the provider's rate limit, Varity checks that a signature the provider marks as made by the model's TEE recovers to the attested signing key. A signature made by the provider's gateway is recorded but does not show that an enclave signed the answer. Neither proves the content: the signed request and response hashes are provider-reported and are not recomputed by Varity. It never delays or changes the answer."},"request_binding":{"type":"string","enum":["provider_header"],"description":"Each answer must also carry the provider's TEE confirmation header before it is returned."}}}}},"availability":{"$ref":"#/components/schemas/Availability"},"refreshed_at":{"type":"string","format":"date-time"},"customer_pricing":{"$ref":"#/components/schemas/CustomerPrice"}}},"AudioTranscriptionRequest":{"type":"object","additionalProperties":false,"required":["model","audio"],"properties":{"model":{"type":"string"},"audio":{"type":"object","additionalProperties":false,"required":["data","media_type"],"properties":{"data":{"type":"string","format":"byte","description":"Base64 audio bytes. The decoded size is capped at 25 MB."},"media_type":{"type":"string","enum":["audio/wav","audio/wave","audio/x-wav","audio/flac","audio/x-flac","audio/mp4","audio/m4a","audio/x-m4a","audio/aac","audio/mpeg","audio/ogg","audio/oga","audio/webm"]},"filename":{"type":"string","maxLength":256}}},"response_format":{"type":"string","enum":["json","text"],"default":"json"},"language":{"type":"string","maxLength":8,"description":"ISO 639-1 language hint; omitted lets the model auto-detect."},"timestamps":{"type":"boolean","default":false}}},"AudioTranscription":{"type":"object","additionalProperties":false,"required":["object","model","text"],"properties":{"object":{"const":"audio.transcription"},"model":{"type":"string"},"text":{"type":"string"},"duration_seconds":{"type":"number","description":"Seconds of input audio as reported by the provider; the per-audio-second billing basis."}}},"AudioSpeechRequest":{"type":"object","additionalProperties":false,"required":["model","input"],"properties":{"model":{"type":"string"},"input":{"type":"string","minLength":1,"maxLength":4096},"voice":{"type":"string","maxLength":512},"response_format":{"type":"string","enum":["mp3","opus","aac","flac","wav","pcm"]},"speed":{"type":"number","minimum":0.25,"maximum":4,"default":1},"language":{"type":"string","minLength":2,"maxLength":32},"prompt":{"type":"string","maxLength":500},"stream":{"type":"boolean","default":false,"description":"When true the response is chunked binary audio rather than one complete file. Not SSE."}}},"WebSearchRequest":{"type":"object","additionalProperties":false,"required":["query"],"properties":{"query":{"type":"string","minLength":1,"maxLength":500,"description":"The question to ground in a live web search."},"count":{"type":"integer","minimum":1,"maximum":10,"default":5,"description":"Maximum number of provider citations to return. It is a ceiling, never a quota: Varity never invents a source to reach it."}}},"WebSearchResult":{"type":"object","additionalProperties":false,"required":["title","url","snippet","date"],"properties":{"title":{"type":"string"},"url":{"type":"string"},"snippet":{"type":["string","null"],"description":"The provider-reported excerpt, or null when it reported none."},"date":{"type":["string","null"],"description":"The provider-reported source date, not normalized; null when absent."}}},"WebSearchResponse":{"type":"object","additionalProperties":false,"required":["object","query","results","model"],"properties":{"object":{"const":"web_search"},"query":{"type":"string"},"results":{"type":"array","description":"Exactly the sources the provider reported. Empty when it reported no citations; that is a successful grounded answer with no sources, not an error.","items":{"$ref":"#/components/schemas/WebSearchResult"}},"model":{"type":"string","description":"The routed model that performed the search and answer."}}},"WebFetchRequest":{"type":"object","additionalProperties":false,"required":["url"],"properties":{"url":{"type":"string","format":"uri","description":"An absolute http(s) URL. Embedded credentials, non-http(s) schemes, and any host resolving to loopback, private, link-local, CGNAT, multicast, unspecified or IPv6 ULA addresses are refused."}}},"WebFetchResponse":{"type":"object","additionalProperties":false,"required":["object","url","title","text","truncated","images"],"properties":{"object":{"const":"web_fetch"},"url":{"type":"string","description":"The final URL after at most three redirects."},"title":{"type":["string","null"],"description":"The page title when it declares one; otherwise null."},"text":{"type":"string","maxLength":200000,"description":"Readable text with scripts, styles, comments, tags and entities removed, whitespace collapsed, and HTML/plain text/Markdown/JSON accepted."},"truncated":{"type":"boolean","description":"True when the readable text exceeded the published character cap and was cut."},"images":{"type":"array","maxItems":5,"items":{"type":"string","format":"uri"},"description":"Absolute http(s) image and icon references found in the page, in document order, de-duplicated, at most five, each no longer than 2048 characters."}}},"AnthropicTextBlock":{"type":"object","additionalProperties":false,"required":["type","text"],"properties":{"type":{"const":"text"},"text":{"type":"string"}}},"AnthropicToolUseBlock":{"type":"object","additionalProperties":false,"required":["type","id","name","input"],"properties":{"type":{"const":"tool_use"},"id":{"type":"string"},"name":{"type":"string"},"input":{"type":"object","description":"The tool input as a JSON object, exactly as the model produced it."}}},"AnthropicMessage":{"type":"object","additionalProperties":false,"required":["id","type","role","model","content","stop_reason","stop_sequence","usage"],"properties":{"id":{"type":"string","description":"`msg_` followed by the gateway request id."},"type":{"const":"message"},"role":{"const":"assistant"},"model":{"type":"string"},"content":{"type":"array","minItems":1,"items":{"oneOf":[{"$ref":"#/components/schemas/AnthropicTextBlock"},{"$ref":"#/components/schemas/AnthropicToolUseBlock"}]}},"stop_reason":{"type":"string","enum":["end_turn","tool_use","max_tokens","refusal"]},"stop_sequence":{"type":"null"},"usage":{"type":"object","additionalProperties":false,"required":["input_tokens","output_tokens"],"properties":{"input_tokens":{"type":"integer","minimum":0},"output_tokens":{"type":"integer","minimum":0}}}}},"AnthropicImageBlock":{"type":"object","additionalProperties":false,"required":["type","source"],"properties":{"type":{"const":"image"},"source":{"oneOf":[{"type":"object","additionalProperties":false,"required":["type","media_type","data"],"properties":{"type":{"const":"base64"},"media_type":{"type":"string"},"data":{"type":"string","description":"Base64 image bytes; translated to the existing image content part."}}},{"type":"object","additionalProperties":false,"required":["type","url"],"properties":{"type":{"const":"url"},"url":{"type":"string"}}}]}}},"AnthropicToolResultBlock":{"type":"object","additionalProperties":false,"required":["type","tool_use_id"],"properties":{"type":{"const":"tool_result"},"tool_use_id":{"type":"string"},"content":{"oneOf":[{"type":"string"},{"type":"array","items":{"$ref":"#/components/schemas/AnthropicTextBlock"}}],"description":"Text only: a chat tool message has no image content part, so an image block is refused with a specific invalid_request_error rather than dropped."},"is_error":{"type":"boolean","description":"Carried into the chat tool message text as an \"Error: \" prefix; a chat tool message has no error flag."}}},"AnthropicThinkingBlock":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["thinking","redacted_thinking"]}},"description":"Accepted on an assistant replay and dropped: no routed chat input carries provider reasoning back to a model."},"AnthropicRequestContentBlock":{"oneOf":[{"$ref":"#/components/schemas/AnthropicTextBlock"},{"$ref":"#/components/schemas/AnthropicImageBlock"},{"$ref":"#/components/schemas/AnthropicToolResultBlock"},{"type":"object","additionalProperties":false,"required":["type","id","name","input"],"properties":{"type":{"const":"tool_use"},"id":{"type":"string"},"name":{"type":"string"},"input":{"type":"object"}},"description":"An assistant tool call replayed by the client; becomes an OpenAI assistant tool_calls entry."},{"$ref":"#/components/schemas/AnthropicThinkingBlock"}],"description":"A user turn accepts text, image and tool_result; an assistant turn accepts text, tool_use and thinking. The server rejects a block on the wrong role."},"AnthropicMessagesRequest":{"type":"object","additionalProperties":false,"required":["model","max_tokens","messages"],"properties":{"model":{"type":"string"},"max_tokens":{"type":"integer","minimum":1,"maximum":1000000,"description":"Maps onto the chat contract max_completion_tokens and the same balance hold."},"system":{"oneOf":[{"type":"string"},{"type":"array","items":{"$ref":"#/components/schemas/AnthropicTextBlock"}}]},"messages":{"type":"array","minItems":1,"items":{"oneOf":[{"type":"object","additionalProperties":false,"required":["role","content"],"properties":{"role":{"const":"system"},"content":{"oneOf":[{"type":"string"},{"type":"array","items":{"$ref":"#/components/schemas/AnthropicTextBlock"}}],"description":"A mid-conversation system turn is text only."}}},{"type":"object","additionalProperties":false,"required":["role","content"],"properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"oneOf":[{"type":"string"},{"type":"array","items":{"$ref":"#/components/schemas/AnthropicRequestContentBlock"}}]}}}]}},"stream":{"type":"boolean","default":false,"description":"When true the answer is Anthropic SSE events; message_start, content_block_* and message_delta precede message_stop. A non-boolean is refused 400."},"temperature":{"type":"number","minimum":0,"maximum":2},"top_p":{"type":"number","minimum":0,"maximum":1},"top_k":{"type":"integer","description":"Accepted for Anthropic client compatibility; ignored."},"thinking":{"type":"object","description":"Accepted for Anthropic client compatibility; ignored. Replayed thinking blocks on assistant messages are dropped."},"output_config":{"type":"object","description":"Accepted for Anthropic client compatibility; ignored."},"context_management":{"type":"object","description":"Accepted for Anthropic client compatibility; ignored."},"service_tier":{"type":"string","description":"Accepted for Anthropic client compatibility; ignored."},"tools":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["name","input_schema"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"input_schema":{"type":"object"}}}},"tool_choice":{"oneOf":[{"type":"string","enum":["auto","any","none"],"description":"Tolerated alias of the object forms."},{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["auto","any","none"]},"disable_parallel_tool_use":{"type":"boolean"}}},{"type":"object","additionalProperties":false,"required":["type","name"],"properties":{"type":{"const":"tool"},"name":{"type":"string"},"disable_parallel_tool_use":{"type":"boolean"}}}],"description":"disable_parallel_tool_use:true maps onto the chat contract parallel_tool_calls:false."},"metadata":{"type":"object","description":"Accepted for Anthropic client compatibility; opaque and never forwarded."}}},"AnthropicError":{"type":"object","additionalProperties":false,"required":["type","error"],"properties":{"type":{"const":"error"},"error":{"type":"object","additionalProperties":false,"required":["type","message"],"properties":{"type":{"type":"string","enum":["invalid_request_error","authentication_error","rate_limit_error","api_error"]},"message":{"type":"string"}}}}}}}}