logo

Chat Completions

POST /v1/chat/completions is the main OpenAI-compatible chat endpoint.

curl https://llmoxy.com/v1/chat/completions \
  -H "Authorization: Bearer <LLMOXY_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      { "role": "system", "content": "Be concise." },
      { "role": "user", "content": "What is LLMoxy?" }
    ]
  }'

Request Body

Common fields:

FieldDescription
modelRequired. Model ID.
messagesRequired. Array of conversation messages.
temperature, top_p, n, stopSampling control parameters, passed to compatible upstreams.
max_tokens, max_completion_tokensOutput token limits.
streamSet to true to enable SSE streaming.
stream_options.include_usageReturns usage in streaming responses when supported by upstream.
tools, tool_choiceOpenAI-compatible tool calling.
response_formatRequest structured output for supported models.
reasoning_effortSupported reasoning models can use low, medium, high.
modalities, audioAvailable for models that support multimodal audio.
userOptional. For your own end-user identification.

Different models support different parameters. If the response says a parameter is unsupported, remove it or switch to another model.

Streaming Output

{
  "model": "gpt-4o-mini",
  "stream": true,
  "messages": [
    { "role": "user", "content": "Stream one sentence." }
  ]
}

Responses use OpenAI-style SSE chunks and end with [DONE].

Tool Calling

{
  "model": "gpt-4o-mini",
  "messages": [
    { "role": "user", "content": "What is the weather in Singapore?" }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get the current weather for a city.",
        "parameters": {
          "type": "object",
          "properties": {
            "city": { "type": "string" }
          },
          "required": ["city"]
        }
      }
    }
  ]
}

Models that support tool calling receive tool definitions and return OpenAI-compatible tool call responses.

Legacy Completions

Legacy text completion clients can use POST /v1/completions.