Skip to main content

Endpoint

Set the OpenAI SDK base_url to https://api.viviai.cc/v1. The SDK appends /chat/completions.

Authentication

Use your ViVi-API key and replace YOUR_OPENAI_MODEL with an available Chat Completions model ID.

Request parameters

*Tool-only assistant messages can use a different structure. Some older models require max_tokens instead of max_completion_tokens; do not send both. Tool calling, multimodal input, reasoning, and structured output depend on the model and channel.

Request examples

Set VIVI_API_KEY to your ViVi-API key in your shell environment. See Quickstart to create a key. Install the SDK with python -m pip install openai. cURL uses Bash syntax.
The examples disable automatic SDK retries to make initial troubleshooting easier.

Response

Illustrative response; text and usage numbers are examples:
  • Text: choices[0].message.content.
  • Finish reason: choices[0].finish_reason. stop usually means normal completion; length means the output limit was reached.
  • Usage: usage. Exact fields and billing rules depend on the actual response and dashboard.

Multi-turn conversations

Send the relevant conversation history with each request. The API key does not automatically associate requests with a conversation.

Streaming

When parsing raw SSE, decode the JSON in each data: event and read choices[0].delta.content. Some events only carry a role or finish reason. A common final marker is data: [DONE].

Integration notes

  • Include /v1 only once in the final URL.
  • Specialized image and other models may not support this endpoint.
  • If parameters fail, start with only model and messages.
  • See troubleshooting for authentication, permission, and rate-limit errors.
Protocol reference: OpenAI Chat Completions. Model availability and optional features depend on ViVi-API support.