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

# 快速开始

> 创建 API Key 并完成首次调用

## 1. 注册并创建密钥

在[注册页面](https://api.bianxie.ai/register)创建账户，然后前往 [Key 管理](https://api.bianxie.ai/keys)创建密钥。密钥只展示给需要调用 API 的服务端程序。

## 2. 设置环境变量

```bash theme={null}
export BIANXIE_API_KEY="API_KEY"
```

## 3. 发送请求

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.bianxie.ai/v1/chat/completions \
    -H "Authorization: Bearer $BIANXIE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"model":"your-model","messages":[{"role":"user","content":"你好！"}]}'
  ```

  ```python Python theme={null}
  from openai import OpenAI
  client = OpenAI(base_url="https://api.bianxie.ai/v1", api_key="API_KEY")
  result = client.chat.completions.create(model="your-model", messages=[{"role": "user", "content": "你好！"}])
  print(result.choices[0].message.content)
  ```

  ```javascript Node.js theme={null}
  import OpenAI from "openai";
  const client = new OpenAI({ baseURL: "https://api.bianxie.ai/v1", apiKey: process.env.BIANXIE_API_KEY });
  const result = await client.chat.completions.create({ model: "your-model", messages: [{ role: "user", content: "你好！" }] });
  console.log(result.choices[0].message.content);
  ```
</CodeGroup>

下一步可阅读[流式输出](/zh/streaming)和[错误处理](/zh/errors)。
