Chat Completions
Generate text and reasoning completions across OpenAI, Anthropic, Gemini, and open models.
Chat Completions
The /v1/chat/completions endpoint generates text, code, or structured reasoning responses from AI models.
Authentication
Requests authenticate using an Inference Key in the Authorization header:
Authorization: Bearer zrv_your_inference_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-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 Code | HTTP Status | Root Cause & Resolution |
|---|---|---|
invalid_api_key | 401 | The zrv_... key is missing, invalid, or revoked. Generate a new key in the dashboard. |
model_not_allowed | 403 | The requested model is outside your App Connection's allowed model policy. Update allowed model wildcards. |
insufficient_balance | 402 | Organization wallet balance is exhausted and no active BYOK credential matches. Top up balance or add BYOK key. |
cap_exceeded | 429 | The organization, connection, or product-user periodic spending cap has been reached. |