Token Management
API key management.
Endpoints
GET https://ai-tokenhub.com/v1/api-keys
POST https://ai-tokenhub.com/v1/api-keys
PUT https://ai-tokenhub.com/v1/api-keys/{id}
DELETE https://ai-tokenhub.com/v1/api-keys/{id}API Key Object
json
{
"id": "key_xxx",
"name": "Production Key",
"key": "tkh_xxxxxxxxxxxx",
"status": "active",
"permissions": {
"models": ["gpt-4o", "gpt-4o-mini"],
"rate_limit": 1000
},
"usage": {
"total_requests": 50000,
"total_tokens": 1000000
},
"created_at": "2024-01-01T00:00:00Z"
}Create Key
bash
curl -X POST https://ai-tokenhub.com/v1/api-keys \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "New API Key",
"permissions": {
"models": ["gpt-4o-mini"]
}
}'Rotate Key
bash
curl -X POST https://ai-tokenhub.com/v1/api-keys/key_xxx/rotate \
-H "Authorization: Bearer YOUR_API_KEY"Fields
| Field | Type | Description |
|---|---|---|
| id | string | Key ID |
| name | string | Key name |
| key | string | Key value (full only on create) |
| status | string | Status (active/inactive) |
| permissions | object | Permission config |
| usage | object | Usage statistics |