OpenAI-Compatible API

Hoziron exposes an OpenAI-compatible chat completions endpoint, allowing existing tools and libraries that integrate with the OpenAI API to work with Hoziron as a drop-in replacement.

Endpoint

MethodPathDescription
POST/chat/completionsOpenAI-compatible chat completions

POST /chat/completions

Send a chat completion request using the OpenAI API format.

curl -X POST http://localhost:4200/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer hzn_sk_a1b2c3d4..." \
  -d '{
    "model": "anthropic/claude-sonnet-4-20250514",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "What is the capital of France?"}
    ],
    "temperature": 0.7,
    "max_tokens": 1000
  }'

Request Body

FieldTypeRequiredDescription
modelstringYesModel identifier (e.g., anthropic/claude-sonnet-4-20250514)
messagesarrayYesConversation messages with role and content
temperaturefloatNoSampling temperature (0.0–2.0)
max_tokensintegerNoMaximum tokens in response

Message Roles

RoleDescription
systemSystem prompt / instructions
userUser message
assistantPrevious assistant response (for multi-turn)

Response (200)

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1717488000,
  "model": "anthropic/claude-sonnet-4-20250514",
  "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
  }
}

Use with OpenAI SDK

Python

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:4200",
    api_key="hzn_sk_a1b2c3d4..."  # or any string if auth is disabled
)

response = client.chat.completions.create(
    model="anthropic/claude-sonnet-4-20250514",
    messages=[
        {"role": "user", "content": "Summarize our claims process."}
    ]
)

print(response.choices[0].message.content)

Node.js

import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'http://localhost:4200',
  apiKey: 'hzn_sk_a1b2c3d4...'
});

const completion = await client.chat.completions.create({
  model: 'anthropic/claude-sonnet-4-20250514',
  messages: [{ role: 'user', content: 'Summarize our claims process.' }]
});

console.log(completion.choices[0].message.content);

curl

curl http://localhost:4200/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "groq/llama-3.1-70b-versatile",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Notes

  • This endpoint routes through the platform's provider system (circuit breakers, rate limiting apply)
  • The model field determines which provider handles the request
  • If model is omitted or empty, the platform's default_model is used
  • Authentication follows the same rules as all other / endpoints
  • This does NOT invoke a specific agent — it's a stateless completion. For agent interaction, use /agents/{id}/send