Skip to main content

Chat Completions

POST https://gateway.primexos.com/v1/chat/completions

The OpenAI-compatible chat endpoint. Works with the OpenAI SDKs and any tool that targets /v1/chat/completions.

OpenAI-compatible

Accepts the standard OpenAI Chat Completions parameters. Primex differences: authenticate with your prx- key (Authorization: Bearer prx-… or x-api-key), set model to a Primex model ID, and see Errors & Limits for status codes.

Additional text models​

GLM 5.3, GLM 5.2 Fast, Nemotron 3 Ultra, GLM 5.3 Flash, Nemotron Lightning 3.5 and MiniMax M3 use this endpoint for text chat, streaming and function tools. New additions remain Coming Soon until billing checks are complete; check Models or the live catalogue before selecting one. Image and audio inputs and custom reasoning controls are unavailable. Reasoning tokens are included in output usage, and cached input uses the model's published cached-input rate. Context limits describe the model; individual requests must also fit the current token rate limit.

Request​

curl https://gateway.primexos.com/v1/chat/completions \
-H "Authorization: Bearer prx-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"messages": [
{"role": "system", "content": "You are concise."},
{"role": "user", "content": "What is Primex?"}
],
"temperature": 0.7
}'

Streaming​

Set "stream": true to receive server-sent events (data: chunks ending with data: [DONE]):

stream = client.chat.completions.create(
model="gpt-5.5",
messages=[{"role": "user", "content": "Write a haiku."}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")

Streamed responses are billed the same way as non-streamed ones, and Primex's broken-stream guard ensures a stream that dies carrying only a provider error does not charge you. See Billing.

Tool / function calling​

Standard OpenAI tools / tool_choice are supported and forwarded to the model.

{
"model": "gpt-5.5",
"messages": [{"role": "user", "content": "Weather in Paris?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
}]
}

Response​

{
"id": "chatcmpl-…",
"object": "chat.completion",
"model": "gpt-5.5",
"choices": [{
"index": 0,
"message": {"role": "assistant", "content": "Primex is an AI gateway…"},
"finish_reason": "stop"
}],
"usage": {"prompt_tokens": 21, "completion_tokens": 14, "total_tokens": 35}
}

Billing is metered from the usage token counts. See Models for per-model rates.