Chat API
Chat completions
The main endpoint. GPT-5.5, Claude Sonnet 5, Gemini 3 Flash and every other chat model below — all with the same request body.
POSThttps://api.oxyy.ai/v1/chat/completions
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | A model id from GET /v1/models, e.g. gpt-5.5, claude-sonnet-5, gemini-3-flash. |
| messages | array | Required | The conversation. Each item has a role and content; content may be a string or an array of content parts. Roles:systemdeveloperuserassistanttoolfunction |
| temperature | number | Optional | Sampling temperature, 0–2. Higher is more random. Default the provider's own |
| max_tokens | integer | Optional | Maximum tokens to generate, ≥ 1. Default the provider's own, or the model's default output limit where the provider requires a value |
| top_p | number | Optional | Nucleus sampling, 0–1. Use this or temperature, not both. |
| top_k | integer | Optional | Sample from the k most likely tokens. Forwarded to the providers that support it. |
| n | integer | Optional | How many completions to generate, 1–128. Every choice is billed. Default 1 |
| stream | boolean | Optional | Stream the reply as server-sent events. See Streaming. Default false |
| stream_options | object | Optional | {include_usage: true} adds a final chunk with token counts and cost. |
| stop | string|array | Optional | Up to four sequences that end the generation. |
| seed | integer | Optional | Best-effort determinism on the providers that support it. |
| frequency_penalty | number | Optional | -2–2. Discourages repeating tokens by frequency. Default 0 |
| presence_penalty | number | Optional | -2–2. Discourages repeating any token already used. Default 0 |
| tools | array | Optional | Function declarations. See Tool calling. |
| tool_choice | string|object | Optional | One of:noneautorequired{type:"function",…} Default auto |
| parallel_tool_calls | boolean | Optional | Allow several tool calls in one turn. Default true |
| response_format | object | Optional | Force JSON output. See Structured outputs. Types:textjson_objectjson_schema |
| reasoning_effort | string | Optional | Thinking budget on reasoning models. One of:minimallowmediumhigh |
| logprobs | boolean | Optional | Return log probabilities for the chosen tokens. |
| top_logprobs | integer | Optional | How many alternatives to report per position. Requires logprobs. |
| logit_bias | object | Optional | Token id to bias, -100–100. |
| user | string | Optional | A stable id for your own end user. Helps you attribute usage. |
| modalities | array | Optional | What the model should return. Use ["image","text"] to have an image model answer over chat. One of:textimageaudio |
| image_config | object | Optional | Picture controls when a model answers with an image: {image_size, aspect_ratio}. |
| service_tier | string | Optional | Forwarded to providers that offer tiers, and echoed back on the response. |
| metadata | object | Optional | Opaque key/value pairs carried with the request. |
Code examples
import os from openai import OpenAI client = OpenAI( api_key=os.environ["OXYY_API_KEY"], base_url="https://api.oxyy.ai/v1" ) response = client.chat.completions.create( model="claude-sonnet-5", messages=[ {"role": "system", "content": "You are a concise assistant."}, {"role": "user", "content": "Explain HTTP caching in two sentences."}, ], temperature=0.7, max_tokens=4096 ) print(response.choices[0].message.content)
import OpenAI from 'openai'; const client = new OpenAI({ apiKey: process.env.OXYY_API_KEY, baseURL: 'https://api.oxyy.ai/v1' }); const response = await client.chat.completions.create({ model: 'claude-sonnet-5', messages: [ { role: 'system', content: 'You are a concise assistant.' }, { role: 'user', content: 'Explain HTTP caching in two sentences.' }, ], temperature: 0.7, max_tokens: 4096 }); console.log(response.choices[0].message.content);
curl https://api.oxyy.ai/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OXYY_API_KEY" \ -d '{ "model": "claude-sonnet-5", "messages": [{"role": "user", "content": "Explain HTTP caching."}], "temperature": 0.7, "max_tokens": 4096 }'
// composer require openai-php/client $client = OpenAI::factory() ->withApiKey(getenv('OXYY_API_KEY')) ->withBaseUri('https://api.oxyy.ai/v1') ->make(); $response = $client->chat()->create([ 'model' => 'claude-sonnet-5', 'messages' => [['role' => 'user', 'content' => 'Hello!']], 'temperature' => 0.7, ]); echo $response->choices[0]->message->content;
// go get github.com/sashabaranov/go-openai cfg := openai.DefaultConfig(os.Getenv("OXYY_API_KEY")) cfg.BaseURL = "https://api.oxyy.ai/v1" client := openai.NewClientWithConfig(cfg) resp, err := client.CreateChatCompletion(context.Background(), openai.ChatCompletionRequest{ Model: "claude-sonnet-5", Messages: []openai.ChatCompletionMessage{ {Role: openai.ChatMessageRoleUser, Content: "Hello!"}, }, })
Example response
Response
{
"id": "chatcmpl-abc123def456",
"object": "chat.completion",
"created": 1700000000,
"model": "claude-sonnet-5",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?",
"refusal": null
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 9,
"total_tokens": 21,
"prompt_tokens_details": {
"cached_tokens": 0,
"cache_write_tokens": 0,
"text_tokens": 12,
"image_tokens": null,
"audio_tokens": null
},
"completion_tokens_details": {
"reasoning_tokens": 0,
"text_tokens": 9,
"audio_tokens": null
},
"is_byok": false,
"cost": 0.000106,
"cost_details": { "currency": "USD", "input": 0.000036, "output": 0.00007 }
}
}finish_reason is one of stop, length, tool_calls, content_filter or function_call. When the provider reports something of its own, it is passed through beside it as native_finish_reason. An image answered over chat arrives on message.images.
Available models
101 models
Model
Model ID
