Skip to main content
POST
/
v1
/
chat
/
completions
curl -X POST https://api.tzafon.ai/v1/chat/completions \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tzafon.sm-1",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Hello!"}
    ],
    "temperature": 0.7,
    "max_tokens": 1024
  }'
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1705408200,
  "model": "tzafon.sm-1",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 9,
    "total_tokens": 34
  }
}
New
This endpoint is OpenAI SDK compatible. Use the standard OpenAI SDK with base_url="https://api.tzafon.ai/v1".

Request Body

model
string
required
Model ID: tzafon.sm-1 or tzafon.northstar.cua.sft
messages
array
required
Conversation messages
temperature
number
default:"1.0"
Sampling temperature (0-2). Lower = more deterministic.
max_tokens
integer
Maximum tokens to generate
stream
boolean
default:"false"
Enable streaming responses
stop
array
Stop sequences to end generation

Response

id
string
Completion ID
object
string
chat.completion
model
string
Model used
choices
array
Completion choices
usage
object
Token usage
curl -X POST https://api.tzafon.ai/v1/chat/completions \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tzafon.sm-1",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Hello!"}
    ],
    "temperature": 0.7,
    "max_tokens": 1024
  }'
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1705408200,
  "model": "tzafon.sm-1",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 9,
    "total_tokens": 34
  }
}

Streaming

Enable stream: true to receive Server-Sent Events:
stream = client.chat.completions.create(
    model="tzafon.sm-1",
    messages=[{"role": "user", "content": "Write a poem"}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Pricing

ModelInputOutput
tzafon.sm-1$0.20/1M tokens$0.30/1M tokens
tzafon.northstar.cua.sft$0.30/1M tokens$1.00/1M tokens