Zorveus LogoZorveusDOCS

Chat Completions

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

Chat Completions

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

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

Inference Key TesterInteractive
Paste your Zorveus key to dynamically update all code snippets below.

Authentication

Requests authenticate using an Inference Key in the Authorization header:

Authorization: Bearer zrv_your_inference_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-specific attribution metadata containing external_user_id, name, email, or custom tracking tags.


Code Examples

from openai import OpenAI

client = OpenAI(
    base_url="https://api.zorveus.com/v1",
    api_key="zrv_your_inference_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
invalid_api_key401The zrv_... key is missing, invalid, or revoked. Generate a new key in the dashboard.
model_not_allowed403The requested model is outside your App Connection's allowed model policy. Update allowed model wildcards.
insufficient_balance402Organization wallet balance is exhausted and no active BYOK credential matches. Top up balance or add BYOK key.
cap_exceeded429The organization, connection, or product-user periodic spending cap has been reached.
Was this page helpful?
Edit this page on GitHub

On this page