Skip to main content
A decision model answers closed, typed questions about a state: text, JSON, or images. Each answer comes with its confidence and its probabilities. The model generates no text, answers in a fraction of a second, and costs a fraction of a chat completion. POST /api/v1/hub/decisions runs one decision request synchronously, in the OpenRouter Decisions format.

Send a decision request

Find decision models in GET /api/v1/hub/models: their output_modalities contain decisions. Call a decision model through this route; chat/completions rejects it with 400 invalid_input, and this route rejects chat and media models the same way.

Request

An image in state is a part {"type":"image_url","image_url":{"url":"data:image/png;base64,…"}}. It can sit in the parts array or inside an object. Images are forwarded to the model and never stored by the Hub. Every answer also has type and confidence. The Hub checks only model, state, and questions. Other question types and additional top-level fields are forwarded unchanged: the model provider validates them.

Response

The model’s response is forwarded as is, with four changes: id is the Hub generation identifier, model is the catalog id, usage.cost is the billed amount in EUR, and provider is removed. answers and the token counters keep their names and types.
The Hub does not check that every question was answered. Check that each requested key is present in answers: an incomplete response is billed like a complete one.
A 200 response also includes:
X-Fanify-Billed-Cost is the billed amount in EUR, always written with a dot as decimal separator. Each decision is recorded as a generation with is_llm: true: it appears in GET /api/v1/hub/generations (excluded by media_only=true) and triggers the generation.running and generation.completed webhooks.

Idempotency

Use one new Idempotency-Key per request. Keys share one space across all Hub routes: a key already used by another request replays that request’s result.
  • A replay with the same key and body returns the same body and headers, without a new model call or charge. A failed request replays the same error.
  • A replay while the request is still running returns 503 generation_in_progress with Retry-After: 5.
  • The same key with a different body returns 422 idempotency_conflict.
  • After the retention period of the stored response (24 hours by default), a replay returns 410 file_expired.

Errors

Errors use the OpenAI-compatible envelope:
error.metadata.provider_name is present only on a provider_error, when the routed model failed. Errors raised by the Hub itself (validation, credits, rate limit, pause) have no metadata, except the replay of a failed generation, which returns its original envelope with metadata.provider_name. An authentication failure returns 401 unauthorized as Problem Details, before the decision is processed. Decisions have their own request rate limit per key, separate from the other Hub routes. A decision request has a short total time budget, 15 seconds by default, covering the wait for a concurrency slot and the model call. A failed request is never billed. See Errors for the meaning of each code.

Pricing

A decision is billed like a chat completion, from the input and output tokens of the routed model, at the input_cost_per_million and output_cost_per_million rates shown for your account in GET /api/v1/hub/models. Many decision models charge only input tokens; always read both rates. The billed amount is rounded to six decimal places.