New users get free credits — no credit card requiredGet started

API Spec

Public API contract

The public gateway exposes one model catalog, OpenAI-compatible chat, async media tasks, and compatibility routes for existing clients.

Authentication

Protected endpoints accept API keys through Authorization: Bearer. During migration, x-api-key remains available for old clients.

Accepted headers
Authorization: Bearer sk-your-api-key
x-api-key: sk-your-api-key

Errors

Error response
{
  "error": {
    "code": "insufficient_credits",
    "message": "Insufficient credits",
    "request_id": "req_123"
  }
}
400invalid_jsonRequest body is not valid JSON.
400missing_modelThe request did not include a model id.
400invalid_callback_urlThe callback_url must be a public HTTPS URL.
401auth_errorThe API key is missing, inactive, or invalid.
402insufficient_creditsThe account does not have enough credits for the estimated request.
402api_key_budget_exhaustedThe project API key has reached its credit budget.
403model_not_allowedThe API key is not allowed to call this model.
404model_not_foundNo active public model matches the requested id.
429rate_limit_exceededThe API key exceeded its per-minute request limit.
502service_unavailableNo eligible upstream channel completed the request.

Endpoint contracts

GET/api/v1/modelsReturns active models with type, capability, pricing, and parameter metadata.
POST/api/v1/chat/completionsAccepts OpenAI-compatible messages and returns OpenAI-compatible chat completions.
POST/api/v1/images/generateCreates an async image task and reserves credits before upstream processing.
POST/api/v1/video/generateCreates an async video task and returns a task id for polling.
GET/api/v1/tasks/{task_id}Returns task status, request id, result payload, and error details for the authenticated owner.
POST/api/v1beta/models/{model}:generateContentAccepts Gemini contents and generationConfig, then normalizes through the platform pipeline.

Async task lifecycle

Image, video, and audio requests return a task id first. A scheduler calls the internal media job, which updates the task to completed or failed, refunds credits on terminal failure, and delivers optional callbacks.

Task creation response
{
  "task_id": "task_123",
  "status": "pending",
  "poll_url": "/api/v1/tasks/task_123",
  "request_id": "req_abc",
  "callback": {
    "status": "pending"
  }
}