Authentication & API keys
Send a Bearer key from your server. Keep your account login and application credentials separate.
Required headers
Every /v1/tasks request requires Authorization. POST requests also require application/json. A create request additionally needs an Idempotency-Key.
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Idempotency-Key: YOUR_STABLE_REQUEST_IDKey limits and ownership
Create a separate key for each application. Set an expiry and a spending limit in USD; use exact public model IDs for restrictions. Account funds and key limits are both required. Tasks are scoped to the submitting key: another key, even on the same account, cannot retrieve that task through this API.
Server-side calls
Do not ship keys in JavaScript bundles or mobile applications. Call from your backend. Cross-origin browser API requests are not supported. IP-restricted keys are currently rejected by the task API; do not enable an IP restriction for this integration.
Rotate without losing work
Wait for active tasks to finish and save their outputs before revoking a key. Revocation stops authentication for future status queries. If a key is compromised, revoke promptly and keep affected task IDs for support.