Elektric
Docs

Errors & Limits

Stable errors, retry rules, and authoritative limits.

Elektric returns stable error codes for failures your application can act on. Use the error code to decide what to fix or retry, and keep the Request ID when you need to trace a request.

Limits are enforced for the authenticated project. Your project may have stricter request or spend limits than the platform defaults.

#Error response

JSON
{
  "error": {
    "message": "Human-readable explanation",
    "type": "invalid_request_error",
    "code": "invalid_request",
    "request_id": "req_..."
  }
}

Branch on error.code, not message text. request_id may also be returned in the x-elektric-request-id response header.

Streaming and Realtime errors use their respective stream or protocol error formats instead of this HTTP JSON envelope.

#Common errors

HTTPCodeWhat it meansRetry?
401invalid_api_keyAPI key is missing, invalid, or revoked.No
403project_api_key_requiredThis operation requires a project API key.No
400invalid_requestThe request is malformed or contains invalid fields.No
413request_too_largeThe request exceeds the allowed body size.No
429rate_limit_exceededThe project exceeded its request rate.After Retry-After
429concurrency_limit_exceededToo many requests are running at once.After Retry-After
429daily_request_quota_exceededThe project reached its daily request quota.After reset
402insufficient_balanceThe billing account does not have enough balance.No
400model_capability_mismatchThe selected model cannot handle the requested input or operation.No
400unsupported_parameterThis operation does not support the supplied parameter.No
400unsupported_parameter_for_modelThe selected model does not support the supplied parameter.No
400max_output_tokens_exceededThe requested output exceeds the allowed limit.No
400context_length_exceededThe request exceeds the selected model's context window.No
503no_capable_model_availableGrid could not find an eligible model.Conditional
503no_healthy_model_availableEligible Grid models are not currently healthy.Conditional
400grid_clarification_requiredGrid needs a clearer request before choosing safely.No
400grid_unsupported_operationThe requested operation is not supported by Grid.No
502grid_research_failedRequired research failed before the final operation.Conditional
404file_not_foundThe referenced file does not exist for this project.No
410file_expiredThe temporary file expired; upload it again.No
413file_too_largeThe uploaded file exceeds the allowed size.No

Grid may also return operation-specific availability errors such as grid_image_unavailable, grid_video_unavailable, grid_speech_unavailable, or grid_transcription_unavailable when an otherwise supported media operation cannot currently execute. Treat these as conditional retry cases.

More specific validation errors may be returned for files, images, video, speech, transcription, and Realtime. They use the same error.code pattern.

#Retry safely

Retry only when the request is safe to repeat.

ResponseWhat to do
429Wait for Retry-After, then retry.
408, 502, 503, 504Retry only if repeating the operation cannot create duplicate paid work.
500Keep the Request ID and inspect the request before retrying paid work.
400, 401, 402, 403Fix the request, authentication, or billing state first.

Grid may try another eligible route before output begins. Wire does not silently switch models. Once streaming output has started, Elektric does not restart the request with another model.

#Idempotency

Use Idempotency-Key when creating asynchronous video jobs. Reusing the same key for the same project and operation returns the existing job instead of creating another one.

  • Maximum length: 200 characters.
  • Scope: project and operation.
  • Empty keys and keys containing control characters are rejected.

Chat, image generation/editing, speech, transcription, and research do not currently provide the same public idempotent-create guarantee. Retrying those operations after an uncertain failure may repeat provider work and charges.

#Cancellation

Client cancellation stops the client from waiting. It does not necessarily stop upstream provider work.

  • AbortSignal stops the client request.
  • Ending a stream after work starts may still leave billable provider usage.
  • Video jobs support explicit cancellation, but cancellation is best effort.
  • Upstream work may still be in flight after cancellation.

#Platform limits

LimitDefault
Requests60/minute
Burst20 requests / 10 seconds
Concurrent requests10
Daily requests10,000 per project
Request body8 MiB
Messages per request256
Serialized message size256 KiB
Default output ceiling32,768 tokens

These are platform defaults. Limits are enforced for the authenticated project, and project or account policy may be stricter.

Model-specific context windows, output ceilings, and capabilities vary by model. Check authenticated GET /v1/models for current model information.

#File and media limits

InputLimit
Attachments per request4
Inline image5 MiB
Inline audio5 MiB
Inline video5 MiB
Inline PDF/document10 MiB
Aggregate inline attachments12 MiB
Active temporary files100 per project
Temporary file lifetime1 hour
Uploaded fileMaximum
Image5 MiB
Video10 MiB
Transcription audio25 MiB
PDF/document10 MiB

Inline attachments must appear in user messages. Supported inline formats currently include PNG/JPEG/WebP images, MP4 video, and WAV/MPEG/MP4/WebM/OGG/FLAC audio.

#Operation input limits

InputMaximum
Image prompt4,000 characters
Image edit instruction4,000 characters
Speech input4,000 characters

Video generation duration, aspect ratio, resolution, and other capabilities depend on the selected product. Check Models and Media for current capabilities.

#Check your effective limits

GET /v1/limits returns the limits currently applied to your authenticated project.

JSON
{
  "object": "limits",
  "requests_per_minute": 60,
  "burst": { "requests": 20, "window_seconds": 10 },
  "concurrent_requests": 10,
  "daily_request_limit": 10000,
  "monthly_spend_limit_usd": null,
  "current_monthly_spend_usd": "0.000000000"
}

Daily request and monthly spend limits can vary by project.

/v1/limits does not currently include model capabilities, media limits, Realtime limits, file limits, or remaining request capacity.

Temporary uploaded files expire after 1 hour. Generated asset retention varies by operation.

See Models for model-specific capabilities and Grid routing for fallback behavior.