Skip to main content
Instead of a single model, pass an ordered list of candidates. If the first fails on the provider side, Geek Hub automatically retries with the next, without returning an error to the client. The response indicates which model finally answered and the cost is calculated against that one.

Syntax

model accepts a string (1 model) or an array (1 to 8 ordered candidates):

When fallback triggers

Pre-flight skip

If a candidate doesn’t support a required capability (zdr: true, response_format) or is blocked by the org’s ZDR config, it gets skipped rather than failing. Reasons appear in skipped:
  • zdr_not_verified — no verified ZDR policy
  • zdr_org_required — org requires ZDR and candidate isn’t verified
  • structured_outputs_not_supported — no structured outputs support
  • model_not_found, no_adapter — catalog or configuration

Successful response

When all fail

Pricing

Charges go against geekhub.final_model. Failed attempts do not generate token charges to the user but appear in /dashboard/usage with statusCode ≠ 200.

Streaming

With stream: true, fallback only works if failure occurs before the first chunk. Once your client starts receiving tokens, switching models isn’t possible; errors are emitted as SSE events and the stream aborts.

Auto routing by cost or latency

Instead of ordering candidates yourself, let the gateway order them by strategy:
Strategies:
  • cheapest — sorts by input+output price ascending. Predictable, no history required.
  • fastest — uses p50 latency over the last hour (min 10 requests per model). Falls back to cheapest if there isn’t enough data.
  • balanced — 60% cost + 40% latency, both normalized 0-1.
The resulting array is traversed like a manual model list. Response includes the applied order: