Chat Completions
POST https://api.makahai.com/v1/chat/completions
Every model on Makahai accepts the OpenAI Chat Completions format. Use the official OpenAI SDK with base_url set to https://api.makahai.com/v1, or send the request directly.
Request
curl https://api.makahai.com/v1/chat/completions \
-H "Authorization: Bearer $MAKAHAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"messages": [
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Summarize zero-trust networking in two sentences."}
],
"max_tokens": 512
}'
| Field | Notes |
|---|---|
model |
A model ID from the model catalog, for example gpt-6-sol or kimi-k3. |
messages |
The conversation, in the OpenAI message format. |
max_tokens |
Optional. Caps the output. It also caps the cost Makahai reserves before the call (see Billing). |
stream |
Optional. Set to true to receive the response as server-sent events. |
Other parameters follow the OpenAI format. Some models restrict them; see Model notes.
Streaming
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.makahai.com/v1", api_key=os.environ["MAKAHAI_API_KEY"])
stream = client.chat.completions.create(
model="gpt-6-sol",
messages=[{"role": "user", "content": "Write a haiku about latency."}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")
Switching models
Change the model string. The request format stays the same across providers, so you can compare models without changing code.
Before each call
Makahai reserves the most the request could cost from your balance before forwarding it. If your balance and credit line can’t cover it, or the key has reached its spend limit, the request is refused and nothing is sent to the model provider. See Billing.