Structured Decisions (Decisions)
Troubleshooting
Encountering an error? See the API Error Codes Reference for error types and troubleshooting guidance.
POST https://openqiao.com/api/v1/decisionsThe Decisions API evaluates input (text, images, or both) against your questions and returns structured answers. A request can contain multiple questions, and answers are returned in the same order as the questions.
Each question can be one of three types:
- predicate: Evaluate a yes/no condition and return the probability that it is true.
- choice: Select one of the supplied options and return the selected value, per-option probabilities, and confidence.
- score: Rate the input against ordered levels and return the probability-weighted average of their indices, per-level probabilities, and confidence.
Request parameters follow the OpenAI Decisions Create API. When calling through 开桥, use your 开桥 API key, the endpoint above, and a model ID with a provider prefix.
This endpoint returns a non-streaming JSON response and does not accept a stream parameter. It does not offer parameters such as reasoning, reasoning_effort, temperature, tools, or response_format. Use the Responses API for a custom JSON schema or tool calling.
Request Headers
Authorization string *
Bearer token authentication, in the form Bearer <OPENQIAO_API_KEY>.
Content-Type string *
The request content type is application/json.
Request Parameters
model string *
The model ID to use. OpenAI currently supports gpt-6-luna; specify openai/gpt-6-luna in 开桥.
input string or array *
The shared input evaluated by all questions. Provide a plain text string or an array of user messages containing text and images. A request can include at most 128 images. Files, audio, tool calls, and references to existing input items are not supported.
input[] object
Each message in the array contains:
rolestring(required) — Alwaysuser.typestring(optional) — Alwaysmessage.contentstring or array(required) — A text string or an array of the content parts below.
input_text object
typestring(required) — Alwaysinput_text.textstring(required) — The text content.
input_image object
typestring(required) — Alwaysinput_image.image_urlstring(required) — The image location. The current OpenAI Create API reference accepts a Base64 data URL (such asdata:image/png;base64,...) or a publicly accessible HTTP(S) image URL.file_idis not supported.detailstring or null(optional) — Image detail level:low,high,auto, ororiginal. Defaults toauto; processing follows the selected model's image profile.
Image format
OpenAI's Create API reference and guide currently differ on HTTP(S) image URLs: the reference lists support, while the guide still requires inline Base64 data URLs. We recommend the Base64 format used in this page's image example.
questions array *
An array of 1–200 questions. Question types can differ within a request. Answers are returned in question order.
questions[] object
All questions share the following fields:
typestring(required) —predicate,choice, orscore.instructionsstring(required) — What to evaluate and the criteria to apply.namestring(optional) — A question name echoed in the response. If omitted, the answer'snameisnull. Use unique names to make answers easier to identify.
predicate questions
Estimate whether the input satisfies the condition described in instructions. No additional options or levels are needed.
choice questions
A choices array is required and must contain 2–255 options. Each option contains:
valuestring or boolean(required) — The option value. Values must be unique and are distinguished by type: for example,"true"andtrueare different values.descriptionstring(optional) — What the option means or when it applies.
score questions
A levels array is required and describes the levels in scoring order. Each level contains:
labelstring(required) — The level's label.descriptionstring(optional) — What the level means or its scoring criteria.
Level indices start at 0. The returned score is the probability-weighted average of those indices, so it can fall between levels.
safety_identifier string or null optional
A caller-provided end-user identifier, scoped to the verified organization. It is not an API authentication identity and does not replace Authorization.
Response
Returns a JSON object containing model, answers, and usage. Probabilities and token counts in the example illustrate the response structure; actual values depend on the input and model result.
model string
The model ID used for this evaluation, such as openai/gpt-6-luna.
answers array
Answers in the same order as questions. Every answer includes type and name; name is the supplied question name, or null if none was provided.
answers[] object
- predicate answer
typestring— Alwayspredicate.probabilitynumber— The estimated probability that the condition is true, from 0 to 1.
- choice answer
typestring— Alwayschoice.choicestring or boolean— The selected option value, preserving its original type.probabilitiesarray— Each entry contains an optionvalue(string or boolean) and itsprobability.confidencenumber— Confidence in the answer.
- score answer
typestring— Alwaysscore.scorenumber— The probability-weighted average of the level indices.probabilitiesarray— Each entry contains the level indexvalue(an integer starting at 0), itslabel, and itsprobability.confidencenumber— Confidence in the answer.
- refusal answer
typestring— Alwaysrefusal.namestring or null— The name of the question that was refused.- Any question can return a refusal while other questions in the same request still receive answers. Check
typebefore reading a probability, choice, or score.
usage object
Token usage for this request:
input_tokensinteger— Input token count.input_tokens_detailsobjectcached_tokensinteger— Input tokens read from cache.cache_write_tokensinteger— Tokens written to cache.
output_tokensinteger— Output token count.output_tokens_detailsobjectreasoning_tokensinteger— Reasoning token count.
total_tokensinteger— Total token count.
reasoning_tokens is a usage field, not a reasoning switch. Its presence does not mean this endpoint supports configuring reasoning effort. Billing follows the prices published on the models page.
Image Input Example
This example reads a local product.png, converts it to a Base64 data URL, and checks the product for visible damage. It reads OPENQIAO_API_KEY from the environment.
import base64
import os
from pathlib import Path
import requests
image_base64 = base64.b64encode(Path("product.png").read_bytes()).decode("ascii")
resp = requests.post(
"https://openqiao.com/api/v1/decisions",
headers={"Authorization": f"Bearer {os.environ['OPENQIAO_API_KEY']}"},
json={
"model": "openai/gpt-6-luna",
"input": [{
"role": "user",
"content": [
{"type": "input_text", "text": "Inspect the product in this photo."},
{"type": "input_image", "image_url": f"data:image/png;base64,{image_base64}"},
],
}],
"questions": [{
"type": "predicate",
"name": "visible_damage",
"instructions": "Does the product have visible damage, such as a crack, tear, or dent?",
}],
},
timeout=90,
)
resp.raise_for_status()
print(resp.json())See the OpenAI Create API reference and the Decisions guide for the corresponding definitions.
curl https://openqiao.com/api/v1/decisions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENQIAO_API_KEY" \
-d '{
"model": "openai/gpt-6-luna",
"input": "The parcel arrived with a torn box and a cracked screen.",
"questions": [
{
"type": "predicate",
"name": "damaged",
"instructions": "Does the input describe a damaged product?"
},
{
"type": "choice",
"name": "action",
"instructions": "Choose the appropriate action.",
"choices": [{"value": "replace"}, {"value": "no_action"}]
},
{
"type": "score",
"name": "severity",
"instructions": "Rate the damage severity.",
"levels": [{"label": "minor"}, {"label": "major"}]
}
]
}'import os
import requests
resp = requests.post(
"https://openqiao.com/api/v1/decisions",
headers={
"Authorization": f"Bearer {os.environ['OPENQIAO_API_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "openai/gpt-6-luna",
"input": "The parcel arrived with a torn box and a cracked screen.",
"questions": [
{
"type": "predicate",
"name": "damaged",
"instructions": "Does the input describe a damaged product?",
},
{
"type": "choice",
"name": "action",
"instructions": "Choose the appropriate action.",
"choices": [{"value": "replace"}, {"value": "no_action"}],
},
{
"type": "score",
"name": "severity",
"instructions": "Rate the damage severity.",
"levels": [{"label": "minor"}, {"label": "major"}],
},
],
},
timeout=90,
)
resp.raise_for_status()
print(resp.json())const resp = await fetch("https://openqiao.com/api/v1/decisions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OPENQIAO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "openai/gpt-6-luna",
input: "The parcel arrived with a torn box and a cracked screen.",
questions: [
{
type: "predicate",
name: "damaged",
instructions: "Does the input describe a damaged product?",
},
{
type: "choice",
name: "action",
instructions: "Choose the appropriate action.",
choices: [{ value: "replace" }, { value: "no_action" }],
},
{
type: "score",
name: "severity",
instructions: "Rate the damage severity.",
levels: [{ label: "minor" }, { label: "major" }],
},
],
}),
});
if (!resp.ok) throw new Error(`HTTP ${resp.status}: ${await resp.text()}`);
console.log(await resp.json());{
"model": "openai/gpt-6-luna",
"answers": [
{ "type": "predicate", "name": "damaged", "probability": 1 },
{
"type": "choice",
"name": "action",
"choice": "replace",
"probabilities": [
{ "value": "replace", "probability": 1 },
{ "value": "no_action", "probability": 0 }
],
"confidence": 1
},
{
"type": "score",
"name": "severity",
"score": 0.89,
"probabilities": [
{ "value": 0, "label": "minor", "probability": 0.11 },
{ "value": 1, "label": "major", "probability": 0.89 }
],
"confidence": 0.78
}
],
"usage": {
"input_tokens": 373,
"input_tokens_details": { "cached_tokens": 0, "cache_write_tokens": 0 },
"output_tokens": 0,
"output_tokens_details": { "reasoning_tokens": 0 },
"total_tokens": 373
}
}