Chat Completions
Unified endpoint for 70+ LLM models. OpenAI-compatible drop-in replacement — just change the base URL.
/v1/ai/chat/completionsOverview
A single endpoint that gives you access to 70+ LLM models from OpenAI, Anthropic, Google, Meta, DeepSeek, xAI, Qwen, Mistral, Perplexity, and more. Fully OpenAI-compatible — swap the base URL and it works with any OpenAI SDK.
There are two ways to call the AI API:
| Endpoint | Format | Model Source |
|---|---|---|
POST /v1/ai/chat/completions | OpenAI-compatible (snake_case) | model field in body |
POST /v1/ai/chat | YepAPI simplified (camelCase) | model field in body |
Both hit the same infrastructure. Pick whichever fits your stack.
OpenAI SDK Drop-In
Point any OpenAI SDK at YepAPI by changing the base URL:
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.yepapi.com/v1/ai",
});
const response = await client.chat.completions.create({
model: "anthropic/claude-sonnet-4.6",
messages: [{ role: "user", content: "Explain quantum computing in one paragraph." }],
});
console.log(response.choices[0].message.content);Works with Python, Node, Go, or any language with an OpenAI-compatible client.
Usage
OpenAI-Compatible Endpoint
const res = await fetch("https://api.yepapi.com/v1/ai/chat/completions", {
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "anthropic/claude-sonnet-4.6",
messages: [{ role: "user", content: "What is the capital of France?" }],
temperature: 0.7,
max_tokens: 1024,
}),
});
const data = await res.json();
console.log(data.choices[0].message.content);curl -X POST https://api.yepapi.com/v1/ai/chat/completions \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4.6",
"messages": [{"role": "user", "content": "What is the capital of France?"}],
"temperature": 0.7,
"max_tokens": 1024
}'YepAPI Simplified Endpoint
const res = await fetch("https://api.yepapi.com/v1/ai/chat", {
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "claude-sonnet-4.6",
messages: [{ role: "user", content: "What is the capital of France?" }],
temperature: 0.7,
maxTokens: 1024,
}),
});
const { data } = await res.json();
console.log(data.message.content);The /v1/ai/chat endpoint accepts short aliases like gpt-4o, claude-sonnet, or gemini-flash — no need for the full provider/model format.
Request Body
/v1/ai/chat/completions (OpenAI-compatible, snake_case)
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
model | string | Yes | Model ID (e.g. openai/gpt-4o, anthropic/claude-sonnet-4.6) | — |
messages | Message[] | Yes | Array of { role, content } objects | — |
max_tokens | number | No | Maximum tokens in the response | Model default |
temperature | number | No | Sampling temperature (0.0–2.0) | 1.0 |
top_p | number | No | Nucleus sampling threshold | 1.0 |
frequency_penalty | number | No | Penalize repeated tokens | 0 |
presence_penalty | number | No | Penalize tokens already present | 0 |
stop | string | string[] | No | Stop sequences | — |
stream | boolean | No | Enable SSE streaming | false |
/v1/ai/chat (YepAPI simplified, camelCase)
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
model | string | No | Model ID or alias (e.g. gpt-4o, claude-sonnet) | openai/gpt-4o-mini |
messages | Message[] | Yes | Array of { role, content } objects | — |
maxTokens | number | No | Maximum tokens in the response | Model default |
temperature | number | No | Sampling temperature (0.0–2.0) | 1.0 |
topP | number | No | Nucleus sampling threshold | 1.0 |
frequencyPenalty | number | No | Penalize repeated tokens | 0 |
presencePenalty | number | No | Penalize tokens already present | 0 |
stop | string | string[] | No | Stop sequences | — |
stream | boolean | No | Enable SSE streaming | false |
Model Aliases
The /v1/ai/chat endpoint accepts short aliases so you don't need the full provider/model format:
| Alias | Resolves To |
|---|---|
gpt-4o | openai/gpt-4o |
gpt-4o-mini | openai/gpt-4o-mini |
gpt-5.4 | openai/gpt-5.4 |
claude-opus | anthropic/claude-opus-4.6 |
claude-sonnet | anthropic/claude-sonnet-4.6 |
claude-haiku | anthropic/claude-haiku-4 |
gemini-pro | google/gemini-2.5-pro |
gemini-flash | google/gemini-2.5-flash |
grok | x-ai/grok-4.20 |
deepseek-v3 | deepseek/deepseek-chat-v3 |
deepseek-r1 | deepseek/deepseek-r1 |
sonar-pro | perplexity/sonar-pro |
llama-scout | meta-llama/llama-4-scout |
qwen | qwen/qwen3.6-plus |
mistral-small | mistralai/mistral-small-2603 |
You can also pass the full provider/model format to either endpoint.
Response Formats
/v1/ai/chat/completions (OpenAI-compatible)
{
"id": "chatcmpl-abc123",
"object": "text_completion",
"created": 1713100000,
"model": "anthropic/claude-sonnet-4.6",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 8,
"total_tokens": 22
}
}/v1/ai/chat (YepAPI simplified)
{
"ok": true,
"data": {
"id": "chatcmpl-abc123",
"model": "anthropic/claude-sonnet-4.6",
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"usage": {
"promptTokens": 14,
"completionTokens": 8,
"totalTokens": 22
},
"costUsd": 0.000162
}
}Streaming
Set "stream": true to receive Server-Sent Events.
/v1/ai/chat/completions (OpenAI-compatible SSE)
data: {"id":"chatcmpl-abc123","model":"anthropic/claude-sonnet-4.6","choices":[{"index":0,"delta":{"role":"assistant","content":"The"},"finish_reason":null}]}
data: {"id":"chatcmpl-abc123","model":"anthropic/claude-sonnet-4.6","choices":[{"index":0,"delta":{"content":" capital"},"finish_reason":null}]}
data: [DONE]/v1/ai/chat (YepAPI simplified SSE)
data: {"id":"chatcmpl-abc123","delta":{"role":"assistant","content":"The"},"model":"anthropic/claude-sonnet-4.6","index":0}
data: {"id":"chatcmpl-abc123","delta":{"content":" capital"},"model":"anthropic/claude-sonnet-4.6","index":0}
data: [DONE]List Available Models
curl https://api.yepapi.com/v1/ai/modelsReturns every available model with pricing, context window, and capabilities. This endpoint is free and does not require authentication.
We handle auth, billing, and response normalization — you just send messages.