---
title: 在 Grok Build 中使用 RunAPI — 自定义模型配置指南 | RunAPI
description: 使用 xAI 文档规定的自定义模型字段、环境变量 API 密钥和 RunAPI 模型指南，在 Grok Build 中配置 RunAPI。
url: https://runapi.ai/zh-CN/grok-build.md
canonical: https://runapi.ai/zh-CN/grok-build
locale: zh-CN
site: RunAPI
image: https://runapi.ai/assets/opengraph-bfaaa0f0.png
alternates:
  en: https://runapi.ai/grok-build
  zh-CN: https://runapi.ai/zh-CN/grok-build
  es: https://runapi.ai/es/grok-build
  ja: https://runapi.ai/ja/grok-build
  de: https://runapi.ai/de/grok-build
  fr: https://runapi.ai/fr/grok-build
  pt-BR: https://runapi.ai/pt-BR/grok-build
  ko: https://runapi.ai/ko/grok-build
  it: https://runapi.ai/it/grok-build
  nl: https://runapi.ai/nl/grok-build
  pl: https://runapi.ai/pl/grok-build
  tr: https://runapi.ai/tr/grok-build
  zh-TW: https://runapi.ai/zh-TW/grok-build
  zh-HK: https://runapi.ai/zh-HK/grok-build
  ar: https://runapi.ai/ar/grok-build
  x-default: https://runapi.ai/grok-build
---

> HTML version: https://runapi.ai/zh-CN/grok-build
> Site index for agents: https://runapi.ai/llms.txt


# 在 Grok Build 中使用 RunAPI。

Grok Build 支持通过 base_url 和 env_key 配置自定义模型。将文档规定的 TOML 结构指向 RunAPI，把密钥保存在 RUNAPI_API_KEY，并选择目录中的模型指南。

- [获取 API 密钥](https://runapi.ai/zh-CN/login)
- [浏览模型](https://runapi.ai/zh-CN/models.md)

> 本页面将官方配置事实与运行证据分开。本次工作没有发起付费上游请求，也没有执行真实 Grok Build 会话，因此示例不代表推理成功。

## config.toml

```toml
[model.runapi]
model = "gpt-5.5"
name = "RunAPI GPT 5.5"
base_url = "https://runapi.ai/v1"
env_key = "RUNAPI_API_KEY"

[models]
default = "runapi"
```

## 命令

```bash
export RUNAPI_API_KEY="runapi_xxx"
grok --version
grok
```

## 配置文档规定的自定义模型结构

1. **在环境中设置 API 密钥** — 在启动 Grok Build 的同一环境中导出 RUNAPI_API_KEY。不要把真实密钥写入 config.toml 或源代码。 `export RUNAPI_API_KEY="runapi_xxx"`
2. **添加 RunAPI 模型条目** — 使用 xAI 文档中的 model、name、base_url 和 env_key 字段，让 default 指向命名的模型条目。 `[model.runapi]`
3. **在会话前本地检查** — 检查已安装的 CLI 版本并在本地查看生成的配置。本地检查不能证明 RunAPI 请求或模型响应成功。 `grok --version`

## 为 Grok Build 选择 RunAPI 模型

指南列表来自 RunAPI 目录。每份指南展示当前模型 ID 和公开 endpoint，不代表每个目录变体都已在 Grok Build 中完成实际运行验证。

- [GPT](https://runapi.ai/zh-CN/grok-build-gpt.md) — 文本 · OpenAI

## Grok Bot 是由 Cursor 托管的独立产品。

xAI 将 Grok Bot 说明为连接 Cursor 的产品，Bot 在持久的云端电脑上运行。公开文档没有提供 Grok Build 所述的自定义 base_url 或模型选择器配置，因此本页不承诺 Grok Bot 通过 RunAPI 路由。

[阅读官方 Grok Bot 文档](https://docs.x.ai/grok-bot/overview)

## 配置字段

| 字段 | 值 | 用途 |
| --- | --- | --- |
| `model.runapi.model` | `gpt-5.5` | 为自定义条目选择 RunAPI 目录中的模型。 |
| `model.runapi.base_url` | `https://runapi.ai/v1` | 将文档规定的 OpenAI 兼容 base URL 指向 RunAPI。 |
| `model.runapi.env_key` | `RUNAPI_API_KEY` | 从环境变量读取凭据，避免硬编码。 |
| `models.default` | `runapi` | 将命名的自定义模型条目设为默认值。 |

## Grok Build 配置问题

### 本页是否声称 Grok Build 已完成 RunAPI 推理？

不是。TOML 结构遵循 xAI 的公开 Grok Build 文档；真实 RunAPI 请求需要另行授权的运行时检查。本次工作没有发起付费请求。
### RunAPI 密钥应该保存在哪里？

将 RUNAPI_API_KEY 设置在启动 Grok Build 的环境中。env_key 字段指定本地配置应读取的变量。
### Grok Bot 能否把此配置用作自己的模型选择器？

没有这种声明。xAI 的 Grok Bot 文档描述由 Cursor 管理的模型，并未说明用户可控制的 base_url 或模型选择器。

## 官方来源

- [Grok Build official documentation](https://docs.x.ai/build/overview)
- [xAI API models](https://docs.x.ai/developers/models)

创建 RunAPI 帐户或登录，查看当前模型目录，并将运行验证与这份公开配置参考分开。


---

## More from RunAPI

- [Home](https://runapi.ai/zh-CN/.md)
### 产品
- [模型目录](https://runapi.ai/zh-CN/models.md)
- [定价](https://runapi.ai/zh-CN/pricing.md)
- [提供方](https://runapi.ai/zh-CN/models#all-models)
### 开发者
- [文档](https://runapi.ai/zh-CN/docs/guides)
- [SDK](https://runapi.ai/zh-CN/sdk.md)
- [CLI](https://runapi.ai/zh-CN/cli.md)
- [MCP Server](https://runapi.ai/zh-CN/mcp.md)
- [x402](https://runapi.ai/zh-CN/x402.md)
### 指南
- [Claude Code 与 Cursor](https://runapi.ai/zh-CN/claude-code-vs-cursor.md)
- [Cursor API 设置](https://runapi.ai/zh-CN/cursor-api-setup.md)
- [RunAPI 与 OpenRouter](https://runapi.ai/zh-CN/openrouter-alternative.md)
### 公司
- [企业版](https://runapi.ai/zh-CN/contact.md)
- [联系](https://runapi.ai/zh-CN/contact.md)
### 法律
- [服务条款](https://runapi.ai/zh-CN/terms.md)
- [隐私政策](https://runapi.ai/zh-CN/privacy.md)
- [Site index for agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Structured data

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-CN",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/zh-CN/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-CN",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/zh-CNicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "SoftwareApplication",
    "name": "RunAPI",
    "applicationCategory": "DeveloperApplication",
    "description": "使用 xAI 文档规定的自定义模型字段、环境变量 API 密钥和 RunAPI 模型指南，在 Grok Build 中配置 RunAPI。",
    "url": "https://runapi.ai/zh-CN/grok-build"
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "name": "本页是否声称 Grok Build 已完成 RunAPI 推理？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "不是。TOML 结构遵循 xAI 的公开 Grok Build 文档；真实 RunAPI 请求需要另行授权的运行时检查。本次工作没有发起付费请求。"
        }
      },
      {
        "@type": "Question",
        "name": "RunAPI 密钥应该保存在哪里？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "将 RUNAPI_API_KEY 设置在启动 Grok Build 的环境中。env_key 字段指定本地配置应读取的变量。"
        }
      },
      {
        "@type": "Question",
        "name": "Grok Bot 能否把此配置用作自己的模型选择器？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "没有这种声明。xAI 的 Grok Bot 文档描述由 Cursor 管理的模型，并未说明用户可控制的 base_url 或模型选择器。"
        }
      }
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "HowTo",
    "step": [
      {
        "@type": "HowToStep",
        "position": 1,
        "name": "在环境中设置 API 密钥",
        "text": "在启动 Grok Build 的同一环境中导出 RUNAPI_API_KEY。不要把真实密钥写入 config.toml 或源代码。"
      },
      {
        "@type": "HowToStep",
        "position": 2,
        "name": "添加 RunAPI 模型条目",
        "text": "使用 xAI 文档中的 model、name、base_url 和 env_key 字段，让 default 指向命名的模型条目。"
      },
      {
        "@type": "HowToStep",
        "position": 3,
        "name": "在会话前本地检查",
        "text": "检查已安装的 CLI 版本并在本地查看生成的配置。本地检查不能证明 RunAPI 请求或模型响应成功。"
      }
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "BreadcrumbList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "首页",
        "item": "https://runapi.ai/zh-CN"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "RunAPI",
        "item": "https://runapi.ai/zh-CN/grok-build"
      }
    ]
  }
]
```
