Skip to content
Docs

Šis puslapis dar neišverstas, todėl rodomas angliškai.

API reference

Base URL: https://api.oryvox.ai/v1

All requests are authenticated with a bearer key:

Authorization: Bearer ory_live_...    (or ory_test_... for test mode)

Request and response bodies are JSON.

MethodPathKey scopePurpose
POST/chat/completionschatOpenAI chat completions, plus ORYVOX extensions
POST/responseschatSimplified Responses API
POST/embeddingsembeddingsOpenAI embeddings
GET/modelsmodelsRouting profiles and available models
POST/cache/invalidatecacheRemove cached answers by tag, or all
GET/requestsrequestsRequest log of the key's project
GET/requests/{request_id}requestsOne request with its trace
POST/requests/{request_id}/feedbackchatRate an answer 1-5
GET/metricsrequestsProject metrics for a period

Keys without explicit scopes may use chat, embeddings, models and cache. A missing scope answers 403 permission_denied.

Request headers

HeaderEffect
Idempotency-KeyOn /chat/completions, /responses, /embeddings: replays the stored result of an identical request (Billing).
X-Oryvox-SessionConversation id: sticky routing and provider-cache reuse across turns.
X-Oryvox-Trace-IdGroups requests into one trace (max 40 chars).
X-Oryvox-Parent-SpanParent span of this request's root span (max 24 chars).
X-Oryvox-Cache: offSkip the response cache for this request.
X-Oryvox-Cache-ScopeShare cached answers only within this scope (e.g. a tenant or user id).

Response headers

HeaderValue
X-Oryvox-Request-Idreq_... (also on streams)
X-Oryvox-ModelSelected model (non-streaming chat and responses)
X-Oryvox-ProviderProvider (sandbox in test mode, cache for cache hits)
X-Oryvox-Cacheexact, semantic or miss
X-Oryvox-Api-VersionAPI release date, e.g. 2026-10-04 (every response)
Idempotent-Replayedtrue when a stored result was replayed
Deprecation, Sunset, LinkOn deprecated endpoints (Versioning)

ORYVOX extensions

/chat/completions and /responses accept these extra body fields:

FieldTypeDescription
routingobject{"mode": "economy" | "balanced" | "quality" | "max", "min_quality": number}. See Models and routing.
max_costnumberCap for this request in USD (model cost). Models that could exceed it are not used.
optimizationobject{"mode", "preserve", "do_not_compress", "documents", "fields"}. See Token optimization.
metadataobjectHints: task, priority (realtime | batch | normal), customer_tier, step, session_id.
tagsstring[]Up to 20 labels, recorded with the request (e.g. faq, realtime, batch).
cacheobject{"mode": "bypass" | "default", "refresh": true, "tags": [...]}. See Cache.
oryvoxobjectstep, workflow_id, workflow_budget, versions (prompt, tools, knowledge, memory), cache.tags, session_id, agent. See Agents.
userstringEnd-user id; personal answers are cached per user only.

Every successful completion and response carries an oryvox object:

FieldTypeDescription
request_idstringId in the request log (req_...).
selected_modelstringThe model that answered.
providerstringThe provider that served it (cache for a cache hit, sandbox in test mode).
costnumberModel cost of the request, USD, before the ORYVOX markup (Billing).
savednumberBaseline cost minus cost, USD.
cachenull | "exact" | "semantic"Whether the answer came from the cache (similarity on semantic hits).
fallbacksintegerHow many fallbacks were used (0 = first choice answered).
testbooleantrue for simulated test-mode answers.

POST /chat/completions

OpenAI chat completions format.

curl https://api.oryvox.ai/v1/chat/completions \
  -H "Authorization: Bearer $ORYVOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "oryvox-balanced",
    "messages": [
      {"role": "system", "content": "You are concise."},
      {"role": "user", "content": "What is a CDN?"}
    ],
    "max_tokens": 200,
    "routing": {"mode": "balanced"},
    "max_cost": 0.01
  }'
FieldTypeRequiredDescription
modelstringnoA routing profile (oryvox-auto (default), oryvox-fast, oryvox-balanced, oryvox-quality, oryvox-max, oryvox-reasoning, oryvox-code) or a model id such as anthropic/claude-sonnet-5.5.
messagesarrayyesOpenAI messages (system, developer, user, assistant, tool). Content may be a string or parts (text, image_url).
tools, tool_choicenoOpenAI function tools. See Tool calling.
response_formatobjectno{"type":"json_object"} or {"type":"json_schema", ...}. See Structured outputs.
max_tokens, temperature, top_p, stopnoAs in OpenAI.
streambooleannoServer-sent events. See Streaming.
extensionsnoSee above.
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1790000000,
  "model": "openai/gpt-5-mini",
  "choices": [
    {"index": 0, "message": {"role": "assistant", "content": "A CDN is..."}, "finish_reason": "stop"}
  ],
  "usage": {"prompt_tokens": 24, "completion_tokens": 41, "total_tokens": 65},
  "oryvox": {"request_id": "req_8f2k...", "selected_model": "openai/gpt-5-mini", "provider": "openai",
             "cost": 0.000092, "saved": 0.00071, "cache": null, "fallbacks": 0}
}

With "stream": true: chat.completion.chunk lines (the last chunk carries usage), then data: {"object":"oryvox.summary","oryvox":{...}}, then data: [DONE]. An error after the stream started arrives as data: {"error": {...}} followed by data: [DONE].

Errors: 400 invalid_request, 400 blocked_by_policy, 401, 402 budget_exceeded, 402 insufficient_credits, 403, 404 model_not_found, 409 conflict, 422 idempotency_mismatch, 429 rate_limited, 502, 503 no_model_available, 503 provider_unavailable, 504 timeout. See Errors.


POST /responses

A simplified Responses API on the same pipeline: send input, read output_text.

curl https://api.oryvox.ai/v1/responses \
  -H "Authorization: Bearer $ORYVOX_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6c1d9f0e-order-42" \
  -d '{
    "model": "oryvox-auto",
    "instructions": "Answer in one sentence.",
    "input": "Why is the sky blue?",
    "max_output_tokens": 120,
    "metadata": {"task": "faq", "priority": "realtime"}
  }'
FieldTypeRequiredDescription
modelstringnoRouting profile or model id (default oryvox-auto).
inputstring | arrayyesA string, or {"role": "system" | "developer" | "user" | "assistant", "content": string | parts}; parts are input_text / output_text / text and input_image (image_url).
instructionsstringnoSystem instructions.
max_output_tokens, temperature, top_pnoOutput limit and sampling.
tools, tool_choicenoFunction tools (OpenAI chat format).
streambooleannoStream typed events.
extensionsnoSee above.
{
  "id": "resp_...",
  "object": "response",
  "created_at": 1790000000,
  "model": "google/gemini-3-flash",
  "status": "completed",
  "output_text": "Air molecules scatter short blue wavelengths more than red ones.",
  "output": [
    {"type": "message", "id": "msg_...", "status": "completed", "role": "assistant",
     "content": [{"type": "output_text", "text": "Air molecules scatter...", "annotations": []}]}
  ],
  "usage": {"input_tokens": 21, "output_tokens": 14, "total_tokens": 35, "input_tokens_details": {"cached_tokens": 0}},
  "oryvox": {"request_id": "req_...", "selected_model": "google/gemini-3-flash", "provider": "google", "cost": 0.00002, "saved": 0.0004, "cache": null, "fallbacks": 0}
}

Tool calls appear in output as {"type": "function_call", "id": "fc_...", "call_id": "...", "name": "...", "arguments": "{...}", "status": "completed"}.

Streaming ("stream": true) sends event: / data: pairs:

event: response.created
data: {"type":"response.created","response":{"id":"resp_...","object":"response","created_at":1790000000,"model":"oryvox-auto","status":"in_progress"}}

event: response.output_text.delta
data: {"type":"response.output_text.delta","delta":"Air molecules","item_id":"resp_..."}

event: response.completed
data: {"type":"response.completed","response":{ ...full response, including "oryvox"... }}

On failure: event: error / data: {"type":"error","error":{...}}. Errors as for /chat/completions.


POST /embeddings

OpenAI embeddings format. model defaults to openai/text-embedding-3-small.

curl https://api.oryvox.ai/v1/embeddings \
  -H "Authorization: Bearer $ORYVOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/text-embedding-3-small", "input": ["first text", "second text"]}'
FieldTypeRequiredDescription
inputstring | string[]yesText(s) to embed.
modelstringnoAn embedding model id.
dimensionsintegernoOutput dimensions, where the model supports it.
encoding_formatstringnofloat (default) or base64.
{
  "object": "list",
  "data": [{"object": "embedding", "index": 0, "embedding": [0.0123, -0.0456]}],
  "model": "openai/text-embedding-3-small",
  "usage": {"prompt_tokens": 4, "total_tokens": 4}
}

Errors: 404 model_not_found (not an embedding model), 402 insufficient_credits, 503 no_model_available, plus the auth errors. Embeddings are metered and charged like other requests. With an ory_test_ key the vectors are simulated (deterministic, 16 dimensions) and free.


GET /models

{
  "object": "list",
  "data": [
    {"id": "oryvox-auto", "object": "model", "owned_by": "oryvox", "created": 0, "oryvox": {"virtual": true}},
    {
      "id": "anthropic/claude-sonnet-5.5", "object": "model", "owned_by": "anthropic", "created": 1780000000,
      "oryvox": {
        "name": "Claude Sonnet 5.5", "input_price": 3.0, "output_price": 15.0, "context_window": 200000,
        "tools": true, "vision": true, "json": true, "reasoning": true, "embeddings": false,
        "quality": 92, "routable": true
      }
    }
  ],
  "has_more": false
}

Prices are USD per million tokens. Routing profiles have "virtual": true. The whole list is returned in one page.


POST /cache/invalidate

curl https://api.oryvox.ai/v1/cache/invalidate \
  -H "Authorization: Bearer $ORYVOX_API_KEY" -H "Content-Type: application/json" \
  -d '{"tags": ["document:456"]}'
FieldTypeDescription
tagsstring[]Remove the project's cached answers carrying any of these tags (max 100, 120 chars each).
allbooleantrue empties the project's response cache.

Response: {"object": "cache.invalidation", "deleted": 12}. See Cache.


GET /requests, GET /requests/{request_id}, POST /requests/{request_id}/feedback, GET /metrics

The request log (?limit&after&model&status&workflow_id&trace_id, cursor-paginated with has_more / last_id), one request with its trace, answer ratings ({"rating": 1-5} → {"object": "feedback", "request_id", "rating"}) and project metrics (?period=1h|24h|7d|30d). Unknown request ids answer 404 not_found. Prompts and answers are never returned. Full reference: Observability.

for await (const r of client.requests.list({ limit: 50 })) console.log(r.request_id);
for r in client.requests.list(limit=50):
    print(r.request_id)

Validation errors on /cache/invalidate and /feedback answer 422 with {"message", "errors"} (see Errors).

Ar šis puslapis buvo naudingas?