Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Create a decision

client.Decisions.New(ctx, body) (*Decision, error)
POST
/decisions

Use this endpoint to quickly answer classification or scoring questions about some input. You can ask multiple questions in one request.

Parameters
body DecisionNewParams
Input param.Field[DecisionNewParamsInputUnion]

The input to evaluate for every question. Provide a text string or an ordered array of messages, function calls and outputs, or custom tool calls and outputs. Each tool output must identify a matching call by call ID.

Model param.Field[string]

The model to use. Only gpt-6-luna is supported.

minLength0
maxLength1048576
Questions param.Field[[]DecisionNewParamsQuestionUnion]

Ask 1–400 questions about the input. Each question can be a predicate, choice, or score. Answers come back in the same order.

PromptCacheKey param.Field[string]
Optional

Partition prompt cache reuse by caller-provided key.

minLength0
maxLength64
PromptCacheOptions param.Field[DecisionNewParamsPromptCacheOptions]
Optional

Options for prompt caching. Supported for gpt-5.6 and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with prompt_cache_breakpoint. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set mode to explicit to disable the implicit breakpoint. The ttl defaults to 30m, which is currently the only supported value. See the prompt caching guide for current details.

SafetyIdentifier param.Field[string]
Optional

Opaque caller-provided end-user identifier, scoped by the verified org. Match Responses’ limit; this is never the authenticated user identity.

minLength0
maxLength128
Returns
type Decision struct{…}
Answers []DecisionAnswerUnion

Answers in question order. Any question can return a refusal instead of an answer; other questions can still receive answers. A refusal has type: "refusal" and the question’s name, or null if it was unnamed.

Model string

The model used.

minLength0
Usage DecisionUsage

Token usage for the request.

Create a decision

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  decision, err := client.Decisions.New(context.TODO(), openai.DecisionNewParams{
    Input: openai.DecisionNewParamsInputUnion{
      OfString: openai.String("string"),
    },
    Model: "model",
    Questions: []openai.DecisionNewParamsQuestionUnion{openai.DecisionNewParamsQuestionUnion{
      OfPredicate: &openai.DecisionNewParamsQuestionPredicate{
        Instructions: openai.DecisionNewParamsQuestionPredicateInstructionsUnion{
          OfString: openai.String("string"),
        },
      },
    }},
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", decision.Answers)
}
{
  "model": "gpt-6-luna",
  "answers": [
    {"type": "predicate", "name": "damaged", "probability": 0.95}
  ],
  "usage": {
    "input_tokens": 42,
    "input_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 0},
    "output_tokens": 0,
    "output_tokens_details": {"reasoning_tokens": 0},
    "total_tokens": 42
  }
}
Returns Examples
{
  "model": "gpt-6-luna",
  "answers": [
    {"type": "predicate", "name": "damaged", "probability": 0.95}
  ],
  "usage": {
    "input_tokens": 42,
    "input_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 0},
    "output_tokens": 0,
    "output_tokens_details": {"reasoning_tokens": 0},
    "total_tokens": 42
  }
}