curl -X POST https://api.arouter.ai/api/v1/keys \
-H "Authorization: Bearer lr_mgmt_xxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "production-backend",
"allowed_providers": ["openai", "anthropic"],
"limit": 150,
"limit_reset": "monthly",
"expires_at": "2025-12-31T23:59:59Z"
}'
import requests
resp = requests.post(
"https://api.arouter.ai/api/v1/keys",
headers={"Authorization": "Bearer lr_mgmt_xxxx"},
json={
"name": "production-backend",
"allowed_providers": ["openai", "anthropic"],
"limit": 150,
"limit_reset": "monthly",
},
)
key, err := client.CreateKey(ctx, &arouter.CreateKeyRequest{
Name: "production-backend",
AllowedProviders: []string{"openai", "anthropic"},
Limit: float64Ptr(150),
LimitReset: "monthly",
})
const key = await router.createKey({
name: "production-backend",
allowed_providers: ["openai", "anthropic"],
limit: 150,
limit_reset: "monthly",
});
console.log("API Key:", key.key); // lr_live_xxx
金鑰管理
建立 API Key
建立具有可選提供商/模型限制、速率限制和到期時間的新 API key。
POST
/
api
/
v1
/
keys
curl -X POST https://api.arouter.ai/api/v1/keys \
-H "Authorization: Bearer lr_mgmt_xxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "production-backend",
"allowed_providers": ["openai", "anthropic"],
"limit": 150,
"limit_reset": "monthly",
"expires_at": "2025-12-31T23:59:59Z"
}'
import requests
resp = requests.post(
"https://api.arouter.ai/api/v1/keys",
headers={"Authorization": "Bearer lr_mgmt_xxxx"},
json={
"name": "production-backend",
"allowed_providers": ["openai", "anthropic"],
"limit": 150,
"limit_reset": "monthly",
},
)
key, err := client.CreateKey(ctx, &arouter.CreateKeyRequest{
Name: "production-backend",
AllowedProviders: []string{"openai", "anthropic"},
Limit: float64Ptr(150),
LimitReset: "monthly",
})
const key = await router.createKey({
name: "production-backend",
allowed_providers: ["openai", "anthropic"],
limit: 150,
limit_reset: "monthly",
});
console.log("API Key:", key.key); // lr_live_xxx
curl -X POST https://api.arouter.ai/api/v1/keys \
-H "Authorization: Bearer lr_mgmt_xxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "production-backend",
"allowed_providers": ["openai", "anthropic"],
"limit": 150,
"limit_reset": "monthly",
"expires_at": "2025-12-31T23:59:59Z"
}'
import requests
resp = requests.post(
"https://api.arouter.ai/api/v1/keys",
headers={"Authorization": "Bearer lr_mgmt_xxxx"},
json={
"name": "production-backend",
"allowed_providers": ["openai", "anthropic"],
"limit": 150,
"limit_reset": "monthly",
},
)
key, err := client.CreateKey(ctx, &arouter.CreateKeyRequest{
Name: "production-backend",
AllowedProviders: []string{"openai", "anthropic"},
Limit: float64Ptr(150),
LimitReset: "monthly",
})
const key = await router.createKey({
name: "production-backend",
allowed_providers: ["openai", "anthropic"],
limit: 150,
limit_reset: "monthly",
});
console.log("API Key:", key.key); // lr_live_xxx
⌘I