Responses
POST /v1/responses принимает OpenAI Responses-style формат запроса. Он полезен для клиентов, которые отправляют input вместо messages, включая Codex-like tools.
text
POST https://api.rout.my/v1/responsesЗапрос
bash
curl https://api.rout.my/v1/responses \
-H "Authorization: Bearer $ROUTMY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "provider/model-id",
"input": "Explain this API in one sentence."
}'Поля запроса
| Поле | Тип | Обязательное | Примечания |
|---|---|---|---|
model | string | Да | Точный model ID из /v1/models. |
input | string or array | Да | Plain text или массив input messages. |
instructions | string | Нет | Добавляется как system instruction перед user input. |
stream | boolean | Нет | true включает Responses-style SSE events. |
temperature | number | Нет | Sampling temperature. |
top_p | number | Нет | Nucleus sampling. |
max_output_tokens | integer | Нет | Максимум generated output tokens. |
tools | array | Нет | Function tools в Responses format. |
tool_choice | any | Нет | Tool selection. |
metadata | object | Нет | Client metadata. |
previous_response_id | string | Нет | Принимается для совместимости; proxy stateless. |
Message input
json
{
"model": "provider/model-id",
"instructions": "Answer in short paragraphs.",
"input": [
{
"role": "user",
"content": "What should I check before deploying?"
}
]
}Content parts с input_text или text конвертируются во внутренний chat text.
Ответ
json
{
"id": "resp_abc123",
"object": "response",
"created_at": 1744000000,
"status": "completed",
"model": "provider/model-id",
"output": [
{
"type": "message",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Check environment variables, API keys, and logs."
}
]
}
],
"usage": {
"input_tokens": 20,
"output_tokens": 12,
"total_tokens": 32
}
}Streaming
json
{
"model": "provider/model-id",
"input": "Stream a short answer.",
"stream": true
}Streaming responses отправляются как Server-Sent Events с объектами response creation, output text deltas и completion.
Stateless операции
Proxy возвращает response IDs для client compatibility. Persistent retrieval, cancellation и deletion paths могут существовать для compatibility, но саму генерацию стоит считать stateless, если клиент отдельно не хранит состояние диалога.