Responses API
POST https://llmoxy.com/v1/responses принимает JSON. Заголовки:
Authorization: Bearer <LLMOXY_API_KEY>
Content-Type: application/jsonШлюз разбирает тело в фиксированную структуру. Запрос отклоняется, если model пуст, если нет input, или если max_output_tokens больше 1 073 741 823. Поля background в этой структуре нет.
Если передача тела как есть выключена, сохраняются только поля из таблицы, а service_tier, safety_identifier и stream_options.include_obfuscation по умолчанию убираются. store сохраняется. Явный 0 у допускающего пустое число и явный false у stream всё равно отправляются. Логическое false внутри stream_options при пересборке опускается. Поля вне таблицы не отправляются.
Поля запроса
| Поле | Тип | Обязательно | Поведение шлюза |
|---|---|---|---|
model | string | да | Непустой ID модели. |
input | string или array | да | Должно присутствовать. Строка считается одним фрагментом входного текста. У элементов массива может быть role. Строковый content считается текстом. Массив content распознаёт input_text, input_image и input_file. image_url и file_url могут быть строкой или объектом с url. |
include | JSON | нет | Сохраняется как пришло. |
conversation | JSON | нет | Сохраняется как пришло. |
context_management | JSON | нет | Сохраняется как пришло. |
instructions | JSON | нет | Сохраняется как пришло. Обычно это строка. |
max_output_tokens | number | нет | Допускает пустое значение. Явный 0 сохраняется. |
top_logprobs | number | нет | Допускает пустое значение. Явный 0 сохраняется. |
metadata | JSON | нет | Сохраняется как пришло. |
parallel_tool_calls | JSON | нет | Сохраняется как пришло. Явный false сохраняется. |
previous_response_id | string | нет | Пустая строка опускается. |
reasoning.effort | string | нет | Пустая строка опускается. Значение не проверяется. |
reasoning.summary | string | нет | Пустая строка опускается. Значение не проверяется. |
service_tier | string | нет | Убирается по умолчанию. |
store | JSON | нет | Сохраняется по умолчанию. Явный false сохраняется. |
prompt_cache_key | JSON | нет | Сохраняется как пришло. |
prompt_cache_retention | JSON | нет | Сохраняется как пришло. |
safety_identifier | JSON | нет | Убирается по умолчанию. |
stream | boolean | нет | Отсутствие означает запрос без потока. Явный false сохраняется. |
stream_options.include_usage | boolean | нет | При пересборке false опускается. |
stream_options.include_obfuscation | boolean | нет | Убирается по умолчанию. При пересборке false опускается. |
temperature | number | нет | Допускает пустое значение. Явный 0 сохраняется. |
text | JSON | нет | Сохраняется как пришло. |
tool_choice | JSON | нет | Сохраняется как пришло. |
tools | JSON | нет | Сохраняется как пришло. |
top_p | number | нет | Допускает пустое значение. Явный 0 сохраняется. |
truncation | JSON | нет | Сохраняется как пришло. |
user | JSON | нет | Сохраняется как пришло. |
max_tool_calls | number | нет | Допускает пустое значение. Явный 0 сохраняется. |
prompt | JSON | нет | Сохраняется как пришло. |
enable_thinking | JSON | нет | Сохраняется как пришло. |
preset | JSON | нет | Сохраняется как пришло. |
grok-4.6 и grok-4.7
2026-10-03 потоковые вызовы https://llmoxy.com/v1/responses для grok-4.6 и grok-4.7 оба вернули HTTP 200 и одну и ту же последовательность событий.
| Модель | HTTP | model в ответе | status | Текст | input / output / total |
|---|---|---|---|---|---|
grok-4.6 | 200 | grok-4.6 | completed | pong | 212 / 98 / 310 |
grok-4.7 | 200 | grok-4.7 | completed | pong | 1248 / 55 / 1303 |
У grok-4.6 поле input_tokens_details.cached_tokens было 128, а output_tokens_details.reasoning_tokens было 97. У grok-4.7 эти значения были 1152 и 54.
Видимый текст лежит в элементе output с type message, в content с type output_text, поле text. Обе модели сначала отдают элемент с type reasoning. В response.completed у этого элемента status остаётся in_progress.
Запросы этих двух моделей передают тело как есть, поэтому минимальный JSON следующего раздела отправляется так, как его написал клиент.
Минимальный успешный запрос
Для grok-4.6 используйте то же тело и укажите model равным grok-4.6.
Content-Type ответа — text/event-stream. Каждое событие — это строка event: и строка data:. Шлюз пересылает исходный JSON разобранного события, а имя события берёт из JSON-поля type. Поток заканчивается последним событием response.completed.
Обе модели присылают одни и те же имена в таком порядке:
response.created, response.in_progress, response.output_item.added, response.reasoning_summary_part.added, response.reasoning_summary_text.delta, response.reasoning_summary_text.delta, response.reasoning_summary_text.done, response.reasoning_summary_part.done, response.output_item.done, response.output_item.added, response.content_part.added, response.output_text.delta, response.output_text.done, response.content_part.done, response.output_item.done, response.completed.
Ниже ответ grok-4.7. Идентификаторы ответа и элементов заменены заглушками. Остальные поля совпадают с этим ответом.
event: response.created
data: {"type":"response.created","sequence_number":0,"response":{"object":"response","id":"resp_example","created_at":1791015238,"model":"grok-4.7","output":[],"status":"in_progress"},"output_index":0}
event: response.in_progress
data: {"type":"response.in_progress","sequence_number":1,"response":{"object":"response","id":"resp_example","created_at":1791015238,"model":"grok-4.7","output":[],"status":"in_progress"},"output_index":0}
event: response.output_item.added
data: {"type":"response.output_item.added","sequence_number":2,"output_index":0,"item":{"id":"item_reasoning","type":"reasoning","status":"in_progress","summary":[]}}
event: response.reasoning_summary_part.added
data: {"type":"response.reasoning_summary_part.added","sequence_number":3,"output_index":0,"item_id":"item_reasoning","part":{"type":"summary_text","text":""},"summary_index":0}
event: response.reasoning_summary_text.delta
data: {"type":"response.reasoning_summary_text.delta","sequence_number":4,"output_index":0,"item_id":"item_reasoning","delta":"The user wants a reply","summary_index":0}
event: response.reasoning_summary_text.delta
data: {"type":"response.reasoning_summary_text.delta","sequence_number":5,"output_index":0,"item_id":"item_reasoning","delta":" of exactly \"pong\".","summary_index":0}
event: response.reasoning_summary_text.done
data: {"type":"response.reasoning_summary_text.done","sequence_number":6,"output_index":0,"item_id":"item_reasoning","text":"The user wants a reply of exactly \"pong\".","summary_index":0}
event: response.reasoning_summary_part.done
data: {"type":"response.reasoning_summary_part.done","sequence_number":7,"output_index":0,"item_id":"item_reasoning","part":{"type":"summary_text","text":"The user wants a reply of exactly \"pong\"."},"summary_index":0}
event: response.output_item.done
data: {"type":"response.output_item.done","sequence_number":8,"output_index":0,"item":{"id":"item_reasoning","type":"reasoning","summary":[{"text":"The user wants a reply of exactly \"pong\".","type":"summary_text"}]}}
event: response.output_item.added
data: {"type":"response.output_item.added","sequence_number":9,"output_index":1,"item":{"id":"item_message","type":"message","role":"assistant","content":[],"status":"in_progress"}}
event: response.content_part.added
data: {"type":"response.content_part.added","sequence_number":10,"output_index":1,"item_id":"item_message","content_index":0,"part":{"type":"output_text","text":"","annotations":[]}}
event: response.output_text.delta
data: {"type":"response.output_text.delta","sequence_number":11,"output_index":1,"item_id":"item_message","content_index":0,"delta":"pong"}
event: response.output_text.done
data: {"type":"response.output_text.done","sequence_number":12,"output_index":1,"item_id":"item_message","content_index":0,"text":"pong"}
event: response.content_part.done
data: {"type":"response.content_part.done","sequence_number":13,"output_index":1,"item_id":"item_message","content_index":0,"part":{"type":"output_text","text":"pong","annotations":[]}}
event: response.output_item.done
data: {"type":"response.output_item.done","sequence_number":14,"output_index":1,"item":{"id":"item_message","type":"message","role":"assistant","content":[{"type":"output_text","annotations":[],"text":"pong"}],"status":"completed"}}
event: response.completed
data: {"type":"response.completed","sequence_number":15,"response":{"object":"response","id":"resp_example","created_at":1791015238,"model":"grok-4.7","output":[{"id":"item_reasoning","type":"reasoning","status":"in_progress","summary":[{"text":"The user wants a reply of exactly \"pong\".","type":"summary_text"}]},{"id":"item_message","type":"message","role":"assistant","content":[{"type":"output_text","text":"pong"}],"status":"completed"}],"status":"completed","usage":{"input_tokens":1248,"input_tokens_details":{"cached_tokens":1152},"output_tokens":55,"output_tokens_details":{"reasoning_tokens":54},"total_tokens":1303}},"output_index":0}Сжатие диалога
POST https://llmoxy.com/v1/responses/compactПоля: model (обязательно), input, instructions, previous_response_id. Проверки grok выше этот маршрут не вызывали.
