Chat Completions API
Generate responses to text prompts using the standard chat completion format.
Endpoint
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | ID of the model to use (e.g., mistral-7b, llama-3-8b). |
| messages | array | Yes | A list of messages comprising the conversation so far. |
| max_tokens | integer | No | Maximum number of tokens to generate. Defaults to 256. |
| temperature | float | No | Sampling temperature between 0 and 2. Defaults to 0.7. |
| stream | boolean | No | Whether to stream back partial progress. Defaults to false. |
| tools | array | No | A list of tools the model may call. Each tool is a function with a name, description, and JSON Schema parameters. See Tool Calling. |
| tool_choice | string | No | Controls which tool is called. "auto" (default) lets the model decide, "none" disables tool calling. |
| include_reasoning | boolean | No | Whether to include reasoning_content in responses from thinking models. Defaults to true. Set to false for cleaner output. See Reasoning. |
Full Reference: For the complete list of parameters including top_p, frequency_penalty, top_k,repeat_penalty, min_p, Mirostat, and more — see the Parameters Reference.
Example Request
curl https://api.oxlo.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "mistral-7b",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
]
}'Example Response
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"model": "mistral-7b",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello there, how may I assist you today?"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}Tool Calling
Oxlo supports OpenAI-compatible tool calling (function calling) across 15+ models. Define functions as tools, and the model will return structured tool_calls when it decides to invoke them.
Supported Models: deepseek-v3-0324, deepseek-v3.2, deepseek-v4-flash, llama-4-maverick-17b, qwen-3-32b, qwen-3-coder-30b, gpt-oss-120b, gpt-oss-20b, kimi-k2.5, kimi-k2.6, kimi-k2-thinking, oxlo-claw, mistral-7b, glm-5, minimax-m2.5
Tool Calling Request
curl https://api.oxlo.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "deepseek-v3.2",
"messages": [
{"role": "user", "content": "What is the weather in Tokyo?"}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"}
},
"required": ["location"]
}
}
}
],
"tool_choice": "auto"
}'Tool Calling Response
When the model invokes a tool, the response includes a tool_calls array and finish_reason is set to "tool_calls".
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "deepseek-v3.2",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"tool_calls": [{
"id": "call_abc123",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"location\": \"Tokyo\"}"
}
}]
},
"finish_reason": "tool_calls"
}]
}Parallel Tool Calling
Most supported models can invoke multiple tools in a single response. Simply define multiple functions in the tools array and the model will return multiple entries in tool_calls when needed.
⚠️ Note: Some models (e.g., llama-3.3-70b) only support a single tool definition per request. Oxlo automatically handles this — if a model rejects multiple tools, we retry with a single tool.
Reasoning Models
Some models include a reasoning_content field in their responses, which contains the model's internal thinking process. This is useful for debugging and understanding how the model arrived at its answer.
Reasoning Models: deepseek-r1-70b, deepseek-r1-8b, kimi-k2.6, kimi-k2.5, gpt-oss-120b, qwen-3-32b (when using thinking mode), qwen-3-coder-30b, minimax-m2.5
Controlling Reasoning Output
Set include_reasoning to false to omit the thinking content and receive only the final answer — similar to how other inference providers handle it.
# With reasoning (default)
curl https://api.oxlo.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-r1-70b",
"messages": [{"role": "user", "content": "What is 25 * 37?"}],
"include_reasoning": true
}'
# Without reasoning (cleaner output)
curl https://api.oxlo.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-r1-70b",
"messages": [{"role": "user", "content": "What is 25 * 37?"}],
"include_reasoning": false
}'Reasoning Response
When include_reasoning is true (default), the response includes both the thinking process and the final answer.
{
"choices": [{
"message": {
"role": "assistant",
"content": "25 × 37 = 925",
"reasoning_content": "Let me calculate 25 * 37.\n25 * 37 = 25 * (40 - 3) = 1000 - 75 = 925"
},
"finish_reason": "stop"
}]
}Tip: Oxlo automatically extracts <think> tags from models that use them (DeepSeek R1, Qwen 3) and normalizes them into the reasoning_content field, so you always get a consistent API format regardless of the underlying model.
Error Handling
| Code | Description |
|---|---|
| 401 | Unauthorized. Invalid or missing API key. |
| 403 | Forbidden. Access denied (e.g., plan limit reached, or model requires upgrade). |
| 429 | Too Many Requests. Rate limit exceeded. |
| 502 | Bad Gateway. Worker unreachable or returned an invalid response. |
| 503 | Service Unavailable. All workers busy or queue full. |
| 504 | Gateway Timeout. Model took too long to generate a response. |