API reference
OpenAI-compatible API
Vani's Chat Completions (POST /chat/completions) and stateless Responses (POST /responses) endpoints take OpenAI's request and answer formats, so the official OpenAI SDKs and most OpenAI-compatible tools work by changing the base URL to https://api.vani.ai/v1 and using a Vani key. One key reaches every model GET /models lists, not only OpenAI's.
- Base URL
- https://api.vani.ai/v1
- Endpoints
- POST /chat/completions · POST /responses
- Authentication
- Authorization: Bearer vani_…
- Model list
- GET https://api.vani.ai/v1/models
On this pageQuickstart
Quickstart
Create a key on the Vani API Platform (prepaid) or, on a paid Vani Chat plan, in Developer settings. Then point the OpenAI SDK at Vani and send a model id from GET /models, such as openai/gpt-6-sol, anthropic/claude-sonnet-5.5 or zhipu/glm-5.3.
Python (OpenAI SDK)
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.vani.ai/v1", api_key=os.environ["VANI_API_KEY"])
reply = client.chat.completions.create(
model="openai/gpt-6-sol", # any id from GET /models
messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)JavaScript / TypeScript (OpenAI SDK)
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.vani.ai/v1", apiKey: process.env.VANI_API_KEY });
const reply = await client.chat.completions.create({
model: "anthropic/claude-sonnet-5.5", // any id from GET /models
messages: [{ role: "user", content: "Hello" }],
});
console.log(reply.choices[0].message.content);Or set it in the environment (no code change)
export OPENAI_BASE_URL="https://api.vani.ai/v1"
export OPENAI_API_KEY="vani_YOUR_API_KEY"Chat Completions
- Messages with text strings or content parts, in the
user,assistant,systemandtoolroles (developeris treated assystem). User messages can also carry images (image_url, for models that can see) and PDFs (file): see Images and PDFs on the API. - Function tools (up to 512 schemas),
tool_choiceandparallel_tool_calls. Your client runs the functions and sends the results back. - Structured output:
response_formatof typejson_objectorjson_schema(up to 32 KiB). Validate the result in your client; not every provider enforces a schema strictly. - Streaming, with
stream_options.include_usagefor usage in the last chunk;max_completion_tokensormax_tokens(not both),stop,frequency_penalty,presence_penaltyandreasoning_effort. - Up to four
stopsequences: the answer ends before the first one withfinish_reason: "stop", on every model, streamed or not. nmay be omitted or 1, andstoremust be false or null.
Responses
POST /responses is stateless: send the whole conversation in input on every call, with store: false (or without store; nothing is stored). It supports text, image and PDF input and instructions, function and custom tools, MCP tools, text.format structured output and streaming.
A Responses request
curl "https://api.vani.ai/v1/responses" \
-H "Authorization: Bearer $VANI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-6-sol","input":"Hello","store":false}'Tools that work with it
Clients that speak Chat Completions or Responses connect the same way: Codex (Responses) and OpenCode (Chat Completions), and, with the settings in their guides, Cursor, Cline, Continue, Aider, Zed, Open WebUI, LibreChat and others. Each guide lists the exact fields and what the client supports.
Client directoryIDE and SDK guidesOpenAI and Anthropic SDK guide
What differs from OpenAI's API
- Model ids name their maker, for example
openai/gpt-6-solorgoogle/gemini-3.8-flash. A vendor's own id is accepted when it names exactly one model your key can use. - The chat endpoints take text, images (on models that can see) and PDFs (read as text), sent inline or by URL; there is no audio input and no Files API (
file_idis refused). There are no embeddings and no hosted file search or computer tools. - Web search is available as OpenAI's own tools:
web_searchon/responsesandweb_search_optionson/chat/completions. Vani runs the search, for USD 0.005 per search on top of tokens (see Web search and web fetch tools). - Responses keeps no state: no
previous_response_id, stored responses or background mode. - Images and video have their own endpoints with the same key:
/images/generations,/images/editsand/videos(prepaid keys). - Every answer carries OpenAI's rate-limit headers (
x-ratelimit-*), and usage reports cached and reasoning tokens.
Note
Model ids, limits, headers and usageImages and PDFs on the APIWeb search and web fetch toolsMedia API: images and videosAPI prices per model
More reference: Anthropic-compatible API · Model ids, limits, headers and usage · Images and PDFs on the API · MCP tools on the API · Web search and web fetch tools · Media API: images and videos · Artifacts API · Responses API: scope and limits · Model changes: webhooks, feeds and the changes API · API overview · Docs and quickstart