debug option that allows you to inspect the exact request body that was sent to the upstream provider. This works with both the Chat Completions API (/api/v1/chat/completions) and the Responses API (/api/v1/responses). Useful for understanding how OpenRouter transforms your request parameters for different providers.
Debug option shape
The debug option is an object with the following shape:Usage
To enable debug output, include thedebug parameter in your request:
Chat Completions
Output
Responses API
Output
Debug response format
Chat Completions
Whendebug.echo_upstream_body is set to true, OpenRouter sends a debug chunk as the first chunk in the streaming response. This chunk has an empty choices array and includes a debug field with the transformed request body:
Responses API
On the Responses API, debug data arrives as aresponse.debug SSE event:
Important notes
Use cases
The debug output is particularly useful for:-
Understanding Parameter Transformations: See how OpenRouter maps your parameters to provider-specific formats (e.g., how
max_tokensis set, howtemperatureis handled). - Verifying Message Formatting: Check how OpenRouter combines and formats your messages for different providers (e.g., how system messages are concatenated, how user messages are merged).
- Checking Applied Defaults: See what default values OpenRouter applies when parameters are not specified in your request.
- Debugging Provider Fallbacks: When using provider fallbacks, a debug chunk will be sent for each attempted provider, allowing you to see which providers were tried and what parameters were sent to each.