#Openrouter incorrectly modifies messages array and breaks interleaved reasoning on gpt-oss models

19 messages · Page 1 of 1 (latest)

ocean roostBOT
#

@rocky basin

Description:
OpenRouter is incorrectly modifying the messages array on /chat/completions and removing the empty assistant messages and assistant tool calls that gpt-oss emits. The model therefore doesn't respect previous reasoning and tool call arguments and interleaved thinking fails, causing the model to re-reason the entire response over and over again, including repeating tool calls multiple times.

What I've Tried:
I already tried to replicate the behavior with an minimal payload sent to both OpenRouter and the upstream model provider (Groq). On Groq, the model respects the tool calls and interleaved thinking correctly. The response generated by OpenRouter doesn't, so this is clearly an issue on OpenRouter's side.

API/Model: openai/gpt-oss-120b

#

I'm an AI assistant - my answers may be incorrect and I cannot see screenshots. Please verify information with the OpenRouter docs.

To help debug this issue further, I need a bit more information:

  1. Can you share the exact API response or error you're receiving from OpenRouter when calling openai/gpt-oss-120b?
  2. Can you provide the exact payload (messages array and parameters) you are sending to OpenRouter?
  3. Are you using any specific sampling parameters or tool_call settings in your request?

These details will help me (and the mods if we need to escalate) pinpoint the root cause of how the messages array is being processed.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding, or !close when your question is resolved.

rocky basin
#

I sent the following payloads to both Groq and OpenRouter with provider.only=Groq. To ensure the same output on every response I used the "seed" parameter. Different Output from the original model provider confirms Openrouter incorrectly modifies the request.

Payload for OpenRouter:

{
  "model": "openai/gpt-oss-120b",
  "messages": [
    {
      "role": "user",
      "content": "Output the word."
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "The secret word is 'chicken'. Need to output."
    }
  ],
  "temperature": 1,
  "max_completion_tokens": 8192,
  "top_p": 1,
  "stop": null,
  "reasoning_effort": "low",
  "include_reasoning": true,
  "seed": 12345678,
  "provider": {
    "only": [
      "groq"
    ]
  }
}

Same Payload for Groq:

{
  "model": "openai/gpt-oss-120b",
  "messages": [
    {
      "role": "user",
      "content": "Output the word."
    },
    {
      "role": "assistant",
      "content": "",
      "reasoning": "The secret word is 'chicken'. Need to output."
    }
  ],
  "temperature": 1,
  "max_completion_tokens": 8192,
  "top_p": 1,
  "stop": null,
  "reasoning_effort": "low",
  "include_reasoning": true,
  "seed": 12345678
}
#

Response from Groq (as intended):

{
  "id": "chatcmpl-255b6c65-eb54-47be-8982-f491a35fb081",
  "object": "chat.completion",
  "created": 1770716981,
  "model": "openai/gpt-oss-120b",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "chicken"
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage_breakdown": null,
  "system_fingerprint": "fp_309cec8e88",
  "service_tier": "on_demand"
}

Incorrect Response from OpenRouter:

{
  "id": "gen-1770717013-XiiB7Go1Hd3Z1dKaWKnk",
  "provider": "Groq",
  "model": "openai/gpt-oss-120b",
  "object": "chat.completion",
  "created": 1770717013,
  "choices": [
    {
      "logprobs": null,
      "finish_reason": "stop",
      "native_finish_reason": "stop",
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello",
        "refusal": null,
        "reasoning": "The user says \"Output the word.\" ambiguous. Probably they want a word? Could respond with a word like \"Hello\"."
      }
    }
  ],
  "system_fingerprint": "fp_4f366d0fc3"
}
ocean roostBOT
#

Thank you for providing detailed examples and the exact model identifier (openai/gpt-oss-120b). Based on available documentation, OpenRouter "normalizes requests and responses across providers" and specifically supports features like step-by-step reasoning through the reasoning parameter, with a requirement to "preserve the complete reasoning_details when passing messages back to the model so it can continue reasoning from where it left off" gpt-oss-120b (exacto) - API, Providers, Stats.

However, there is no documentation explicitly stating that OpenRouter modifies, removes, or alters empty assistant messages or tool calls in the messages array. The docs do note that OpenRouter "normalizes requests and responses across providers" but do not detail the internal handling of tool calls or empty assistant messages.

If OpenRouter's normalization is breaking interleaved reasoning or tool use—by removing message objects required for correct model function—this is not documented and may be a bug or implementation issue.

Next steps:

  • I recommend escalating this to the OpenRouter team or mods for review, as this behavior isn't covered in the public documentation and may require internal changes or clarification.
  • You can contact mods through the Discord server for further investigation.
  • For reference, see: "OpenRouter supports reasoning-enabled models ... When continuing a conversation, preserve the complete reasoning_details when passing messages back to the model so it can continue reasoning from where it left off." gpt-oss-120b (exacto) - API, Providers, Stats.

If you need to provide further logs or examples, please include the full body of your r...

#

...equest and the raw response as you have here—that will help the support team diagnose the root cause.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding, or !close when your question is resolved.

#

Thank you for providing the payload details and confirming that responses differ between OpenRouter and Groq, even when using provider.only = ["groq"] and a fixed seed.

Based on the Provider Routing documentation, OpenRouter should route your request directly to the specified provider when you use the only field. However, there is no documentation stating that OpenRouter modifies the messages array or strips empty assistant messages or tool calls before forwarding to the provider. The docs only describe routing and filtering logic, not payload mutation:

"You can allow only specific providers for a request by setting the only field in the provider object..." and "When you allow providers for a specific request, the list of allowed providers is merged with your account-wide allowed providers."

There is no mention of payload alteration in this process.
Provider Routing

Since you are observing a difference in behavior and suspect OpenRouter is modifying the messages payload in a way that breaks interleaved reasoning for openai/gpt-oss-120b, this may be a bug or unintended behavior on OpenRouter's side.

I recommend sharing your findings (including the exact payloads and responses) with the mods for further investigation. This type of technical issue likely requires escalation to the OpenRouter support team or engineering staff for a resolution.

For reference:

  • Make sure to specify that you are targeting the exact model identifier openai/gpt-oss-120b
  • Include all relevant payload and output details as you have here

You can contact the mods through this Discord server for escalation. If you have spent over $10 on your accou...

#

...nt, you may also email [email protected] for further assistance. Otherwise, Discord is the main support channel.

If you need to reference the docs for routing or provider selection, see:
Provider Routing
Provider Preferences

Let me know if you need help formatting your report for the mods or have additional debugging information to add.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding, or !close when your question is resolved.

rocky basin
#

This issue just recently occured. Some change on openrouters end broke the handling of reasoning. What is the fastest way to contact your engineers for assistance?

#

<@&1384697330254610442>

trim forge
rocky basin
trim forge
rocky basin
#

The feature should be supported on all providers. Interleaved reasoning is standard in the reference implementation of the harmony response format for gpt-oss. The spec only says that reasoning should be cleared after an output in final channel (message.content). See https://developers.openai.com/cookbook/articles/openai-harmony

The gpt-oss models were trained on the harmony response format for defining conversation structures, generating reasoning output and structu

#

I just tested this with upstream cerebras api, it is also supported there

#

Google vertex also seems to handle this correctly

trim forge
rocky basin
#

yes

rocky basin