> ## Documentation Index
> Fetch the complete documentation index at: https://docs.routerlink.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 快速开始

本指南带您从零开始完成一次 API 调用。完成后您将拥有：

* 一个 RouterLink 账号和 API Key
* 对任意支持模型的一次成功聊天补全请求
* 为您的 Key 设置预算以防止超支

## 1. 创建 API Key

<Steps>
  <Step title="登录">
    访问 [routerlink.ai](https://routerlink.ai)，使用邮箱或 Google 账号登录。
  </Step>

  <Step title="充值 Credits">
    打开 **设置 → 账单**，添加 Credits。
  </Step>

  <Step title="生成 Key">
    前往 [**API Keys**](https://routerlink.ai/settings/api-keys) **→ 创建 Key**。复制该 Key（以 `sk-` 开头，仅显示一次）。
  </Step>
</Steps>

## 2. 发起第一个请求（OpenAI 兼容）

<Tip>
  将 `<ROUTERLINK_API_KEY>` 替换为您的 [RouterLink Key](https://routerlink.ai/settings/api-keys)。
</Tip>

关于可用的 `model` 选项，请查看 [**模型库**](https://routerlink.ai/models)。直接复制模型名称即可使用。

<Tabs>
  <Tab title="Curl">
    ```bash theme={null}
    curl https://router-link.world3.ai/api/v1/chat/completions \
      -H "Authorization: Bearer <ROUTERLINK_API_KEY>" \                                                                                                                    
      -H "Content-Type: application/json" \
      -d '{                                                                                                                                                                
        "model": "world3-router-north-america/openai/gpt-5.3-codex",                                 
        "messages": [                                                                                                                                                      
          {"role": "user", "content": "Say hello in one short sentence."}
        ]                                                                                                                                                                  
      }'                                                        
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from openai import OpenAI                                                                                                                                              
                                                                
    client = OpenAI(
        base_url="https://router-link.world3.ai/api/v1",
        api_key="<ROUTERLINK_API_KEY>",                                                                                                                                    
    )
                                                                                                                                                                           
    resp = client.chat.completions.create(                      
        model="world3-router-north-america/openai/gpt-5.3-codex",
        messages=[{"role": "user", "content": "Say hello in one short sentence."}],                                                                                        
    )
    print(resp.choices[0].message.content)                                                                                                                                 
    ```
  </Tab>

  <Tab title="Node.js">
    ```ts theme={null}
    import OpenAI from "openai";
                                                                                                                                                                           
    const client = new OpenAI({                                 
      baseURL: "https://router-link.world3.ai/api/v1",
      apiKey: process.env.ROUTERLINK_API_KEY,                                                                                                                              
    });
                                                                                                                                                                           
    const resp = await client.chat.completions.create({         
      model: "world3-router-north-america/openai/gpt-5.3-codex",
      messages: [{ role: "user", content: "Say hello in one short sentence." }],                                                                                           
    });
    console.log(resp.choices[0].message.content);                                                                                                                          
    ```
  </Tab>
</Tabs>

## 3. 使用原生 Anthropic SDK

RouterLink 提供 Anthropic 兼容的 Messages 端点，任何官方 [Anthropic 客户端 SDK](https://platform.claude.com/docs/en/api/client-sdks) 只需覆盖 `base_url`（并将 `api_key` 指向您的 RouterLink Key）即可使用。

<Tip>
  Base URL：`https://router-link.world3.ai/api` — SDK 会自动追加 `/v1/messages`。将 `<ROUTERLINK_API_KEY>` 替换为您的 [RouterLink](https://routerlink.ai/settings/api-keys) API Key。
</Tip>

<Tabs>
  <Tab title="Curl">
    ```bash theme={null}
    curl https://router-link.world3.ai/api/v1/messages \
      -H "x-api-key: <ROUTERLINK_API_KEY>" \
      -H "Content-Type: application/json" \                                                                                                                                
      -H "anthropic-version: 2023-06-01" \
      -d '{                                                                                                                                                                
        "model": "anthropic/claude-opus-4-6",                                                                                                                                        
        "max_tokens": 1024,
        "messages": [                                                                                                                                                      
          {"role": "user", "content": "Say hello in one short sentence."}
        ]
      }'                                                                                                                                                                   
    ```
  </Tab>

  <Tab title="Python">
    ```bash theme={null}
    pip install anthropic
    ```

    ```python theme={null}
    import anthropic                                            

    client = anthropic.Anthropic(
        base_url="https://router-link.world3.ai/api",
        api_key="<ROUTERLINK_API_KEY>",
    )                                                                                                                                                                      

    message = client.messages.create(                                                                                                                                      
        model="anthropic/claude-opus-4-6",                                
        max_tokens=1024,
        messages=[{"role": "user", "content": "Say hello in one short sentence."}],
    )                                                                                                                                                                      
    print(message.content[0].text)
    ```
  </Tab>

  <Tab title="Node.js">
    ```bash theme={null}
    npm install @anthropic-ai/sdk
    ```

    ```ts theme={null}
    import Anthropic from "@anthropic-ai/sdk";                  

    const client = new Anthropic({
      baseURL: "https://router-link.world3.ai/api",
      apiKey: process.env.ROUTERLINK_API_KEY,                                                                                                                              
    });
                                                                                                                                                                           
    const message = await client.messages.create({              
      model: "anthropic/claude-opus-4-6",
      max_tokens: 1024,                                                                                                                                                    
      messages: [{ role: "user", content: "Say hello in one short sentence." }],
    });                                                                                                                                                                    
    console.log(message.content);                               
    ```
  </Tab>
</Tabs>

其他官方 SDK（Java、Go、Ruby、C#、PHP）的使用方式相同 — 将 SDK 的 base URL 设置为 `https://router-link.world3.ai/api`，并传入您的 RouterLink Key。

## 4. 查看消费情况

打开 [**设置 → 日志**](https://routerlink.ai/settings/logs) 和 **设置 → 用量**，按模型和 Key 查看请求量、延迟及费用明细。

## 通过第三方客户端发起请求

在使用 Claude Code、Codex 或其他支持 Anthropic 或 OpenAI API 的工具？将其指向 RouterLink 并使用您自己的 Key — 请参阅 [集成指南](https://docs.routerlink.ai/basics/claude-code) 了解端到端配置。
