Chat Completions
OpenAI-compatible chat endpoint. Streaming, tool calls, and multimodal messages from a single surface.
The Chat Completions API is the primary entry point for text generation,
tool calling, and multimodal reasoning. It mirrors OpenAI's
chat.completions.create surface so any official OpenAI SDK works out of
the box - just point baseURL at https://api.aivene.com/v1.
POST /v1/chat/completionsSend an array of messages representing the conversation so far and the
model replies with the next assistant turn. Stream the response with
stream: true for token-by-token delivery, or get a single JSON payload
otherwise.
What you can do
- Generate text - everything from one-shot completions to multi-turn agentic loops.
- Call tools - register JSON-schema function definitions and let the model decide when to invoke them. See Tool calling.
- Reason over images, audio, and documents - attach multimodal
content parts to any
usermessage. See Multimodal. - Enforce structured output - use
response_format: 'json_schema'to get strictly-typed JSON without parsing.
Provider routing
The model id you send determines which upstream provider handles the
request. The gateway normalises differences (e.g. rewriting developer
roles to system, aligning max_tokens vs max_completion_tokens) so
the same request body works across vendors. Browse available models at
Models.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/chat/completions | Create completion |
Every endpoint expects a bearer token in the Authorization header.
Create keys at Manage API Keys.
Errors
All errors follow the OpenAI structured shape:
{ "error": { "type": "invalid_request_error", "message": "..." } }| Status | error.type | Meaning |
|---|---|---|
400 | invalid_request_error | Schema violation. The message names the offending field. |
401 | authentication_error | Missing or invalid API key. |
402 | billing_error | Account out of credit or hit a spend limit. |
403 | permission_error | Key lacks the required scope. |
429 | rate_limit_error | RPM or TPM exceeded. Respect Retry-After. |
500 | internal_server_error | Unexpected gateway failure. Safe to retry idempotently. |
502 / 503 | upstream_error | Downstream provider failure. |