Build
API reference
CostIQ v1 exposes model discovery and OpenAI-compatible chat completions. All public requests use HTTPS and bearer authentication.
Base URL
https://inference.costiq.xyz/v1Append /models or /chat/completions. Do not append another /v1.
Authentication
Send the key in the standard bearer header on every request.
Authorization: Bearer $COSTIQ_API_KEYMissing, invalid, expired, or revoked credentials return 401.
/v1/modelsList models
Returns only the stable model aliases allowed for the supplied key.
{
"object": "list",
"data": [
{
"id": "general-fast",
"object": "model"
}
]
}/v1/chat/completionsCreate a chat completion
Send a JSON object with a permitted model alias and a conversation.
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Use general-fast. |
messages | array | Yes | Ordered role and content messages. |
stream | boolean | No | Streams SSE when true. |
{
"model": "general-fast",
"messages": [
{"role": "system", "content": "Be concise."},
{"role": "user", "content": "What is CostIQ?"}
],
"stream": false
}{
"id": "chatcmpl_...",
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 18,
"total_tokens": 42
}
}Token values and optional fields vary by response. Treat usage fields as accounting metadata, not a billing invoice.
Streaming
With stream: true, the response content type is text/event-stream. Read each data: frame in order and stop after [DONE]. A concurrency slot remains occupied until the stream closes.
Protected policy fields
Routing, fallback, retry, provider, identity, tags, and metadata controls are owned by CostIQ. Requests that attempt to override them return 400.