快速开始
5 分钟完成从注册到第一次 API 调用。
STEP 03
充值余额
在控制台中选择「充值」,根据需要选择充值金额。余额用于调用模型时的费用扣除。
STEP 04
创建 API Key
进入控制台「API Keys」页面,点击「创建」按钮生成一个新的 API Key。
请立即保存完整密钥,关闭后将无法再次查看。
STEP 05
开始调用
将 API Key 和 Base URL 配置到你的应用中即可开始调用模型:
Base URL
https://model.token618.com/api/open-apis/v1调用示例
使用 cURL 调用 Chat Completions 接口:
cURL
curl https://model.token618.com/api/open-apis/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "GLM-5-Turbo",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://model.token618.com/api/open-apis/v1"
)
response = client.chat.completions.create(
model="GLM-5-Turbo",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)Node.js (OpenAI SDK)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://model.token618.com/api/open-apis/v1",
});
const response = await client.chat.completions.create({
model: "GLM-5-Turbo",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);