Concurrency, timeouts, and billing

HopBase concurrency caps, per-endpoint timeout behaviour and recommended client timeouts, request size limits, and exactly when a request is billed.

This page covers the runtime rules worth knowing before you integrate. For error codes and retry policy, see Error codes and retries.

Concurrency

  • An account runs 5 requests at a time by default. A key can carry its own, lower cap; the smaller of the two applies.
  • Chat, image generation, video submission and /v1/messages/count_tokens all consume concurrency. Sub-agents in AI coding assistants, batch scripts and several open clients fill the cap quickly.
  • Over the cap you get 429 with User concurrency limit reached (N) or API key concurrency limit reached (N), plus Retry-After.
  • Contact us to raise the cap.

A full queue is rejected, not queued

Requests beyond the cap are rejected immediately with 429; nothing waits server-side. Throttle in your client, or retry as Retry-After says.

Timeouts

CaseServer behaviourSuggested client read timeout
Chat on Gemini direct plansA single generation that has not finished in about 100 seconds is treated as timed out and retried on another account, so total wait can be longer240s or more
Non-streaming chat elsewhereNo fixed cap; large contexts can take over a minute to first token300s or more
Synchronous image generationLarge images commonly take 30–100 seconds300s or more
Async images and videoSubmission returns immediately; results come from polling60s is enough for the submission

Stream long outputs and use the async endpoints for long jobs — that avoids nearly all timeout problems.

Request size

A single request body is capped at 60 MB; larger bodies return 413. Base64 images and video reach that quickly, so compress them or pass a URL where the model supports it.

Billing

SituationBilled
Successful requestYes, per the model's unit (tokens / image / second)
Failed request (4xx, 5xx)No
Stream interrupted midway, or client disconnected earlyYes, for the output already produced
Failed async taskNo

Also worth knowing:

  • An empty balance blocks new requests: once the available balance reaches zero, new requests return 402. Requests already in flight are unaffected.
  • Video submissions reserve balance: the estimated cost is reserved up front, so a positive balance can still return 402 when "reserved in flight + this estimate" exceeds it. Reservations are released when the task ends.
  • Key quotas: if a key has its own quota, exhausting it returns 402 with budget_exceeded.

Checking balance and usage

curl https://api.hop-base.com/v1/usage \
  -H "Authorization: Bearer sk-your-key"

The response carries balance (available balance), unit (currency, USD) and a quota object with this key's quota and usage. For itemised records, open Usage in the console.

Result links for images and video expire on different schedules — see Image generation API and Video generation.

On this page