> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentium.in/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Decisions

> Classify text and inline images with typed questions, probabilities, scores, and explicit refusals.

Use `openaiDecisions()` from `@agentium/core` to evaluate a fixed set of questions. Agentium 4.1 adds `OpenAIDecisionsProvider`, `DecisionQuestion`, `DecisionAnswer`, and `result.decisions`.

The adapter calls `POST /v1/decisions`. As of October 8, 2026, OpenAI documents this endpoint as public beta with `gpt-6-luna` as its supported model. See the [official Decisions guide](https://developers.openai.com/api/docs/guides/decisions).

## Classify a support ticket

Install Agentium and the optional OpenAI SDK. This adapter requires `openai` 7.30.0 or later.

```bash theme={null}
npm install @agentium/core@4.1.0 openai@^7.30.0
npm install --save-dev tsx typescript
export OPENAI_API_KEY="your-key"
```

Save this as `decisions.ts`:

```typescript theme={null}
import { Agent, openaiDecisions, type DecisionQuestion } from "@agentium/core";

const questions: DecisionQuestion[] = [
  {
    type: "predicate",
    name: "urgent",
    instructions: "Does the customer need an immediate response?",
  },
  {
    type: "choice",
    name: "department",
    instructions: "Which department should handle this ticket?",
    choices: [
      { value: "billing", description: "Payments, charges, and refunds." },
      { value: "technical", description: "Failures when using the product." },
      { value: "other", description: "Requests outside these categories." },
    ],
  },
  {
    type: "score",
    name: "severity",
    instructions: "How much does this problem affect the customer?",
    levels: [
      { label: "Low", description: "Minor inconvenience." },
      { label: "Medium", description: "A task fails, but a workaround exists." },
      { label: "High", description: "Work is blocked with no workaround." },
    ],
  },
];

const agent = new Agent({
  name: "ticket-router",
  model: openaiDecisions("gpt-6-luna"),
});

try {
  const result = await agent.run("I was charged twice for my order.", { questions });
  for (const answer of result.decisions ?? []) {
    switch (answer.type) {
      case "refusal":
        console.log(answer.name, "Requires application review");
        break;
      case "predicate":
        console.log(answer.name, answer.probability);
        break;
      case "choice":
        console.log(answer.name, answer.choice, answer.confidence);
        break;
      case "score":
        console.log(answer.name, answer.score, answer.probabilities);
        break;
    }
  }
} finally {
  await agent.close();
}
```

Run `npx tsx decisions.ts`. The program prints one typed answer per question. Calls require an OpenAI API key and account access and incur provider usage. The exact answers vary with the input and model.

## Questions and results

| Question | Result | Application behavior |
| - | - | - |
| `predicate` | `probability` between 0 and 1 | Apply an application-selected threshold. |
| `choice` | A supplied string or boolean, its distribution, and confidence | Route according to the selected value. Boolean `false` differs from string `"false"`. |
| `score` | A fractional score, a distribution over levels, and confidence | Compare the score with your rubric. Indices start at zero. |
| Any question | `{ type: "refusal", name }` | Handle the refusal explicitly. Other questions can still have answers. |

`name` is optional. Supplied names must be unique; unnamed answers use `null`. Answers retain request order. Agentium validates their types, names, choice values, and score levels against the questions.

`result.decisions` contains the validated array. `result.text` contains that array as JSON. Refusals are answer data, not invented negative answers. An all-refused provider response uses `finishReason: "content_filter"`; a successfully completed Agent run can still contain refusals.

Use question instructions to define the task. The adapter preserves Agent instructions and conversation history as text evidence: each message becomes a user message prefixed with `[system]`, `[user]`, or `[assistant]`. These labels do not recreate a chat endpoint's role hierarchy.

## Configuration and overrides

| Option | Behavior |
| - | - |
| Model ID | Defaults to `gpt-6-luna`; provider acceptance does not establish account access. |
| `apiKey` | Overrides `OPENAI_API_KEY`. An API key passed to `run()` or `stream()` overrides both for that call. |
| `baseURL` | An explicitly configured OpenAI API root, including `/v1`. |
| `questions` | Default native question array in `openaiDecisions(model, { questions })`. |
| `safetyIdentifier` | Opaque application user identifier sent as `safety_identifier`; not authentication. |

A run's `questions` array replaces constructor defaults. An empty array is an error. Existing [Jev](/models/jev) question maps remain supported by `jev()`; the two providers reject each other's question formats.

The adapter forwards `AbortSignal` to the SDK. Agent runs use Agentium's retry policy for rate limits and transient server failures. Direct `provider.generate()` calls do not retry. Credential overrides are not retained for later requests.

## Images

Use Agentium's [multimodal input](/agents/multimodal) with `{ type: "image", data, mimeType }`. Supply raw base64 with a supported image MIME type or a complete inline data URL. The endpoint supports up to 128 image parts per request. External image URLs, file IDs, audio, and file parts are rejected. See the [request contract](https://developers.openai.com/api/reference/resources/decisions/methods/create).

## Streaming and costs

`agent.stream()` performs one complete request. It emits one `text` chunk containing the answer array, followed by a `finish` chunk with `decisions` and `usage`. It does not deliver incremental model output. The `run.complete` event also contains `output.decisions`.

`CostTracker` uses the endpoint-specific key `openai-decisions/gpt-6-luna`. The default base estimate is \$0.10 per million input tokens, with no output or cache charges. Configure `CostTracker.pricing` for regional or long-context adjustments. These are estimates; see [OpenAI's pricing and availability](https://developers.openai.com/api/docs/guides/decisions#pricing-and-availability).

## Integration limits

This provider rejects tools, `structuredOutput`, `responseFormat`, sampling controls, reasoning settings, and chat-specific provider options. Select an action with a `choice` question, then let application code execute it. Use a [chat provider](/models/openai) when you need generated tool arguments or arbitrary structured output.

Agentium bypasses semantic caching for this provider because the semantic cache key does not include the question set. Memory features that add tools or make auxiliary chat calls require a compatible chat model. Use this provider for a dedicated decision agent or direct model calls.

Tests exercise the installed OpenAI SDK against a local HTTP fixture, including cancellation, credentials, refusals, and streaming. These tests do not establish live account availability or model accuracy. Evaluate representative examples before selecting application thresholds.

## Next steps

* [Evaluation](/eval/overview) to check classification behavior on labeled cases.
* [Cost tracking](/cost/overview) to configure estimates and budgets.
* [Model API reference](/api-reference/core/models) for exported types and provider signatures.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.