Zorveus LogoZorveusDOCS
Inference API

Chat completions

View Markdown

Generate text and reasoning completions across OpenAI, Anthropic, Gemini, and open models.

POST/v1/chat/completions
API Key (Bearer zrv_...)

The /v1/chat/completions endpoint generates text, code, or structured reasoning responses from AI models.

Optional key for interactive API requests. Stored in memory only.


Authentication

Requests authenticate using an API Key in the Authorization header:

Authorization: Bearer zrv_your_api_key

Request parameters

modelstringrequired

The model identifier to route the request to (e.g. openai/gpt-4.1-mini, anthropic/claude-3-7-sonnet, gemini/gemini-2.5-flash).

messagesarrayrequired

An array of message objects representing the conversation history. Each object contains role (system, user, assistant, tool) and content.

temperaturenumberoptionaldefault: 1.0

Sampling temperature between 0.0 and 2.0. Lower values yield more deterministic answers.

max_tokensintegeroptional

Maximum number of tokens to generate in the completion.

streambooleanoptionaldefault: false

If true, tokens are returned via Server-Sent Events (SSE).

metadataobjectoptional

Zorveus attribution metadata. Use external_user_id for your customer ID and put optional profile fields inside product_user.


Code examples

Client SDK / Framework:
from openai import OpenAI

client = OpenAI(
    base_url="https://api.zorveus.com/v1",
    api_key="zrv_your_api_key",
)

response = client.chat.completions.create(
    model="openai/gpt-4.1-mini",
    messages=[
        {"role": "system", "content": "You are a senior systems engineer."},
        {"role": "user", "content": "Explain write-ahead logging (WAL) concisely."},
    ],
    temperature=0.3,
    extra_body={
        "metadata": {
            "external_user_id": "usr_dev_4812",
        }
    },
)

print(response.choices[0].message.content)

Expected response

{
  "id": "chatcmpl-9K8xZ1048",
  "object": "chat.completion",
  "created": 1723580000,
  "model": "openai/gpt-4.1-mini",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Write-Ahead Logging (WAL) is a technique used in database systems where changes are first recorded in a persistent append-only log file before they are applied to the main database storage. This ensures durability and atomicity (ACID compliance), allowing the system to recover consistent state after a crash."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 28,
    "completion_tokens": 58,
    "total_tokens": 86
  }
}

Common errors

Error CodeHTTP StatusRoot Cause & Resolution
zorveus_malformed_or_missing_key401The API key is missing, invalid, or revoked. Check key configuration.
zorveus_reservation_insufficient_balance402Organization wallet lacks funds to cover the estimated wallet charge or BYOK platform fee. Top up wallet balance.
zorveus_product_user_allowance_insufficient403The estimated request cost exceeds the product user's remaining base allowance plus promotional credits.
zorveus_cap_exceeded403The organization, connection, or product-user spending cap has been reached.
zorveus_model_not_allowed403The requested model is outside your connection's allowed model policy.
zorveus_reservation_conflict409Idempotency key was reused with mismatched request parameters.
rate_limit_exceeded429Upstream model provider rate limit reached. Retry with exponential backoff.
Was this page helpful?
Edit this page on GitHub

On this page