Skip to content

Chat Completions

POST /v1/chat/completions

Fully compatible with the OpenAI Chat Completions API.

ParameterTypeRequiredDescription
modelstringYesModel ID (e.g. gpt-4o-mini, deepseek-chat, kimi-2.5)
messagesarrayYesArray of message objects
streambooleanNoEnable SSE streaming (default: false)
temperaturenumberNoSampling temperature (0–2)
max_tokensintegerNoMaximum tokens to generate
top_pnumberNoNucleus sampling parameter
toolsarrayNoTool/function definitions for function calling
tool_choicestring/objectNoControl tool usage (auto, none, or specific tool)
{
"role": "user | assistant | system",
"content": "Message text"
}
Terminal window
curl https://api.cheapestinference.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"}
],
"temperature": 0.7
}'
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 8,
"total_tokens": 33
}
}

All models work through the OpenAI endpoint. The API translates the request format automatically:

Terminal window
# DeepSeek
curl https://api.cheapestinference.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek-chat", "messages": [{"role": "user", "content": "Hello"}]}'
# Claude (via OpenAI format)
curl https://api.cheapestinference.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "claude-sonnet-4-20250514", "messages": [{"role": "user", "content": "Hello"}]}'
# Kimi
curl https://api.cheapestinference.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "kimi-2.5", "messages": [{"role": "user", "content": "Hello"}]}'

Any model returned by GET /v1/models can be used. See Models for the full list.