创建 API Key
curl --request POST \
--url https://api.omnirelay.ai/v1/manage/keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Acme production"
}
'import requests
url = "https://api.omnirelay.ai/v1/manage/keys"
payload = { "name": "Acme production" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Acme production'})
};
fetch('https://api.omnirelay.ai/v1/manage/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "example-key-id",
"key": "or-live-…",
"expiresAt": null
}{
"error": {
"code": "model_unavailable",
"message": "The model does not exist or is disabled.",
"type": "not_found_error",
"param": "<string>"
},
"request_id": "<string>"
}{
"error": {
"code": "model_unavailable",
"message": "The model does not exist or is disabled.",
"type": "not_found_error",
"param": "<string>"
},
"request_id": "<string>"
}{
"error": {
"code": "model_unavailable",
"message": "The model does not exist or is disabled.",
"type": "not_found_error",
"param": "<string>"
},
"request_id": "<string>"
}{
"error": {
"code": "model_unavailable",
"message": "The model does not exist or is disabled.",
"type": "not_found_error",
"param": "<string>"
},
"request_id": "<string>"
}{
"error": {
"code": "model_unavailable",
"message": "The model does not exist or is disabled.",
"type": "not_found_error",
"param": "<string>"
},
"request_id": "<string>"
}{
"error": {
"code": "model_unavailable",
"message": "The model does not exist or is disabled.",
"type": "not_found_error",
"param": "<string>"
},
"request_id": "<string>"
}管理 API
创建 API Key
工作空间开通核验完成后,为所有者创建 API Key;否则返回 403 activation_required,不创建 Key。完整密钥仅返回一次,每人最多 20 个有效 API Key,金额为整数微美元。
POST
/
v1
/
manage
/
keys
创建 API Key
curl --request POST \
--url https://api.omnirelay.ai/v1/manage/keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Acme production"
}
'import requests
url = "https://api.omnirelay.ai/v1/manage/keys"
payload = { "name": "Acme production" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Acme production'})
};
fetch('https://api.omnirelay.ai/v1/manage/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "example-key-id",
"key": "or-live-…",
"expiresAt": null
}{
"error": {
"code": "model_unavailable",
"message": "The model does not exist or is disabled.",
"type": "not_found_error",
"param": "<string>"
},
"request_id": "<string>"
}{
"error": {
"code": "model_unavailable",
"message": "The model does not exist or is disabled.",
"type": "not_found_error",
"param": "<string>"
},
"request_id": "<string>"
}{
"error": {
"code": "model_unavailable",
"message": "The model does not exist or is disabled.",
"type": "not_found_error",
"param": "<string>"
},
"request_id": "<string>"
}{
"error": {
"code": "model_unavailable",
"message": "The model does not exist or is disabled.",
"type": "not_found_error",
"param": "<string>"
},
"request_id": "<string>"
}{
"error": {
"code": "model_unavailable",
"message": "The model does not exist or is disabled.",
"type": "not_found_error",
"param": "<string>"
},
"request_id": "<string>"
}{
"error": {
"code": "model_unavailable",
"message": "The model does not exist or is disabled.",
"type": "not_found_error",
"param": "<string>"
},
"request_id": "<string>"
}授权
在控制台创建的管理密钥;read 可读取,write 还可修改 API Key。不接受推理 API Key。
请求体
application/json
Required string length:
1 - 60Maximum string length:
80Maximum string length:
200未来的 Unix 毫秒时间戳;null 清除到期时间。
精确模型 ID 或 provider/* 规则;null 允许工作空间所有已开通模型,空数组无效。
Required array length:
1 - 50 elements必填范围:
0 <= x <= 1000000000000必填范围:
0 <= x <= 1000000000000可用选项:
none, daily, weekly, monthly