Chat completions
Generate text and reasoning completions across OpenAI, Anthropic, Gemini, and open models.
The /v1/chat/completions endpoint generates text, code, or structured reasoning responses from AI models.
Authentication
Requests authenticate using an API Key in the Authorization header:
Authorization: Bearer zrv_your_api_keyRequest parameters
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).
An array of message objects representing the conversation history. Each object contains role (system, user, assistant, tool) and content.
1.0Sampling temperature between 0.0 and 2.0. Lower values yield more deterministic answers.
Maximum number of tokens to generate in the completion.
falseIf true, tokens are returned via Server-Sent Events (SSE).
Zorveus attribution metadata. Use external_user_id for your customer ID and put optional profile fields inside product_user.
Code examples
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 Code | HTTP Status | Root Cause & Resolution |
|---|---|---|
zorveus_malformed_or_missing_key | 401 | The API key is missing, invalid, or revoked. Check key configuration. |
zorveus_reservation_insufficient_balance | 402 | Organization wallet lacks funds to cover the estimated wallet charge or BYOK platform fee. Top up wallet balance. |
zorveus_product_user_allowance_insufficient | 403 | The estimated request cost exceeds the product user's remaining base allowance plus promotional credits. |
zorveus_cap_exceeded | 403 | The organization, connection, or product-user spending cap has been reached. |
zorveus_model_not_allowed | 403 | The requested model is outside your connection's allowed model policy. |
zorveus_reservation_conflict | 409 | Idempotency key was reused with mismatched request parameters. |
rate_limit_exceeded | 429 | Upstream model provider rate limit reached. Retry with exponential backoff. |