POST /api-keys
为当前认证用户创建新的 API Key。完整密钥仅在创建时返回一次,请务必安全保存。请求体
string
必填
便于识别的名称(1–100 个字符)。
string
用途说明(最多 500 个字符)。
array
授予的权限列表,默认包含全部权限。
string
可选过期时间(ISO 8601)。
响应
boolean
是否创建成功。
string
状态说明。
object
创建结果详情。
string
提醒用户保存密钥。
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
curl -X POST https://api.llmgenerator.com/api/v1/api-keys \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Production API Key",
"description": "For the main application"
}'
const response = await fetch(
'https://api.llmgenerator.com/api/v1/api-keys',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Production API Key',
description: 'For the main application'
})
}
);
const data = await response.json();
// Save data.apiKey.key securely!
{
"success": true,
"message": "API key created successfully",
"apiKey": {
"id": "llm_1706345678_newkey123abc",
"name": "Production API Key",
"description": "For the main application",
"key": "llm_1706345678_newkey123abc",
"permissions": [],
"expiresAt": null,
"createdAt": "2026-01-27T10:00:00.000Z",
"isActive": true
},
"warning": "This is the only time the full API key will be shown. Please save it securely."
}
{
"message": "Validation error: Name is required"
}
创建新的 API Key。
curl -X POST https://api.llmgenerator.com/api/v1/api-keys \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Production API Key",
"description": "For the main application"
}'
const response = await fetch(
'https://api.llmgenerator.com/api/v1/api-keys',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Production API Key',
description: 'For the main application'
})
}
);
const data = await response.json();
// Save data.apiKey.key securely!
{
"success": true,
"message": "API key created successfully",
"apiKey": {
"id": "llm_1706345678_newkey123abc",
"name": "Production API Key",
"description": "For the main application",
"key": "llm_1706345678_newkey123abc",
"permissions": [],
"expiresAt": null,
"createdAt": "2026-01-27T10:00:00.000Z",
"isActive": true
},
"warning": "This is the only time the full API key will be shown. Please save it securely."
}
{
"message": "Validation error: Name is required"
}
此页面对您有帮助吗?