快速开始
几分钟内开始使用 Atlas Cloud 模型 API。本指南涵盖 API Key 设置、API 调用方法和第三方工具的使用。
前提条件
- 一个 Atlas Cloud 账户
- 一个 API Key
API 概览
Atlas Cloud 为不同模型类型提供不同的 API 端点:
| 模型类型 | Base URL | 格式 |
|---|---|---|
| LLM(对话) | https://api.atlascloud.ai/v1 | 兼容 OpenAI |
| 图像生成 | https://api.atlascloud.ai/api/v1 | Atlas Cloud API |
| 视频生成 | https://api.atlascloud.ai/api/v1 | Atlas Cloud API |
| 媒体上传 | https://api.atlascloud.ai/api/v1 | Atlas Cloud API |
LLM / 对话补全
LLM API 完全兼容 OpenAI。使用 OpenAI SDK 配合 Atlas Cloud 的 Base URL 即可。
Python
from openai import OpenAI
client = OpenAI(
api_key="your-api-key",
base_url="https://api.atlascloud.ai/v1"
)
# 非流式
response = client.chat.completions.create(
model="deepseek-v3",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms."}
]
)
print(response.choices[0].message.content)
# 流式
stream = client.chat.completions.create(
model="deepseek-v3",
messages=[
{"role": "user", "content": "Write a short poem about AI."}
],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")Node.js / TypeScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://api.atlascloud.ai/v1",
});
// 非流式
const response = await client.chat.completions.create({
model: "deepseek-v3",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Explain quantum computing in simple terms." },
],
});
console.log(response.choices[0].message.content);
// 流式
const stream = await client.chat.completions.create({
model: "deepseek-v3",
messages: [{ role: "user", content: "Write a short poem about AI." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || "");
}cURL
curl https://api.atlascloud.ai/v1/chat/completions \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v3",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum computing in simple terms."}
]
}'图像生成
import requests
response = requests.post(
"https://api.atlascloud.ai/api/v1/model/generateImage",
headers={
"Authorization": "Bearer your-api-key",
"Content-Type": "application/json"
},
json={
"model": "seedream-3.0",
"prompt": "A futuristic cityscape at sunset, cyberpunk style"
}
)
result = response.json()
prediction_id = result["data"]["id"]
print(f"Prediction ID: {prediction_id}")视频生成
import requests
response = requests.post(
"https://api.atlascloud.ai/api/v1/model/generateVideo",
headers={
"Authorization": "Bearer your-api-key",
"Content-Type": "application/json"
},
json={
"model": "kling-v2.0",
"prompt": "A timelapse of flowers blooming in a garden"
}
)
result = response.json()
prediction_id = result["data"]["id"]
print(f"Prediction ID: {prediction_id}")上传媒体文件
上传本地文件以获取临时 URL,用于图生视频、图像编辑等多步骤工作流:
import requests
response = requests.post(
"https://api.atlascloud.ai/api/v1/model/uploadMedia",
headers={"Authorization": "Bearer your-api-key"},
files={"file": open("photo.jpg", "rb")}
)
url = response.json().get("url")
print(f"Uploaded file URL: {url}")上传的文件仅供 Atlas Cloud 生成任务临时使用,文件可能会被定期清理。
获取异步结果
图像和视频生成任务以异步方式运行。使用 prediction ID 轮询获取结果:
import requests
import time
def wait_for_result(prediction_id, api_key, interval=5):
while True:
resp = requests.get(
f"https://api.atlascloud.ai/api/v1/model/prediction/{prediction_id}",
headers={"Authorization": f"Bearer {api_key}"}
)
data = resp.json()
status = data["data"]["status"]
if status == "completed":
return data["data"]["outputs"][0]
elif status == "failed":
raise Exception(f"Task failed: {data['data'].get('error')}")
print(f"Status: {status}. Waiting...")
time.sleep(interval)
result = wait_for_result(prediction_id, "your-api-key")
print(f"Result: {result}")使用第三方工具
Chatbox / Cherry Studio
- 打开设置 → 添加自定义供应商
- 将 API Host 设为
https://api.atlascloud.ai/v1(必须包含/v1) - 输入你的 API Key
- 从模型库选择模型名称
- 开始对话
OpenWebUI
配置 OpenAI 兼容连接,Base URL 为 https://api.atlascloud.ai/v1,并填入你的 API Key。
IDE 集成
使用 MCP Server 直接从 IDE(Cursor、Claude Desktop、Claude Code、VS Code 等)访问 Atlas Cloud 模型。
探索模型
在模型库浏览所有 300+ 模型。每个模型页面包含:
- 交互式 Playground 供不同参数测试
- API View 展示精确的请求格式和参数
- 定价信息
详细的 API 参考请查看 API 参考。