Skip to main content
decide() calls the OpenAI Decisions API (POST /v1/decisions): a purpose-built endpoint that evaluates shared input against typed questions and returns calibrated answers roughly 10x faster than a full model turn. It is the fast, deterministic shape for the typed-decision pattern — classify, route, gate, score — without spinning up an agent run. Public beta: gpt-6-luna is the only model the endpoint serves, and the surface may still change. The endpoint is not part of chat completions, so it does not go through createAgent() providers or OpenRouter — it needs OPENAI_API_KEY (or apiKey/baseURL for a compatible endpoint).

Question types

  • predicate answers carry probability — use a threshold (probability >= 0.9) where a wrong “yes” is expensive.
  • choice answers carry choice, per-option probabilities and confidence. Include a fallback option like 'other' when your categories don’t cover every input.
  • score answers carry score (a weighted index that can fall between levels), per-level probabilities and confidence. Define levels lowest→highest with distinct criteria.
  • Any question can come back { type: 'refusal' } — handle it as your “send to review” path.
Independent questions share one input and one request:
input also takes message form with inline base64 images ({ type: 'input_image', image_url: 'data:...' }) for visual checks like damage inspection; hosted image URLs and file_id are not supported.

Options

Failures are SDKErrors: missing key is LOUSHO_PROVIDER_MISSING_API_KEY, a 429 is LOUSHO_PROVIDER_RATE_LIMITED, other HTTP or malformed responses are LOUSHO_PROVIDER_REQUEST_FAILED, and aborts/timeouts are LOUSHO_OPERATION_TIMEOUT.

When to use what

  • decide() — a typed answer about one input: routing, filtering, severity, confidence gates. Fast and calibrated, but no prose and no tools.
  • Structured output (createAgent({ output })) — when you need your own JSON schema: extracted fields, a written explanation, or an object shaped like your domain. Works on any provider.
  • Sub-agents or flows — when the decision needs tools or multi-step reasoning before it answers.
The coding-agent-workflows example shows the same route/confidence/floor pattern built on output schemas — swap its triage step for decide() when you are on OpenAI and want the dedicated endpoint. Prompting techniques places both forms in the wider typed-decision catalog.