Token Kiosk
API Reference

Chat Completions

OpenAI-compatible inference endpoint (streaming + non-streaming).

POST /v1/chat/completions

OpenAI-compatible. Requires Authorization: Bearer <api-key>.

curl -X POST https://agent-router.gaib.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini/gemini-2.5-flash",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Hello!"}
    ],
    "max_tokens": 512
  }'
import OpenAI from 'openai'

const client = new OpenAI({
  baseURL: 'https://agent-router.gaib.ai/v1',
  apiKey: 'sk-your-key',
})

const res = await client.chat.completions.create({
  model: 'gemini/gemini-2.5-flash',
  messages: [{ role: 'user', content: 'Hello!' }],
  max_tokens: 512,
})
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "choices": [{
    "index": 0,
    "message": { "role": "assistant", "content": "Hello! How can I help?" },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 20,
    "completion_tokens": 9,
    "total_tokens": 29
  }
}

Request body

FieldTypeRequiredDefaultDescription
modelstringyesModel ID (e.g. gemini/gemini-2.5-flash)
messagesarrayyesArray of {role, content} objects
max_tokensnumberno1024Max completion tokens
temperaturenumbernoSampling temperature
top_pnumbernoNucleus sampling
streambooleannofalseEnable SSE streaming
toolsarraynoOpenAI-style tool/function definitions
tool_choicestring / objectnoTool selection control

Other standard OpenAI fields — stop, presence_penalty, frequency_penalty, response_format, seed, n, logprobs — are also accepted and forwarded to the provider.

Not supported

Requests with thinking or reasoning_effort parameters return HTTP 400. Strip these fields before calling the gateway.

Streaming

Set "stream": true. The response is standard OpenAI SSE:

data: {"id":"chatcmpl-...","choices":[{"delta":{"content":"Hello"}}]}

data: {"id":"chatcmpl-...","choices":[{"delta":{"content":"!"}}]}

data: [DONE]

On this page