Gate.AI Documentation

    A unified AI model routing platform. One API key, … models, smart auto-routing.


    Getting Started

    1. Create an API key

    1. Go to gate.ai, choose login method, and authorize
    2. Go to Console → Settings → API keys → Create a key

    2. Auto routing (optional)

    Auto routing is enabled by default. To control it:

    Console → Settings → Routing → Auto routing toggle

    Once enabled, Gate.AI automatically selects the best model for each request. If you prefer to pick models yourself, skip this step and specify models directly (e.g. anthropic/claude-sonnet-4.6).


    Standard Setup

    Fully compatible with the OpenAI API. Supports Python, Node.js, curl, and tools across the ecosystem.

    Replace the Base URL ( https://api.gate.ai/openai/v1 ) and API key to start using it.

    from openai import OpenAI
    
    client = OpenAI(
        api_key="GATEAI_API_KEY",  # get GATEAI_API_KEY from gate.ai (API Key)
        base_url="https://api.gate.ai/openai/v1",
    )
    
    completion = client.chat.completions.create(
        model="auto",
        messages=[
            {"role": "system", "content": "system prompt"},
            {"role": "user", "content": "how are you?"}
        ],
    )
    
    # get the response from LLM (role=assistant)
    print(completion.choices[0].message.content)

    Response example:

    {
        "id": "243c850e-214c-431e-977f-ebaf4aa95f56",
        "choices": [
            {
                "index": 0,
                "message": {
                    "role": "assistant",
                    "content": "Hello! Nice to meet you. How can I help you?"
                },
                "finish_reason": "stop"
            }
        ],
        "created": 1773408946,
        "model": "deepseek.v3-v1:0",
        "object": "chat.completion",
        "usage": {
            "prompt_tokens": 5,
            "completion_tokens": 15,
            "total_tokens": 20
        }
    }

    Cursor Setup

    Prerequisites

    • Cursor is installed
    • You have a Gate.AI API Key

    Step 1: Open Cursor Settings

    Open the top-right menu → Settings.

    Screenshot of the Cursor Settings entry point
    Reference: open Cursor Settings.

    Step 2: Open Models Settings

    In the left sidebar:

    1. Find and open Models
    2. Click View All Models
    3. Scroll to the bottom and click Add Custom Model
    Screenshot of the Cursor Models settings menu
    Reference: open Models settings.
    Screenshot of Add Custom Model in Cursor
    Reference: click Add Custom Model.

    Step 3: Add Configuration

    Fill in the integration information:

    ItemDescription
    Model IDCopy a model ID from the model marketplace, such as deepseek/deepseek-v3.2. Do not use auto.
    OpenAI API KeyTurn on the switch and enter your Gate.AI API Key.
    OpenAI Base URLTurn on the switch and enter https://api.gate.ai/openai/v1.
    Screenshot of API Key and Base URL settings in Cursor
    Reference: enter API Key and Base URL.

    Step 4: Save and Close Settings

    After finishing the configuration, save it and close Settings.

    Step 5: Use Gate.AI in Cursor

    In Chat, Composer, Agent, and other conversation surfaces, search for or choose the model you just added from the model selector.

    Screenshot of the Cursor model selector
    Reference: choose the model you just added from the model selector.

    FAQ

    SymptomFix
    401 / Connection failedConfirm the Base URL is https://api.gate.ai/openai/v1, the API Key is valid, and the account has available balance.
    Model unavailableConfirm the model ID comes from the model marketplace, uses the provider/model format, and is not auto.
    Model not found in the listConfirm the Settings page was saved; restart Cursor and try again.

    Claude Code Setup

    If you already have Claude Code (Anthropic's terminal / IDE coding assistant) installed, follow these steps to connect Gate.AI.

    1. Create a Gate.AI API key

    1. Go to Dashboard → Settings → API Keys and create a key.
    2. Copy the key that starts with sk-or-v1- and use it to replace the placeholders below.
    3. For auto routing: go to Dashboard → Settings → Routing and enable Auto routing. When it is off, specify a model ID explicitly in each request.

    2. Configure Anthropic Base URL and API key

    Claude Code reads environment variables. We recommend following the official LLM gateway documentation and setting:

    VariableValue
    ANTHROPIC_BASE_URLhttps://api.gaterouter.ai/anthropic
    ANTHROPIC_API_KEYYour Gate.AI API key (sk-or-v1-…)

    Option A: Current terminal session (temporary)

    export ANTHROPIC_BASE_URL="https://api.gaterouter.ai/anthropic"
    export ANTHROPIC_API_KEY="sk-or-v1-xxxxxxxxxxxxxxxx"
    claude

    Option B: Shell profile

    Append the following to ~/.zshrc or ~/.bashrc:

    export ANTHROPIC_BASE_URL="https://api.gaterouter.ai/anthropic"
    export ANTHROPIC_API_KEY="sk-or-v1-xxxxxxxxxxxxxxxx"

    After running source ~/.zshrc (or opening a new terminal), run claude.

    Option C: Claude Code settings.json (recommended)

    In user-level or project-level configuration, add an env block (see Claude Code settings for paths), for example in your project directory .claude/settings.json:

    {
      "env": {
        "ANTHROPIC_BASE_URL": "https://api.gaterouter.ai/anthropic",
        "ANTHROPIC_API_KEY": "sk-or-v1-xxxxxxxxxxxxxxxx"
      }
    }

    Security note: Do not commit real keys to a public repository; use your OS secret store or CI secret injection, and keep local secrets in environment variables only.

    Bypass the gateway and use Anthropic directly

    To temporarily skip the gateway:

    env -u ANTHROPIC_BASE_URL -u ANTHROPIC_API_KEY claude

    (You must already have Anthropic official credentials or another default provider configured.)

    3. Configure models (Gate.AI model IDs)

    In Gate.AI docs, model IDs look like provider/model-name (for example anthropic/claude-sonnet-4.6). They are not identical to Claude Code built-in aliases such as sonnet. Pick one approach:

    3.1 Default model via environment variable

    export ANTHROPIC_MODEL="anthropic/claude-sonnet-4.6"

    Or add the same key under env in settings.json.

    3.2 Alias mapping

    Map aliases to Gate.AI model IDs (Sonnet example):

    export ANTHROPIC_DEFAULT_SONNET_MODEL="anthropic/claude-sonnet-4.6"
    export ANTHROPIC_DEFAULT_OPUS_MODEL="anthropic/claude-opus-4.6"
    export ANTHROPIC_DEFAULT_HAIKU_MODEL="anthropic/claude-haiku-4.5"

    Use the Gate.AI docs — Models list as the source of truth for IDs.

    3.3 Custom entry in /model

    To pick a gateway-backed model in the UI, use Claude Code's custom model option (see the official Model configuration - ANTHROPIC_CUSTOM_MODEL_OPTION):

    export ANTHROPIC_CUSTOM_MODEL_OPTION="anthropic/claude-sonnet-4.6"
    export ANTHROPIC_CUSTOM_MODEL_OPTION_NAME="Sonnet (Gate.AI)"

    3.4 Auto-routing model auto

    If auto routing is enabled in the dashboard, you can try setting ANTHROPIC_MODEL to auto (same meaning as auto on the OpenAI setup page). If you see errors, switch back to an explicit model ID such as anthropic/claude-sonnet-4.6.

    4. Verify the setup

    1. In a terminal with the environment configured, run:
    claude
    1. After the session starts, send a simple prompt, for example: In one sentence, introduce yourself.

    2. If you get a normal reply with no auth or routing errors, requests are reaching Gate.AI and the selected model is responding.

    5. FAQ

    SymptomLikely causeWhat to try
    401 / auth failureWrong API key or env not exportedCheck ANTHROPIC_API_KEY matches the dashboard key
    404 on URLBase URL points at the OpenAI pathUse https://api.gaterouter.ai/anthropic
    Model missing / routing errorBad model ID or model not allowedCompare with the Models table; check routing and allow lists in the dashboard
    Still hitting Anthropic directlyEnv vars not appliedConfirm settings.json scope; in a new shell run echo $ANTHROPIC_BASE_URL to verify

    Claude Desktop Setup

    Prerequisites

    Step 1: Enable Developer Mode

    1. Launch Claude Desktop. You do not need to sign in with an Anthropic account.
    2. From the menu bar, choose Help → Troubleshooting → Enable Developer Mode.
    Screenshot showing the Enable Developer Mode menu item in Claude Desktop
    Reference: enable Developer Mode from Help → Troubleshooting.

    After enabling it, the Developer menu appears in the menu bar.

    Screenshot showing the Developer menu in Claude Desktop
    Reference: the Developer menu appears after Developer Mode is enabled.

    Step 2: Open Third-Party Inference Settings

    From the menu bar, choose Developer → Configure Third-Party Inference…

    Screenshot showing the Configure Third-Party Inference menu item in Claude Desktop
    Reference: open Configure Third-Party Inference from the Developer menu.

    Step 3: Enter Gate.AI Credentials and Models

    1. Choose Gateway and Static API key, then enter your Gate.AI credentials.
      After filling them in, click Test connection to test the connection.
    Screenshot of Gateway and Static API key configuration in Claude Desktop
    Reference: enter Gateway and Static API key configuration.
    1. Turn on Model discovery.
      After enabling it, you can click Test connection again.
    Screenshot of the Model discovery switch in Claude Desktop
    Reference: turn on Model discovery.
    1. Click Apply Changes to save.

    Step 4: Restart and Launch

    1. Fully quit Claude Desktop, including the app process, then reopen it.
    2. On the launch page, choose Continue with Gateway. No Anthropic account is required.

    Step 5: Verify

    The connection is successful when the model picker shows available models.

    FAQ

    SymptomFix
    Connection failed / 401Confirm the Base URL is https://api.gate.ai/anthropic/, Auth scheme is x-api-key, and the API key is valid.
    Continue with Gateway does not appearConfirm you clicked Apply Changes and fully quit and restarted Claude Desktop.
    No models are shownConfirm your Gate.AI account has available balance, and check that Model discovery is enabled.

    Hermes Setup

    Prerequisites

    • Create an API key in the Gate.AI Console.
    • If you use auto routing, enable it under Settings → Routing in the console.

    Option 1: Terminal setup

    1. Choose model and custom endpoint

    Run in your terminal:

    hermes model

    In the menu, choose Custom endpoint and fill in the fields:

    ItemValue
    API base URLhttps://api.gate.ai/openai/v1
    API keyYour Gate.AI API key
    Modelauto (recommended for auto routing), or the full model ID from the console (e.g. deepseek/deepseek-v3.2)

    If you are asked for context length, press Enter to leave it blank (Hermes will detect it).

    2. (Optional) Local web dashboard

    To edit configuration in the browser, run:

    hermes dashboard

    3. Verify

    hermes chat "Hello"

    Success means the request reached Gate.AI and smart routing or your chosen model returned a result.

    You can also run hermes doctor to verify the connection.

    Option 2: Edit configuration files

    1. File locations

    macOS / Linux

    • ~/.hermes/config.yaml, main config (model, provider, base_url, api_key, etc.)
    • ~/.hermes/.env, secrets and env vars (recommended)

    Windows

    • C:\Users\<username>\.hermes\config.yaml
    • C:\Users\<username>\.hermes\.env

    2. Save the API key in .env (pick one)

    Option A (same name as Gate.AI)

    # Gate.AI API 密钥
    GATEAI_API_KEY=sk-or-v1_xxxxxxxxxxxxxxxxxxxxx

    Option B (common Hermes custom-endpoint convention)

    If model.api_key is not set for a custom endpoint, Hermes falls back to OPENAI_API_KEY. Put your Gate.AI key there:

    OPENAI_API_KEY=sk-or-v1_xxxxxxxxxxxxxxxxxxxxx

    3. Configure model in config.yaml

    Auto routing (auto)

    model:
      default: auto
      provider: custom
      base_url: https://api.gate.ai/openai/v1
      api_key: ${GATEAI_API_KEY}

    If you use Option B, leave api_key blank or remove it so Hermes uses OPENAI_API_KEY.

    Hermes expands ${VAR} when loading config (variables must exist in the environment, usually from ~/.hermes/.env).

    Fixed model example

    The model ID must match the Gate.AI model list.

    model:
      default: deepseek/deepseek-v3.2
      provider: custom
      base_url: https://api.gate.ai/openai/v1
      api_key: ${GATEAI_API_KEY}

    4. Verify after saving

    After saving, run hermes chat "Hello" to verify the Gate.AI connection.

    Multiple routes / models

    If you need multiple logical routes under one Gate.AI key (e.g. one with auto and one fixed to deepseek/deepseek-v3.2), add custom_providers in config.yaml (names: letters, digits, hyphens; e.g. gateai-auto):

    model:
      default: auto
      provider: custom
      base_url: https://api.gate.ai/openai/v1
      api_key: ${GATEAI_API_KEY}
    
    custom_providers:
      - name: gateai-auto
        base_url: https://api.gate.ai/openai/v1
        api_key: ${GATEAI_API_KEY}
        model: auto
    
      - name: gateai-deepseek
        base_url: https://api.gate.ai/openai/v1
        api_key: ${GATEAI_API_KEY}
        model: deepseek/deepseek-v3.2

    How to switch

    1. Terminal: run hermes model again and pick the named route or Custom endpoint.
    2. In chat (TUI): use the /model syntax from the Hermes docs, for example:
    /model custom:gateai-auto:auto
    /model custom:gateai-deepseek:deepseek/deepseek-v3.2

    (Names follow custom_providers[].name; format is custom:<profile name>:<model id>.)

    FAQ

    Only some models work

    Confirm model.provider is custom, and Base URL is https://api.gate.ai/openai/v1. If OpenAI-compatible models work but others do not, check model IDs and routing settings.

    401 / invalid API key

    Check the key is copied correctly and not expired; after editing .env, restart running hermes and hermes gateway before retrying.

    Model not found or empty reply

    • Model ID matches the console (e.g. deepseek/deepseek-v3.2).
    • Auto routing is enabled in the Gate.AI console.
    • Run hermes doctor to inspect config and connectivity.

    QClaw Setup

    If you already have QClaw installed, follow these steps to connect Gate.AI.

    Configure in chat

    1. In the chat, send the message below. Replace the apiKey value with your Gate.AI API key.

    Help me add a new provider
    Name: Gate.AI
    apiKey: sk-or-v1-xxxxxxxxxxxxxxxx
    baseUrl: https://api.gate.ai/openai/v1
    Model: auto

    QClaw will add the provider and restart automatically.

    2. Verify

    Ask: “Help me verify that my Gate.AI configuration is working.” The assistant should reply with something like “Gate.AI provider was added successfully!” (exact wording may vary.)

    3. Switch to Gate.AI

    Ask: “Switch to auto under Gate.AI.” The assistant should reply with something like “Switched successfully!” (exact wording may vary.)


    AutoClaw Setup

    1. Open the configuration entry

    Click Preferences in the bottom-left, go to Models & API, then click Add custom model.

    2. Add a model

    • Set the provider to Custom.
    • Enter a Gate.AI-supported model ID, e.g. deepseek/deepseek-v3.2.
    • Enter a display name, e.g. Gate.AI(deepseek-v3.2).
    • Enter your API Key, e.g. sk-or-v1-xxxxxxxxxxxxxxxx.
    • Base URL: https://api.gate.ai/openai/v1

    3. Test the configuration

    Click the connection test. If you see “Test successful”, the setup is correct.

    4. Use the model

    • Click Add. After it saves, return to the app.
    • Below the chat input, switch the model to your configured Gate.AI(deepseek-v3.2) to use it.

    API Reference

    General Chat API Reference

    FieldValue
    Base URLhttps://api.gate.ai/openai/v1
    AuthAuthorization: Bearer <API_KEY>
    FormatOpenAI-compatible
    PricingPay-as-you-go

    Note: The API path is /openai/v1 (not /v1).

    Endpoints

    MethodPathDescription
    POST/chat/completionsChat completions (streaming supported)
    GET/modelsList available models

    Seedance Video Generation API Reference

    FieldValue
    Base URLhttps://api.gate.ai
    AuthAuthorization: Bearer <API_KEY>

    Submit Video Task

    POST/api/v1/videos

    Submit an async video generation job. Returns 202 Accepted with job_id for polling. Pass Idempotency-Key for safe retries.

    Request Parameters

    NameInTypeRequiredDescription
    AuthorizationheaderstringYesGate.AI API Key. Format: Bearer <API_KEY>
    Content-TypeheaderstringYesRequest body format
    Idempotency-KeyheaderstringNoIdempotency key for safe retries — same key returns the existing job

    Request Body

    NameTypeRequiredDescription
    modelstringYesModel ID, use bytedance/seedance-2.0
    promptstringYesVideo prompt; describe subject, motion, scene, camera, and style
    durationintegerNoDuration in seconds: 4–15
    resolutionstringNoOutput resolution: 480p, 720p, or 1080p
    aspect_ratiostringNoAspect ratio: 16:9, 4:3, 1:1, 3:4, 9:16, 21:9, or adaptive
    generate_audiobooleanNoWhether to generate audio
    seedintegerNoRandom seed, -1 to 4294967295; same seed does not guarantee identical output
    sizestringNoExact output size, e.g. 1280x720
    metadataobjectNoBusiness pass-through fields for auditing or source tagging
    webhook_urlstringNoCallback URL invoked when the task completes or fails

    Example

    {
      "model": "bytedance/seedance-2.0",
      "prompt": "A golden retriever running on a sunny beach, cinematic camera movement",
      "duration": 6,
      "resolution": "720p",
      "aspect_ratio": "16:9",
      "generate_audio": false,
      "seed": -1,
      "metadata": {
        "source": "playground"
      },
      "webhook_url": "https://example.com/webhooks/gateai-video"
    }

    Response Fields

    NameTypeDescription
    job_idstringUnique job ID
    statusstringTask status: pending / in_progress / completed / failed
    modelstringModel used
    status_urlstringURL to poll task status
    messagestringServer message
    current_balancestringCurrent account balance (USD)
    estimated_coststringEstimated cost
    pre_deduct_amountstringPre-deducted display amount
    balance_after_estimatestringBalance after applying estimated cost
    currencystringCurrency, currently USD
    billing_noticestringBilling notice

    Response Example

    {
      "code": 200,
      "msg": "",
      "data": {
        "job_id": "video_abc123",
        "status": "in_progress",
        "model": "bytedance/seedance-2.0",
        "status_url": "https://api.gate.ai/api/v1/videos/video_abc123",
        "message": "视频任务已提交,请调用 status_url 查询生成进度。",
        "current_balance": "100.0000000000",
        "estimated_cost": "1.0800000000",
        "pre_deduct_amount": "1.0800000000",
        "balance_after_estimate": "98.9200000000",
        "currency": "USDT",
        "billing_notice": "视频生成完成后按实际任务结果扣款,提交后请保持余额充足。"
      }
    }

    Response

    StatusMeaningDescriptionSchema
    202AcceptedTask accepted and queued. Returns job_id for status polling.VideoSubmitResponse
    400Bad RequestParameter errorErrorResponse
    401UnauthorizedNot logged in or token invalidErrorResponse
    402Payment RequiredInsufficient balance. Response includes estimated cost and current balance.ErrorResponse
    429Too Many RequestsToo many requests. Please slow down.ErrorResponse
    500Internal Server ErrorInternal server errorErrorResponse

    Query Task Status

    GET/api/v1/videos/{job_id}

    Poll job status, progress, and billing info. Returns download_url when status is completed.

    Request Parameters

    NameInTypeRequiredDescription
    job_idpathstringYesVideo task ID
    AuthorizationheaderstringYesGate.AI API Key. Format: Bearer <API_KEY>

    Response Fields

    NameTypeDescription
    job_idstringUnique job ID
    statusstringTask status: pending / in_progress / completed / failed
    modelstringModel used
    status_urlstringURL to poll task status
    download_urlstringVideo download URL (appears when status is completed)
    durationintegerVideo duration in seconds
    resolutionstringOutput resolution
    aspect_ratiostringAspect ratio
    generate_audiobooleanWhether audio is included
    estimated_coststringEstimated cost
    billed_coststringActual billed amount
    billing_statusstringBilling status: pre_deducted or settled
    expires_atstring(ISO 8601)Video file expiration time
    created_atstring(ISO 8601)Task creation time
    completed_atstring(ISO 8601)Task completion time

    Response Example

    {
      "code": 200,
      "msg": "",
      "data": {
        "job_id": "video_abc123",
        "status": "completed",
        "model": "bytedance/seedance-2.0",
        "status_url": "https://api.gate.ai/api/v1/videos/video_abc123",
        "download_url": "https://api.gate.ai/api/v1/videos/video_abc123/content",
        "duration": 6,
        "resolution": "720p",
        "aspect_ratio": "16:9",
        "generate_audio": false,
        "estimated_cost": "1.0800000000",
        "billed_cost": "1.0800000000",
        "billing_status": "settled",
        "expires_at": "2026-06-26T05:00:00Z",
        "created_at": "2026-05-27T05:00:00Z",
        "completed_at": "2026-05-27T05:03:00Z"
      }
    }

    Response

    StatusMeaningDescriptionSchema
    200OKSuccessVideoStatusResponse
    401UnauthorizedNot logged in or token invalidErrorResponse
    404Not FoundJob not found, or job does not belong to this API key.ErrorResponse
    500Internal Server ErrorInternal server errorErrorResponse

    Download Video

    GET/api/v1/videos/{job_id}/content

    Authenticate and redirect (302) to the temporary video file URL.

    Request Parameters

    NameInTypeRequiredDescription
    job_idpathstringYesVideo task ID
    AuthorizationheaderstringYesGate.AI API Key. Format: Bearer <API_KEY>

    Response Example

    HTTP/1.1 302 Found
    Location: https://cdn.example.com/videos/video_abc123.mp4?expires=1780000000

    Response

    StatusMeaningDescriptionSchema
    302FoundRedirects to temporary video download URL.
    401UnauthorizedNot logged in or token invalidErrorResponse
    404Not FoundJob not found, or job does not belong to this API key.ErrorResponse
    409ConflictTask not yet completed; video is not available for download.ErrorResponse
    410GoneVideo content has expired and is no longer available.ErrorResponse
    500Internal Server ErrorInternal server errorErrorResponse

    Models

    Model IDDescriptionUse Case
    openai/gpt-5.2OpenAI latestReasoning tasks
    openai/gpt-5OpenAI general-purpose flagshipGeneral purpose
    openai/gpt-5-miniOpenAI lightweightGeneral / cost optimization
    openai/gpt-5-nanoOpenAI ultra low costSimple tasks
    openai/gpt-4.1OpenAI stableGeneral purpose
    openai/gpt-4.1-nanoOpenAI lightweight stableSimple tasks
    anthropic/claude-opus-4.6Anthropic's most capableComplex reasoning
    anthropic/claude-sonnet-4.6Anthropic balancedGeneral purpose
    anthropic/claude-sonnet-4.5Anthropic previous genGeneral purpose
    anthropic/claude-haiku-4.5Anthropic fastSimple tasks
    google/gemini-3.1-proGoogle latest flagshipLong context / reasoning
    google/gemini-2.5-proGoogle previous gen flagshipLong context
    deepseek/deepseek-v3.2DeepSeek latestCost-effective
    deepseek/deepseek-v3.1DeepSeek previous genGeneral purpose
    x-ai/grok-4xAI latest flagshipReasoning / real-time info
    x-ai/grok-4.1-fastxAI high-speedFast response
    moonshotai/kimi-k2.5Moonshot strong long-contextLong context
    z-ai/glm-5Z.ai latestGeneral purpose
    z-ai/glm-5-turboCoding & reasoningMulti-scenario
    z-ai/glm-4.7-flashZ.ai fast tierSimple tasks
    minimax/minimax-m2.5MiniMax multimodalGeneral purpose

    Model ID format: provider/model-name. Version numbers use . (e.g. 4.6), not -.

    For more models, visit the Models page.


    Troubleshooting

    Authentication Errors

    Error messageHTTP statusCauseSolution
    invalid api key401The API Key is invalid, expired, revoked, or disabledGo to Console → API Keys and confirm the key status is "active". If it has expired, generate a new one

    Routing and Model Errors

    Error messageHTTP statusCauseSolution
    no model config found for: {model}404The requested model ID does not existOpen the model list and confirm the model ID is spelled correctly
    model field is required400The request body is missing the model fieldAdd "model": "model name" to the request JSON
    invalid or empty requested model400The requested model name is empty or invalidOpen the model list and confirm you are using the correct model ID format
    unknown api path404The API path is incorrectConfirm the Base URL is https://api.gate.ai/openai/v1 or https://api.gate.ai/anthropic

    Request Parameter Errors

    Error messageHTTP statusCauseSolution
    invalid JSON body400The request body is not valid JSONCheck that the request body is valid JSON
    failed to read request body400The request body could not be readConfirm the body is not corrupted and Content-Type is set to application/json
    failed to rewrite request body500Failed to rewrite the request body inside the gatewayRetry. If it keeps happening, contact technical support
    images are not supported by this model400The target model does not support image inputSwitch to a multimodal model that supports images, such as gpt-4o
    audio is not supported by this model400The target model does not support audio inputSwitch to a model that supports audio input
    unsupported parameter: max_tokens400Some models do not support the max_tokens parameterUse max_completion_tokens instead

    Quota and Rate Limit Errors

    Error messageHTTP statusCauseSolution
    api key budget quota exceeded429The API Key budget has been exhaustedGo to Console → API Keys → Budget settings, increase the budget, or wait for the quota to reset
    guardrail budget limit exceeded429The guardrail budget limit has been exceededCheck the budget limit in guardrail settings, then increase the limit or reduce usage frequency
    organization guardrail budget limit exceeded429The organization-level guardrail budget has been exceededContact an organization admin to adjust the organization-level budget limit
    model not allowed by guardrail policy403The model is not allowed by the guardrail policyGo to Console → Guardrails and add the target model to the allowlist
    The free model usage has reached its daily global limit today.429The global daily limit for the free model has been reachedWait for the next daily reset, or upgrade to a paid plan for unrestricted models
    The free model usage has reached its daily limit today.429Your personal daily limit for the free model has been reachedWait for the next daily reset, or upgrade to a paid plan
    Guest daily spending limit exceeded. Please try again tomorrow or upgrade to a paid plan.429The guest daily spending limit has been exceededRegister an account and upgrade to a paid plan, or wait for the next daily reset

    Billing and Balance Errors

    Error messageHTTP statusCauseSolution
    Pending payment {amount} USD — Please top up...402The account balance is insufficient and has an outstanding paymentTop up with Gate Pay
    Insufficient balance and account in debt402The balance is insufficient and the account is in debtTop up with Gate Pay
    billing model info not found for model "{model}"400Billing information for the model does not existConfirm the model ID is correct. If it is a new model, contact technical support to configure billing rules
    billing model info is ambiguous for model "{model}"400Billing information is ambiguous because multiple records matchContact technical support to check the model billing configuration
    billing configuration error500Billing rules are misconfigured on the serverContact technical support to fix the billing configuration

    Upstream Service Errors

    Error messageHTTP statusCauseSolution
    bad gateway502The gateway failed to communicate with the upstream serviceRetry. If it keeps happening, check the service status page or contact technical support
    upstream service unavailable502The upstream AI Provider is unavailableRetry later, or switch to another available model
    upstream service error502The upstream AI Provider returned an errorCheck whether the request parameters match the target model requirements. If it keeps happening, contact technical support
    request timeout504The upstream request timed outReduce the input length or increase the timeout, then retry
    no provider handler configured for protocol502No protocol handler is configured in the gatewayContact technical support to check the gateway configuration

    Server Internal Errors

    Error messageHTTP statusCauseSolution
    internal server error500Internal gateway errorRetry. If it keeps happening, contact technical support with the Request ID
    failed to record request log500Failed to record the request logThis does not affect the request result and can be ignored. Contact technical support if it happens frequently
    failed to list models500Failed to query the model listRetry. If it keeps happening, contact technical support

    Common Quick Checks

    Incorrect Base URL

    # ❌ Incorrect
    https://api.gate.ai/v1/chat/completions
    
    # ✅ Correct
    https://api.gate.ai/openai/v1/chat/completions  # OpenAI protocol
    https://api.gate.ai/anthropic/v1/messages  # Anthropic protocol

    Incompatible max_tokens Parameter

    // ❌ Some models do not support this
    { "model": "gpt-4o", "max_tokens": 100 }
    
    // ✅ Use max_completion_tokens
    { "model": "openai/gpt-5.5", "max_completion_tokens": 100 }

    API Key Format

    # ✅ Correct request headers
    Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxx # OpenAI protocol
    X-api-key: sk-xxxxxxxxxxxxxxxxxxxx # Anthropic protocol