curl -X POST https://api-llm.sunra.ai/v1/responses \
-H "Authorization: Bearer <SUNRA_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-2.5-flash",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}'
import requests
response = requests.post(
"https://api-llm.sunra.ai/v1/responses",
headers={
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
json={
"model": "google/gemini-2.5-flash",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}
)
print(response.json())
const response = await fetch("https://api-llm.sunra.ai/v1/responses", {
method: "POST",
headers: {
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "google/gemini-2.5-flash",
input: [
{
type: "message",
role: "user",
content: "Hello, how are you?"
}
]
})
});
const data = await response.json();
console.log(data);
{
"id": "resp-abc123",
"object": "response",
"created_at": 1704067200,
"completed_at": 1704067201,
"status": "completed",
"model": "google/gemini-2.5-flash",
"output": [
{
"type": "message",
"id": "msg_abc123",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"annotations": []
}
]
}
],
"output_text": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"incomplete_details": null,
"error": null,
"temperature": 1.0,
"top_p": 1.0,
"max_output_tokens": null,
"top_logprobs": 0,
"presence_penalty": null,
"frequency_penalty": null,
"instructions": null,
"metadata": {},
"tools": [],
"tool_choice": "auto",
"parallel_tool_calls": true,
"reasoning": null,
"service_tier": "auto",
"store": true,
"truncation": "disabled",
"text": {
"format": {
"type": "text"
}
},
"usage": {
"input_tokens": 15,
"output_tokens": 18,
"total_tokens": 33,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
}
}
LLM
Create a response
POST
/
v1
/
responses
curl -X POST https://api-llm.sunra.ai/v1/responses \
-H "Authorization: Bearer <SUNRA_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-2.5-flash",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}'
import requests
response = requests.post(
"https://api-llm.sunra.ai/v1/responses",
headers={
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
json={
"model": "google/gemini-2.5-flash",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}
)
print(response.json())
const response = await fetch("https://api-llm.sunra.ai/v1/responses", {
method: "POST",
headers: {
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "google/gemini-2.5-flash",
input: [
{
type: "message",
role: "user",
content: "Hello, how are you?"
}
]
})
});
const data = await response.json();
console.log(data);
{
"id": "resp-abc123",
"object": "response",
"created_at": 1704067200,
"completed_at": 1704067201,
"status": "completed",
"model": "google/gemini-2.5-flash",
"output": [
{
"type": "message",
"id": "msg_abc123",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"annotations": []
}
]
}
],
"output_text": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"incomplete_details": null,
"error": null,
"temperature": 1.0,
"top_p": 1.0,
"max_output_tokens": null,
"top_logprobs": 0,
"presence_penalty": null,
"frequency_penalty": null,
"instructions": null,
"metadata": {},
"tools": [],
"tool_choice": "auto",
"parallel_tool_calls": true,
"reasoning": null,
"service_tier": "auto",
"store": true,
"truncation": "disabled",
"text": {
"format": {
"type": "text"
}
},
"usage": {
"input_tokens": 15,
"output_tokens": 18,
"total_tokens": 33,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
}
}
Creates a streaming or non-streaming response using the OpenAI Responses API format. Supports text, images, files, audio, video, function calling, web search, file search, code interpreter, reasoning, and more.
Authentication
string
required
Bearer token. Use your API key as the bearer token in the Authorization header.Format:
Bearer <SUNRA_KEY>Request
This endpoint expects an object.string
required
Model ID used to generate the response. Browse available models at sunra.ai/models.
object
Optional provider routing preferences. Omit for automatic routing. See Provider routing for supported fields and provider discovery.
string | object[]
Input for the response request. Can be a string or an array of input items including messages, function calls, function call outputs, reasoning items, and output messages.
Show input item types
Show input item types
- EasyInputMessage
- InputMessageItem
- OutputMessage
- FunctionCall
- FunctionCallOutput
- Reasoning
string
required
The role of the message author. Supported values:
user, assistant, system, developer.string | object[]
The content of the message. Can be a string or an array of content parts.
Show content part types
Show content part types
- InputText
- InputImage
- InputFile
- InputAudio
- InputVideo
string
required
Value:
input_image.string | null
The URL of the image, or a base64-encoded data URI.
string
required
Image detail level. Supported values:
auto, high, low.string
required
Value:
input_file.string | null
The ID of a previously uploaded file.
string
Base64-encoded file data.
string
The name of the file.
string
The URL of the file.
string
required
Value:
input_audio.string
Value:
message. Optional for easy input messages.string
The phase of an assistant message. Supported values:
commentary, final_answer. For follow-up requests, preserve and resend phase on all assistant messages.string
required
The ID of the message item.
string
Value:
message.string
required
The role. Supported values:
user, system, developer.object[] | null
Array of content parts (
input_text, input_image, input_file, input_audio, input_video).string
required
The ID of the output message.
string
required
Value:
message.string
required
Value:
assistant.string
Status of the message. Supported values:
completed, incomplete, in_progress.string | object[]
required
Array of content items (
output_text, refusal).string
The phase. Supported values:
commentary, final_answer.string
required
Value:
function_call.string
required
The unique ID of the function call item.
string
required
The call ID to match with the function call output.
string
required
The name of the function.
string
required
The arguments in JSON string format.
string
Status. Supported values:
in_progress, completed, incomplete.string
required
Value:
function_call_output.string
required
The call ID of the function call being responded to.
string | object[]
required
The output of the function call. Can be a string or array of content parts (
input_text, input_image, input_file).string | null
Optional ID for the output item.
string
Status. Supported values:
in_progress, completed, incomplete.string
required
Value:
reasoning.string
required
The unique ID of the reasoning item.
object[]
Array of reasoning summary text items, each with
type: "summary_text" and text.object[] | null
Array of reasoning text content items, each with
type: "reasoning_text" and text.string | null
Encrypted reasoning content for models that support it.
string
Status. Supported values:
completed, incomplete, in_progress.string | null
A signature for the reasoning content, used for verification.
string | null
Inserts a system (or developer) message as the first item in the model’s context. When used with
input, the instructions are inserted at the start of the input.boolean
default:false
If set to
true, the response will be streamed using server-sent events (SSE). Streams are subject to an idle timeout and a lifetime ceiling — see Output limits and stream lifetime.number | null
An upper bound for the number of output tokens, including visible output tokens and reasoning tokens. A value above the model’s own ceiling is rejected with
400 rather than reduced. See Output limits.number | null
Sampling temperature between 0 and 2. Higher values increase randomness.
number | null
Nucleus sampling parameter. An alternative to sampling with temperature.
number
Sample only from the top K options for each subsequent token. Used to remove “long tail” low-probability responses.
number | null
Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text.
number | null
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they already appear in the text.
integer | null
An integer specifying the number of most likely tokens to return at each token position.
integer | null
Maximum number of tool calls the model can make in a single response.
object[]
An array of tools the model may call.
Show tool types
Show tool types
- Function
- Web Search Preview
- Web Search
- File Search
- Computer Use Preview
- Code Interpreter
- MCP
- Image Generation
string
required
Value:
function.string
required
The name of the function.
string | null
A description of the function.
object | null
A JSON Schema object defining the function parameters.
boolean | null
Whether strict schema adherence is enabled.
string
required
Value:
web_search_preview or web_search_preview_2025_03_11.string
Size of the search context. Supported values:
low, medium, high.string
required
Value:
web_search or web_search_2025_08_26.string
Size of the search context. Supported values:
low, medium, high.object | null
Domain filters for search results.
Show properties
Show properties
string[] | null
List of allowed domains to restrict search results to.
object
User location information for search personalization.
string
required
Value:
file_search.string[]
required
IDs of vector stores to search.
object
Filters for file search. Can be a comparison filter (
eq, ne, gt, gte, lt, lte) or a compound filter (and, or).integer
Maximum number of results to return.
string
required
Value:
computer_use_preview.number
required
Display height in pixels.
number
required
Display width in pixels.
string
required
The environment. Supported values:
windows, mac, linux, ubuntu, browser.string
required
Value:
code_interpreter.string
required
Value:
mcp.string
required
A label for the MCP server.
string
The URL of the MCP server.
string[] | object
Tools the model is allowed to use from this server.
string | object
Approval requirements for tool calls. String values:
always, never. Can also be an object with never and always lists.object | null
Custom headers to include in requests to the MCP server.
string
Description of the MCP server.
string
required
Value:
image_generation.string
Background type. Supported values:
transparent, opaque, auto.string
Model to use. Supported values:
gpt-image-1, gpt-image-1-mini.string
Image quality. Supported values:
low, medium, high, auto.string
Image size. Supported values:
1024x1024, 1024x1536, 1536x1024, auto.string
Output format. Supported values:
png, webp, jpeg.string
Moderation level. Supported values:
auto, low.number
Compression level for output.
number
Number of partial images to return during generation.
string | object
Controls tool selection behavior. String values:
none, auto, required. Can also specify a particular function or tool type.boolean | null
Whether to allow the model to run tool calls in parallel.
object
Configuration for text response format.
Show properties
Show properties
object
The text format configuration.
Show format types
Show format types
- text
- json_object
- json_schema
string | null
Controls the verbosity of the text output. Supported values:
high, medium, low.object
Configuration for reasoning output.
string[]
Output modalities for the response. Supported values:
text, image.string | null
The ID of a previous response to use as context for this request.
string[]
Additional fields to include in the response. Supported values:
file_search_call.results, message.input_image.image_url, computer_call_output.output.image_url, reasoning.encrypted_content, code_interpreter_call.outputs.boolean
Whether to store the generated response for later retrieval.
string
The service tier to use for this request. Supported values:
auto.string
Truncation strategy. Supported values:
auto, disabled.boolean | null
Whether to run the request in the background.
object
Set of key-value pairs that can be attached to the response. Keys must be ≤64 characters. Values must be ≤512 characters. Maximum 16 pairs allowed.
string
A unique identifier representing your end-user. Maximum of 128 characters.
Response
Successful response object.string
Unique response identifier.
string
The object type. Always
response.number
Unix timestamp (in seconds) of when the response was created.
number | null
Unix timestamp (in seconds) of when the response completed.
string
The status of the response. Possible values:
completed, incomplete, in_progress, failed, cancelled, queued.string
The model used for generating the response.
object[]
An array of output items generated by the model.
Show output item types
Show output item types
- OutputMessage
- Reasoning
- FunctionCall
- WebSearchCall
- FileSearchCall
- ImageGenerationCall
string
Value:
message.string
The unique ID of the output message.
string
Always
assistant.string
Status of the message. Possible values:
completed, incomplete, in_progress.object[]
The content of the output message.
Show content types
Show content types
- OutputText
- Refusal
string
Value:
output_text.string
The generated text content.
object[]
Annotations for the content. Types include:
file_citation:{type, file_id, filename, index}url_citation:{type, url, title, start_index, end_index}file_path:{type, file_id, index}
object[]
Log probability information for output tokens. Each item contains
token, bytes, logprob, and top_logprobs.string
The phase of the message. Possible values:
commentary, final_answer.string
Value:
reasoning.string
The unique ID of the reasoning item.
object[] | null
Array of reasoning text items, each with
type: "reasoning_text" and text.object[]
Array of reasoning summary items, each with
type: "summary_text" and text.string | null
Encrypted reasoning content.
string
Status. Possible values:
completed, incomplete, in_progress.string | null
A signature for the reasoning content, used for verification.
string | null
The format of the reasoning content. Possible values:
unknown, openai-responses-v1, azure-openai-responses-v1, xai-responses-v1, anthropic-claude-v1, google-gemini-v1.string
Value:
function_call.string
The unique ID of the function call.
string
The name of the function called.
string
The arguments in JSON string format.
string
The call ID for matching with function call output.
string
Status. Possible values:
completed, incomplete, in_progress.string
Value:
web_search_call.string
The unique ID of the web search call.
object
The search action. Types include:
search:{type, query, queries?, sources?}open_page:{type, url}find_in_page:{type, pattern, url}
string
Status. Possible values:
completed, searching, in_progress, failed.string
Value:
file_search_call.string
The unique ID of the file search call.
string[]
The search queries used.
string
Status. Possible values:
completed, searching, in_progress, failed.string
Convenience field containing the concatenated text output from all output messages.
object | null
Details about why the response is incomplete, if applicable.
Show properties
Show properties
string
The reason. Possible values:
max_output_tokens, content_filter.object | null
An error object if the generation failed.
Show properties
Show properties
string
Error code. Possible values:
server_error, rate_limit_exceeded, invalid_prompt, vector_store_timeout, invalid_image, invalid_image_format, invalid_base64_image, invalid_image_url, image_too_large, image_too_small, image_parse_error, image_content_policy_violation, invalid_image_mode, image_file_too_large, unsupported_image_media_type, empty_image_file, failed_to_download_image, image_file_not_found.string
Human-readable error message.
object
Token usage statistics for the response.
number | null
The sampling temperature used.
number | null
The nucleus sampling value used.
number | null
The max output tokens setting used.
number
The top logprobs setting used.
number | null
The max tool calls setting used.
number | null
The presence penalty used.
number | null
The frequency penalty used.
string | object[] | null
The instructions/system message used.
object
The metadata attached to the response.
object[]
The tools configuration used.
string | object
The tool choice configuration used.
boolean
Whether parallel tool calls was enabled.
object
The reasoning configuration used.
string
The service tier used. Possible values:
auto, default, flex, priority, scale.boolean
Whether the response was stored.
string
The truncation strategy used. Possible values:
auto, disabled.object
The text format configuration used.
string | null
The ID of the previous response used as context.
boolean | null
Whether the request ran in the background.
curl -X POST https://api-llm.sunra.ai/v1/responses \
-H "Authorization: Bearer <SUNRA_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-2.5-flash",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}'
import requests
response = requests.post(
"https://api-llm.sunra.ai/v1/responses",
headers={
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
json={
"model": "google/gemini-2.5-flash",
"input": [
{
"type": "message",
"role": "user",
"content": "Hello, how are you?"
}
]
}
)
print(response.json())
const response = await fetch("https://api-llm.sunra.ai/v1/responses", {
method: "POST",
headers: {
"Authorization": "Bearer <SUNRA_KEY>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "google/gemini-2.5-flash",
input: [
{
type: "message",
role: "user",
content: "Hello, how are you?"
}
]
})
});
const data = await response.json();
console.log(data);
{
"id": "resp-abc123",
"object": "response",
"created_at": 1704067200,
"completed_at": 1704067201,
"status": "completed",
"model": "google/gemini-2.5-flash",
"output": [
{
"type": "message",
"id": "msg_abc123",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"annotations": []
}
]
}
],
"output_text": "Hello! I'm doing well, thank you for asking. How can I help you today?",
"incomplete_details": null,
"error": null,
"temperature": 1.0,
"top_p": 1.0,
"max_output_tokens": null,
"top_logprobs": 0,
"presence_penalty": null,
"frequency_penalty": null,
"instructions": null,
"metadata": {},
"tools": [],
"tool_choice": "auto",
"parallel_tool_calls": true,
"reasoning": null,
"service_tier": "auto",
"store": true,
"truncation": "disabled",
"text": {
"format": {
"type": "text"
}
},
"usage": {
"input_tokens": 15,
"output_tokens": 18,
"total_tokens": 33,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens_details": {
"reasoning_tokens": 0
}
}
}
⌘I