CostIQDocs

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/v1

Append /models or /chat/completions. Do not append another /v1.

Authentication

Send the key in the standard bearer header on every request.

HTTP header
Authorization: Bearer $COSTIQ_API_KEY

Missing, invalid, expired, or revoked credentials return 401.

GET/v1/models

List models

Returns only the stable model aliases allowed for the supplied key.

Example response
{
  "object": "list",
  "data": [
    {
      "id": "general-fast",
      "object": "model"
    }
  ]
}
POST/v1/chat/completions

Create a chat completion

Send a JSON object with a permitted model alias and a conversation.

FieldTypeRequiredDescription
modelstringYesUse general-fast.
messagesarrayYesOrdered role and content messages.
streambooleanNoStreams SSE when true.
Request body
{
  "model": "general-fast",
  "messages": [
    {"role": "system", "content": "Be concise."},
    {"role": "user", "content": "What is CostIQ?"}
  ],
  "stream": false
}
Representative response
{
  "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.