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/completions

Send 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 user message. 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

MethodEndpointDescription
POST/v1/chat/completionsCreate 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": "..." } }
Statuserror.typeMeaning
400invalid_request_errorSchema violation. The message names the offending field.
401authentication_errorMissing or invalid API key.
402billing_errorAccount out of credit or hit a spend limit.
403permission_errorKey lacks the required scope.
429rate_limit_errorRPM or TPM exceeded. Respect Retry-After.
500internal_server_errorUnexpected gateway failure. Safe to retry idempotently.
502 / 503upstream_errorDownstream provider failure.