Authentication
Send a consumer API key with every request.
Authorization: Bearer YOUR_API_KEY
# or
x-api-key: YOUR_API_KEY
Machine-readable entrypoints
| Resource | URL |
|---|---|
| OpenAPI schema | /openapi.json |
| Markdown docs | /api-docs/index.md |
| LLM entrypoint | /llms.txt |
| API catalog | /.well-known/api-catalog |
| Auth.md | /auth.md |
Core endpoints
/v1/models
List public models, categories and metadata.
/v1/credits/estimate
Estimate credits before starting paid tasks.
/v1/chat/completions
OpenAI-compatible chat completion endpoint for LLM models.
/v1/embeddings
OpenAI-compatible embeddings endpoint.
/v1/images/generations
Create image generation tasks from prompts and references.
/v1/videos
Create text-to-video, image-to-video or video-to-video tasks.
/v1/music/generations
Create music generation tasks.
/v1/tasks/{task_id}
Poll image, video or music task status and output URLs.
Estimate credits before paid tasks
Agents should estimate credits before creating image, video or music tasks. Add
max_credits to task request bodies to reject the request before a task
is created if the estimate exceeds the user's approved budget.
curl https://api-key.org/v1/credits/estimate \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2-fast",
"modality": "video",
"duration": 6,
"resolution": "720p",
"input_mode": "text-to-video",
"max_credits": 250
}'
Video task example
curl https://api-key.org/v1/videos \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2",
"prompt": "A cinematic product launch video with smooth camera motion",
"max_credits": 250,
"callback_url": "https://your-app.com/webhooks/api-key"
}'
Task response
{
"task_id": "task_abc123",
"id": "task_abc123",
"object": "gateway.video.task",
"status": "pending"
}
Poll task status
curl https://api-key.org/v1/tasks/task_abc123 \
-H "Authorization: Bearer $API_KEY"
Gateway behavior
| Capability | What API-Key provides |
|---|---|
| API keys | Consumer keys with profile settings, model limits, IP allowlists and usage tracking. |
| Model routing | Public models map to delivery paths with priority, weight and retry policy. |
| Billing | Credits can be reserved before a task, settled after completion and refunded when model tasks fail. |
| Media delivery | Generated assets are returned as durable result links and tracked by task status. |
| Task APIs | Async media generation returns task_id, supports polling and can send signed callback events. |
Callback signature
When callback_url is provided, terminal task events are sent as HTTPS POST requests.
x-api-key-event: gateway.task.completed
x-api-key-task-id: task_abc123
x-api-key-timestamp: 1780666146
x-api-key-signature: HMAC_SHA256(timestamp + "." + body)
Error format
{
"error": {
"message": "Insufficient credits",
"type": "gateway_error",
"code": "insufficient_credits"
}
}