Documentation Index
Fetch the complete documentation index at: https://api.xcompute.us/llms.txt
Use this file to discover all available pages before exploring further.
这份快速开始适合已经准备好接入代码的开发者。你将完成 API Key 创建、模型选择、第一次请求发送,以及异步任务状态查询。
获取 API Key
- 访问 API 密钥管理页面。
- 登录你的账户。
- 创建新的 API Key。
- 复制生成的密钥并安全保存。
选择模型
打开模型广场,选择最符合你任务目标的模型。推荐思路:
- 需要稳定的文本和代码生成,优先选择通用对话模型。
- 需要生图或视频能力,优先选择对应的多模态模型。
- 先小规模测试,再根据质量、速度和价格调整模型。
发送第一条请求
下面的示例使用兼容 OpenAI 的接口格式。将 YOUR_API_KEY 替换为你的真实密钥即可。curl -X POST https://xcompute.us/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "你好,请介绍一下你自己"
}
]
}'
curl -X POST https://xcompute.us/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-image",
"prompt": "一只可爱的熊猫",
"size": "1:1",
"n": 1
}'
curl -X POST https://xcompute.us/v1/videos/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sora-2",
"prompt": "海浪拍打着海岸",
"duration": 15,
"aspect_ratio": "16:9"
}'
查询异步任务状态
图像和视频任务通常会异步处理。你可以用任务 ID 查询执行状态和最终结果。curl -X GET https://xcompute.us/v1/tasks/YOUR_TASK_ID \
-H "Authorization: Bearer YOUR_API_KEY"
不要在前端代码、公开仓库或截图中暴露你的 API Key。建议按应用和环境拆分不同密钥。
下一步
Claude Code 接入
把 Xcompute 接入终端编程工作流。
Codex 接入
通过 Codex CLI 接入 Xcompute。
OpenClaw 接入
将自托管 AI 助手接入 Xcompute。
OpenCode 接入
在开源代码 Agent 工具里配置 Xcompute。