Responses

Endpoint

POST /v1/responses

Basic message

Use the OpenResponses API to generate text responses from AI models. The input array contains message objects with a role (user or assistant) and content field. The model processes the input and returns a response with the generated text.

Example request

import os
import requests
import json

url = "https://llm.onerouter.pro/v1/responses"

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <API_KEY>",
}

data = {
    "model": "o4-mini",
    "input": [
        {
            "type": "message",
            "role": "user",
            "content": "Why do developers prefer dark mode?",
        }
    ],
}

response = requests.post(url, headers=headers, json=data)
result = response.json()

print(result)

Response format

The response includes the generated text in the output array, along with token usage information.

Image Input

The OpenResponses API supports sending images alongside text for vision-capable models to analyze. Include an image_url object in your message content array with either a public URL or a base64-encoded data URI. The detail parameter controls the resolution used for analysis.

Base64-encoded images

You can also use base64-encoded images:

Detail parameter

The detail parameter controls image resolution:

  • auto - Let the model decide the appropriate resolution

  • low - Use lower resolution for faster processing

  • high - Use higher resolution for more detailed analysis

Last updated