JavaScript · 对话补全
const response = await fetch(
baseUrl + '/v1/chat/completions',
{
method: 'POST',
headers: {
Authorization: 'Bearer ' + apiKey,
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: modelId,
messages: [
{ role: 'user', content: 'Write a short introduction for my new product.' },
],
}),
},
)
const result = await response.json()返回结构示意
{
"choices": [{
"message": {
"role": "assistant",
"content": "Text generated by the model"
}
}]
}组织与访问
管理团队和访问密钥
使用工作台管理组织成员与 API Key,按需要设置组织、成员和密钥的用量预算。
组织成员
在组织中管理成员与访问权限。
API 密钥
为不同应用分配密钥,分别管理访问与预算。
多级预算
设置组织、成员与密钥的月度用量上限。
预付余额
充值完成并确认入账后,余额可用于模型调用。
按量结算
依据所选模型与规格的计费单位计算费用。
用量记录
在工作台查看调用与消费,检查余额和预算。