curl --request POST \
--url https://openrouter.ai/api/v1/api/alpha/decisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"questions": {},
"state": "<string>",
"provider": {
"allow_fallbacks": true
},
"session_id": "session-1234",
"trace": {
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
},
"user": "<string>"
}
'import requests
url = "https://openrouter.ai/api/v1/api/alpha/decisions"
payload = {
"model": "<string>",
"questions": {},
"state": "<string>",
"provider": { "allow_fallbacks": True },
"session_id": "session-1234",
"trace": {
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
},
"user": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
questions: {},
state: '<string>',
provider: {allow_fallbacks: true},
session_id: 'session-1234',
trace: {trace_id: 'trace-abc123', trace_name: 'my-app-trace'},
user: '<string>'
})
};
fetch('https://openrouter.ai/api/v1/api/alpha/decisions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openrouter.ai/api/v1/api/alpha/decisions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'questions' => [
],
'state' => '<string>',
'provider' => [
'allow_fallbacks' => true
],
'session_id' => 'session-1234',
'trace' => [
'trace_id' => 'trace-abc123',
'trace_name' => 'my-app-trace'
],
'user' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openrouter.ai/api/v1/api/alpha/decisions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"questions\": {},\n \"state\": \"<string>\",\n \"provider\": {\n \"allow_fallbacks\": true\n },\n \"session_id\": \"session-1234\",\n \"trace\": {\n \"trace_id\": \"trace-abc123\",\n \"trace_name\": \"my-app-trace\"\n },\n \"user\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openrouter.ai/api/v1/api/alpha/decisions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"questions\": {},\n \"state\": \"<string>\",\n \"provider\": {\n \"allow_fallbacks\": true\n },\n \"session_id\": \"session-1234\",\n \"trace\": {\n \"trace_id\": \"trace-abc123\",\n \"trace_name\": \"my-app-trace\"\n },\n \"user\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/api/alpha/decisions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"questions\": {},\n \"state\": \"<string>\",\n \"provider\": {\n \"allow_fallbacks\": true\n },\n \"session_id\": \"session-1234\",\n \"trace\": {\n \"trace_id\": \"trace-abc123\",\n \"trace_name\": \"my-app-trace\"\n },\n \"user\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"answers": {},
"model": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cost": 123
},
"id": "<string>",
"provider": "<string>"
}{
"error": {
"code": 400,
"message": "Invalid request parameters"
}
}{
"error": {
"code": 401,
"message": "Missing Authentication header"
}
}{
"error": {
"code": 402,
"message": "Insufficient credits. Add more using https://openrouter.ai/credits"
}
}{
"error": {
"code": 403,
"message": "Only management keys can perform this operation"
}
}{
"error": {
"code": 404,
"message": "Resource not found"
}
}{
"error": {
"code": 413,
"message": "Request payload too large"
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded"
}
}{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}{
"error": {
"code": 502,
"message": "Provider returned error"
}
}{
"error": {
"code": 503,
"message": "Service temporarily unavailable"
}
}{
"error": {
"code": 524,
"message": "Request timed out. Please try again later."
}
}{
"error": {
"code": 529,
"message": "Provider returned error"
}
}Submit a Decisions (questions and answers) request
Submits a Decisions request to the Decisions router
curl --request POST \
--url https://openrouter.ai/api/v1/api/alpha/decisions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"questions": {},
"state": "<string>",
"provider": {
"allow_fallbacks": true
},
"session_id": "session-1234",
"trace": {
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
},
"user": "<string>"
}
'import requests
url = "https://openrouter.ai/api/v1/api/alpha/decisions"
payload = {
"model": "<string>",
"questions": {},
"state": "<string>",
"provider": { "allow_fallbacks": True },
"session_id": "session-1234",
"trace": {
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
},
"user": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
questions: {},
state: '<string>',
provider: {allow_fallbacks: true},
session_id: 'session-1234',
trace: {trace_id: 'trace-abc123', trace_name: 'my-app-trace'},
user: '<string>'
})
};
fetch('https://openrouter.ai/api/v1/api/alpha/decisions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openrouter.ai/api/v1/api/alpha/decisions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'questions' => [
],
'state' => '<string>',
'provider' => [
'allow_fallbacks' => true
],
'session_id' => 'session-1234',
'trace' => [
'trace_id' => 'trace-abc123',
'trace_name' => 'my-app-trace'
],
'user' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openrouter.ai/api/v1/api/alpha/decisions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"questions\": {},\n \"state\": \"<string>\",\n \"provider\": {\n \"allow_fallbacks\": true\n },\n \"session_id\": \"session-1234\",\n \"trace\": {\n \"trace_id\": \"trace-abc123\",\n \"trace_name\": \"my-app-trace\"\n },\n \"user\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openrouter.ai/api/v1/api/alpha/decisions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"questions\": {},\n \"state\": \"<string>\",\n \"provider\": {\n \"allow_fallbacks\": true\n },\n \"session_id\": \"session-1234\",\n \"trace\": {\n \"trace_id\": \"trace-abc123\",\n \"trace_name\": \"my-app-trace\"\n },\n \"user\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/api/alpha/decisions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"questions\": {},\n \"state\": \"<string>\",\n \"provider\": {\n \"allow_fallbacks\": true\n },\n \"session_id\": \"session-1234\",\n \"trace\": {\n \"trace_id\": \"trace-abc123\",\n \"trace_name\": \"my-app-trace\"\n },\n \"user\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"answers": {},
"model": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cost": 123
},
"id": "<string>",
"provider": "<string>"
}{
"error": {
"code": 400,
"message": "Invalid request parameters"
}
}{
"error": {
"code": 401,
"message": "Missing Authentication header"
}
}{
"error": {
"code": 402,
"message": "Insufficient credits. Add more using https://openrouter.ai/credits"
}
}{
"error": {
"code": 403,
"message": "Only management keys can perform this operation"
}
}{
"error": {
"code": 404,
"message": "Resource not found"
}
}{
"error": {
"code": 413,
"message": "Request payload too large"
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded"
}
}{
"error": {
"code": 500,
"message": "Internal Server Error"
}
}{
"error": {
"code": 502,
"message": "Provider returned error"
}
}{
"error": {
"code": 503,
"message": "Service temporarily unavailable"
}
}{
"error": {
"code": 524,
"message": "Request timed out. Please try again later."
}
}{
"error": {
"code": 529,
"message": "Provider returned error"
}
}Authorizations
API key as bearer token in Authorization header
Body
Show child attributes
Show child attributes
The content to evaluate: a plain string, or a JSON object or array of related context.
Provider routing preferences for the request.
Show child attributes
Show child attributes
{ "allow_fallbacks": true }
A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.
256"session-1234"
Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
Show child attributes
Show child attributes
{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
}
256