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

ParameterTypeRequiredDescription
modelstringRequiredA model id from GET /v1/models, e.g. gpt-5.5, claude-sonnet-5, gemini-3-flash.
messagesarrayRequiredThe conversation. Each item has a role and content; content may be a string or an array of content parts. Roles:systemdeveloperuserassistanttoolfunction
temperaturenumberOptionalSampling temperature, 0–2. Higher is more random. Default the provider's own
max_tokensintegerOptionalMaximum tokens to generate, ≥ 1. Default the provider's own, or the model's default output limit where the provider requires a value
top_pnumberOptionalNucleus sampling, 0–1. Use this or temperature, not both.
top_kintegerOptionalSample from the k most likely tokens. Forwarded to the providers that support it.
nintegerOptionalHow many completions to generate, 1–128. Every choice is billed. Default 1
streambooleanOptionalStream the reply as server-sent events. See Streaming. Default false
stream_optionsobjectOptional{include_usage: true} adds a final chunk with token counts and cost.
stopstring|arrayOptionalUp to four sequences that end the generation.
seedintegerOptionalBest-effort determinism on the providers that support it.
frequency_penaltynumberOptional-2–2. Discourages repeating tokens by frequency. Default 0
presence_penaltynumberOptional-2–2. Discourages repeating any token already used. Default 0
toolsarrayOptionalFunction declarations. See Tool calling.
tool_choicestring|objectOptionalOne of:noneautorequired{type:"function",…} Default auto
parallel_tool_callsbooleanOptionalAllow several tool calls in one turn. Default true
response_formatobjectOptionalForce JSON output. See Structured outputs. Types:textjson_objectjson_schema
reasoning_effortstringOptionalThinking budget on reasoning models. One of:minimallowmediumhigh
logprobsbooleanOptionalReturn log probabilities for the chosen tokens.
top_logprobsintegerOptionalHow many alternatives to report per position. Requires logprobs.
logit_biasobjectOptionalToken id to bias, -100–100.
userstringOptionalA stable id for your own end user. Helps you attribute usage.
modalitiesarrayOptionalWhat the model should return. Use ["image","text"] to have an image model answer over chat. One of:textimageaudio
image_configobjectOptionalPicture controls when a model answers with an image: {image_size, aspect_ratio}.
service_tierstringOptionalForwarded to providers that offer tiers, and echoed back on the response.
metadataobjectOptionalOpaque 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