# 各平台大模型 API Key 申请指南

> 文档版本：v1.0 | 更新日期：2026年4月8日

---

## 目录

1. [智谱 AI（GLM 系列）](#1-智谱-aiglm-系列)
2. [阿里云百炼（通义千问 / Qwen 系列）](#2-阿里云百炼通义千问--qwen-系列)
3. [百度千帆（文心一言 / ERNIE 系列）](#3-百度千帆文心一言--ernie-系列)
4. [DeepSeek](#4-deepseek)
5. [月之暗面 Moonshot（Kimi 系列）](#5-月之暗面-moonshotkimi-系列)
6. [OpenAI（GPT 系列）](#6-openaigpt-系列)
7. [API Key 安全管理建议](#7-api-key-安全管理建议)

---

## 1. 智谱 AI（GLM 系列）

| 项目       | 信息                                                |
| ---------- | --------------------------------------------------- |
| 官网       | https://open.bigmodel.cn/                           |
| 文档       | https://docs.bigmodel.cn/cn/guide/start/quick-start |
| 兼容格式   | OpenAI 兼容                                         |
| Base URL   | `https://open.bigmodel.cn/api/paas/v4`              |
| 代表模型   | GLM-5.1、GLM-4.6V、GLM-5V-Turbo                     |
| 新用户福利 | 免费赠送 2000 万 tokens 体验包                      |

### 申请步骤

1. **注册账号**
   - 访问 [智谱开放平台](https://open.bigmodel.cn/)
   - 点击右上角「注册/登录」，支持手机号注册和微信扫码登录
   - 完成注册后自动登录

   > 📸 **截图 1**：智谱开放平台首页，标注右上角「注册/登录」按钮位置
   >
   > ![智谱-注册页面](![alt text](/llmkey/img/image-4.png))

2. **获取 API Key**
   - 登录后进入 [个人中心 → API Keys](https://bigmodel.cn/usercenter/proj-mgmt/apikeys)
   - 点击「创建新 API Key」
   - 复制并妥善保存生成的 Key（格式类似 `xxxxxxxx.yyyyyyyyyy`）

   > 📸 **截图 2**：API Keys 管理页面，标注「创建新 API Key」按钮
   >
   > ![智谱-创建API Key](![alt text](/llmkey/img/image.png))
   >
   > 📸 **截图 3**：成功创建 API Key 后的复制弹窗（注意遮挡 Key 敏感部分）
   >
   > ![智谱-复制API Key](![alt text](/llmkey/img/image-5.png))

3. **验证调用**
   ```bash
   curl -X POST "https://open.bigmodel.cn/api/paas/v4/chat/completions" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -d '{
       "model": "glm-5.1",
       "messages": [
         {"role": "user", "content": "你好"}
       ]
     }'
   ```

---

## 2. 阿里云百炼（通义千问 / Qwen 系列）

| 项目       | 信息                                                                           |
| ---------- | ------------------------------------------------------------------------------ |
| 官网       | https://bailian.console.aliyun.com/                                            |
| 文档       | https://help.aliyun.com/zh/model-studio/getting-started/first-api-call-to-qwen |
| 兼容格式   | OpenAI 兼容 / DashScope SDK                                                    |
| Base URL   | `https://dashscope.aliyuncs.com/compatible-mode/v1`                            |
| 代表模型   | Qwen3.6-Plus、Qwen-Plus、Qwen-Max                                              |
| 新用户福利 | 实名认证后赠送 20 元代金券 + 模型免费额度                                      |

### 申请步骤

1. **注册阿里云账号**
   - 访问 [阿里云官网](https://www.aliyun.com/)，注册账号
   - 完成实名认证（个人/企业均可）

   > 📸 **截图 1**：阿里云注册/登录页面
   >
   > ![阿里云-注册](![alt text](/llmkey/img/image-7.png))

2. **开通百炼服务**
   - 前往 [阿里云百炼控制台](https://bailian.console.aliyun.com/?tab=model#/model-market)
   - 阅读并同意服务协议，自动开通

   > 📸 **截图 2**：百炼控制台首页，服务协议同意页面
   >
   > ![阿里云-开通百炼](![alt text](/llmkey/img/image-8.png))

3. **获取 API Key**
   - 进入 [密钥管理页面](https://bailian.console.aliyun.com/?tab=model#/api-key)
   - 点击「创建 API Key」
   - 复制并保存（格式类似 `sk-xxxxxxxxxxxxxxxx`）

   > 📸 **截图 3**：密钥管理页面，标注「创建 API Key」按钮
   >
   > ![阿里云-创建API Key](![alt text](/llmkey/img/image-9.png))
   >
   > 📸 **截图 4**：API Key 创建成功弹窗（注意遮挡敏感部分）
   >
   > ![阿里云-复制API Key](![alt text](/llmkey/img/image-11.png))

4. **验证调用**
   ```bash
   curl -X POST "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -d '{
       "model": "qwen-plus",
       "messages": [
         {"role": "user", "content": "你好"}
       ]
     }'
   ```

---

## 3. 百度千帆（文心一言 / ERNIE 系列）

| 项目       | 信息                                                   |
| ---------- | ------------------------------------------------------ |
| 官网       | https://qianfan.cloud.baidu.com/                       |
| 文档       | https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Dlkm79mnx |
| 兼容格式   | 百度私有 API / 部分 OpenAI 兼容                        |
| 代表模型   | ERNIE-4.5-8K、ERNIE-Speed                              |
| 新用户福利 | 实名认证后赠送 20 元代金券                             |

### 申请步骤

1. **注册百度智能云账号**
   - 访问 [百度智能云](https://cloud.baidu.com/)
   - 注册并完成实名认证

   > 📸 **截图 1**：百度智能云注册页面
   >
   > ![百度-注册](![alt text](/llmkey/img/image-12.png))

2. **开通千帆服务**
   - 前往 [千帆大模型平台控制台](https://console.bce.baidu.com/qianfan/overview)
   - 同意服务协议，开通服务

   > 📸 **截图 2**：千帆控制台概览页面
   >
   > ![百度-千帆控制台](![alt text](/llmkey/img/image-14.png))

3. **获取 API Key / Secret Key**
   - 进入 [应用管理](https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application) 页面
   - 创建应用，获取 API Key 和 Secret Key
   - 也可前往 [安全认证](https://console.bce.baidu.com/iam/#/iam/accesslist) 获取 AK/SK

   > 📸 **截图 3**：应用管理页面 → 创建应用
   >
   > ![百度-创建应用](![alt text](/llmkey/img/image-15.png))
   >
   > 📸 **截图 4**：获取到的 API Key / Secret Key 页面（注意遮挡敏感部分）
   >
   > ![百度-获取Key](![alt text](/llmkey/img/image-16.png))
   > ![alt text](/llmkey/img/image-17.png)

4. **验证调用**
   - 参考 [千帆 API 文档](https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Slfmc9dds) 发起调用

---

## 4. DeepSeek

| 项目       | 信息                                                        |
| ---------- | ----------------------------------------------------------- |
| 官网       | https://platform.deepseek.com/                              |
| 文档       | https://api-docs.deepseek.com/zh-cn/                        |
| 兼容格式   | 完全兼容 OpenAI 格式                                        |
| Base URL   | `https://api.deepseek.com`                                  |
| 代表模型   | deepseek-chat (DeepSeek-V3.2)、deepseek-reasoner (思考模式) |
| 新用户福利 | 注册赠送一定额度                                            |

### 申请步骤

1. **注册账号**
   - 访问 [DeepSeek 开放平台](https://platform.deepseek.com/)
   - 使用手机号注册或微信扫码登录

   > 📸 **截图 1**：DeepSeek 开放平台登录页面
   >
   > ![DeepSeek-登录](![alt text](/llmkey/img/image-18.png))

2. **获取 API Key**
   - 登录后进入 [API Keys 管理页面](https://platform.deepseek.com/api_keys)
   - 点击「创建 API Key」
   - 复制并保存（格式类似 `sk-xxxxxxxxxxxxxxxx`）

   > 📸 **截图 2**：API Keys 管理页面，标注「创建 API Key」按钮
   >
   > ![DeepSeek-创建Key](![alt text](/llmkey/img/image-19.png))
   >
   > 📸 **截图 3**：API Key 创建成功弹窗（注意遮挡敏感部分）
   >
   > ![DeepSeek-复制Key](![alt text](/llmkey/img/image-20.png))

3. **验证调用**
   ```bash
   curl https://api.deepseek.com/chat/completions \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -d '{
       "model": "deepseek-chat",
       "messages": [
         {"role": "system", "content": "You are a helpful assistant."},
         {"role": "user", "content": "Hello!"}
       ],
       "stream": false
     }'
   ```

---

## 5. 月之暗面 Moonshot（Kimi 系列）

| 项目     | 信息                                       |
| -------- | ------------------------------------------ |
| 官网     | https://platform.moonshot.cn/              |
| 文档     | https://platform.moonshot.cn/docs/overview |
| 兼容格式 | OpenAI 兼容                                |
| Base URL | `https://api.moonshot.cn/v1`               |
| 代表模型 | kimi-k2.5、kimi-k2、kimi-k2-thinking       |
| 计费方式 | 按量付费，缓存命中可享优惠价               |

### 申请步骤

1. **注册账号**
   - 访问 [Kimi 大模型开放平台](https://platform.moonshot.cn/)
   - 使用手机号注册或微信扫码

   > 📸 **截图 1**：Kimi 开放平台首页
   >
   > ![Moonshot-首页](![alt text](/llmkey/img/image-21.png))

2. **获取 API Key**
   - 登录后进入 [用户中心 → API Key 管理](https://platform.moonshot.cn/console/api-keys)
   - 点击「新建 API Key」
   - 复制并保存

   > 📸 **截图 2**：API Key 管理页面，标注「新建 API Key」按钮
   >
   > ![Moonshot-创建Key](![alt text](/llmkey/img/image-22.png))
   >
   > 📸 **截图 3**：API Key 创建成功（注意遮挡敏感部分）
   >
   > ![Moonshot-复制Key](![alt text](/llmkey/img/image-23.png))

3. **充值（按需）**
   - 前往 [充值页面](https://platform.moonshot.cn/console/pay) 进行自助充值
   - 支持按量扣费

   > 📸 **截图 4**：充值页面
   >
   > ![Moonshot-充值](![alt text](/llmkey/img/image-24.png))

4. **验证调用**
   ```bash
   curl https://api.moonshot.cn/v1/chat/completions \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -d '{
       "model": "kimi-k2.5",
       "messages": [
         {"role": "user", "content": "你好"}
       ]
     }'
   ```

---

## 6. OpenAI（GPT 系列）

| 项目     | 信息                                           |
| -------- | ---------------------------------------------- |
| 官网     | https://platform.openai.com/                   |
| 文档     | https://platform.openai.com/docs/api-reference |
| Base URL | `https://api.openai.com/v1`                    |
| 代表模型 | gpt-4o、gpt-4o-mini、o1、o3                    |
| 备注     | 需海外手机号/信用卡，国内使用需网络代理        |

### 申请步骤

1. **注册账号**
   - 访问 [OpenAI Platform](https://platform.openai.com/)
   - 使用邮箱 + 海外手机号注册（可用 Google / Microsoft / Apple 账号登录）

   > 📸 **截图 1**：OpenAI 平台登录/注册页面
   >
   > ![OpenAI-注册](![alt text](/llmkey/img/image-25.png))

2. **绑定付款方式**
   - 进入 [Billing](https://platform.openai.com/account/billing) 页面
   - 绑定海外信用卡（Visa / Mastercard）

   > 📸 **截图 2**：Billing 绑卡页面
   >
   > ![OpenAI-绑卡](![alt text](/llmkey/img/image-26.png))

3. **获取 API Key**
   - 进入 [API Keys](https://platform.openai.com/api-keys) 页面
   - 点击「Create new secret key」
   - 复制并保存（格式 `sk-xxxxxxxxxxxxxxxx`）

   > 📸 **截图 3**：API Keys 页面，标注「Create new secret key」按钮
   >
   > ![OpenAI-创建Key](![alt text](/llmkey/img/image-27.png))
   >
   > 📸 **截图 4**：创建成功弹窗（注意遮挡敏感部分）
   >
   > ![OpenAI-复制Key](![alt text](/llmkey/img/image-28.png))

4. **验证调用**
   ```bash
   curl https://api.openai.com/v1/chat/completions \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -d '{
       "model": "gpt-4o",
       "messages": [
         {"role": "user", "content": "Hello!"}
       ]
     }'
   ```

---

## 7. API Key 安全管理建议

| 建议               | 说明                                         |
| ------------------ | -------------------------------------------- |
| **不要硬编码**     | 切勿将 API Key 写死在代码中                  |
| **使用环境变量**   | 通过 `export API_KEY=xxx` 或 `.env` 文件管理 |
| **不要提交到 Git** | 将 `.env` 文件添加到 `.gitignore`            |
| **定期轮换**       | 建议每 3-6 个月更换一次 Key                  |
| **最小权限**       | 如平台支持，为 Key 设置最小必要权限          |
| **设置用量告警**   | 在平台设置消费上限和告警通知                 |
| **分项目管理**     | 不同项目/环境使用不同的 Key                  |

---

## 快速对比表

| 平台       | 注册难度 | OpenAI 兼容 | 免费额度        | 国内直连  |
| ---------- | -------- | ----------- | --------------- | --------- |
| 智谱 AI    | ★☆☆      | ✅          | ✅ 2000万tokens | ✅        |
| 阿里云百炼 | ★☆☆      | ✅          | ✅ 模型免费额度 | ✅        |
| 百度千帆   | ★★☆      | 部分兼容    | ✅ 20元代金券   | ✅        |
| DeepSeek   | ★☆☆      | ✅          | ✅              | ✅        |
| 月之暗面   | ★☆☆      | ✅          | ❌ 需充值       | ✅        |
| OpenAI     | ★★★      | -           | ❌ 需绑卡       | ❌ 需代理 |

---

> **提示**：以上信息基于 2026 年 4 月的平台情况，各平台政策可能随时调整，请以官方最新文档为准。
