Quick Start

This page is for ZAI Router (AI API Router service available with online signup). For a multi-tenant BYOK AI API Router, visit the sister product ZAI Control.

1. Sign up and get your ZAI API Key

  1. Register at m.zairouter.com.
  2. Verify your email and activate your account.
  3. Check your email for the ZAI API Key automatically created by the system.

2. Configure the Base URL

Update your SDK/application base_url to ZAI Router’s Base URL:

  • Base URL: https://api.zairouter.com

3. Send your first request (main protocol examples)

# Replace YOUR_XAI_API_KEY with your own key
export XAI_API_KEY="sk-xxxx"

3.1 OpenAI Responses API

curl https://api.zairouter.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -d '{
    "model": "gpt-5.3-codex",
    "input": "Hello, ZAI Router! Introduce yourself in one sentence."
  }'

3.2 OpenAI Chat Completions API

curl https://api.zairouter.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -d '{
      "model": "gpt-5.3-codex",
      "messages": [
        {
          "role": "user",
          "content": "Hello, ZAI Router! Introduce yourself in one sentence."
        }
      ]
    }'

3.3 Claude API

curl https://api.zairouter.com/v1/messages \
  -H "Content-Type: application/json" \
  -H "x-api-key: $XAI_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "claude-opus-4-6",
    "max_tokens": 1024,
    "messages": [
      {
        "role": "user",
        "content": "Hello, Claude! Introduce yourself in one sentence."
      }
    ]
  }'

3.4 Gemini API

curl -X POST "https://api.zairouter.com/v1beta/models/gemini-3-flash-preview:generateContent" \
  -H "x-goog-api-key: $XAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "parts": [
          {
            "text": "Hello, Gemini! Introduce yourself in one sentence."
          }
        ]
      }
    ]
  }'

4. Usage & billing

At m.zairouter.com, you can view:

  • Real-time usage and model-level consumption
  • Billing and top-up history
If you need full key ownership and multi-tenant governance, choose ZAI Control.