Skip to content

Feature: Add Responses API support to ChatOpenRouter (use_responses_api=True) #38896

Description

Submission checklist

  • This is a feature request, not a bug report or usage question.
  • I added a clear and descriptive title that summarizes the feature request.
  • I used the GitHub search to find a similar feature request and didn't find it.
  • I checked the LangChain documentation and API reference to see if this feature already exists.
  • This is not related to the langchain-community package.

Package (Required)

  • langchain
  • langchain-openai
  • langchain-anthropic
  • langchain-classic
  • langchain-core
  • langchain-model-profiles
  • langchain-tests
  • langchain-text-splitters
  • langchain-chroma
  • langchain-deepseek
  • langchain-exa
  • langchain-fireworks
  • langchain-groq
  • langchain-huggingface
  • langchain-mistralai
  • langchain-nomic
  • langchain-ollama
  • langchain-openrouter
  • langchain-perplexity
  • langchain-qdrant
  • langchain-xai
  • Other / not sure / general

Feature Description

Feature request

It would be great if langchain-openrouter supported the OpenRouter Responses API in the same way that langchain-openai supports OpenAI's Responses API via use_responses_api=True.

Motivation

OpenRouter now exposes both:

  • Chat Completions API
  • Responses API

However, ChatOpenRouter currently only exposes the Chat Completions interface.

Many production agent systems would benefit from the Responses API, especially for long-context and multi-turn agent workflows.

Why this matters

For production ReAct / LangGraph agents, the Responses API provides several important capabilities:

  • previous_response_id

    • Continue conversations without resending the entire conversation history.
  • Better conversation state management

    • Reduce prompt size for long-running agents.
  • Improved prompt caching

    • Especially useful for very large static system prompts (20k–100k+ tokens).
  • Future compatibility

    • OpenAI is investing new capabilities into the Responses API first.

Currently these features are available when using ChatOpenAI(use_responses_api=True), but not when using ChatOpenRouter.

Suggested API

Ideally the API could mirror langchain-openai:

from langchain_openrouter import ChatOpenRouter

llm = ChatOpenRouter(
    model="openai/gpt-5.6-luna",
    use_responses_api=True,
)

### Use Case

## Real-world use cases

Supporting the Responses API in `ChatOpenRouter` would benefit a wide range of production AI applications, including:

- Long-running customer support conversations
- Enterprise knowledge assistants
- ReAct and LangGraph agents
- Multi-agent systems
- Coding assistants
- Research assistants
- Document analysis workflows
- Autonomous task execution
- Multi-turn planning and reasoning
- Applications with large static system prompts

Many of these applications maintain lengthy conversations and rely on extensive, mostly static instructions, tool definitions, schemas, and examples. With the current Chat Completions API, this context often needs to be resent with every request.

Responses API support would enable applications to continue conversations using `previous_response_id` while taking advantage of OpenRouter's routing capabilities. This can help:

- Reduce the number of prompt tokens sent on each request.
- Lower latency for long-running conversations.
- Improve prompt cache utilization.
- Reduce API costs.
- Simplify conversation state management.
- Better support production-scale agentic workflows.

This would also provide feature parity with `ChatOpenAI(use_responses_api=True)`, allowing developers to use the same LangChain patterns regardless of whether they connect directly to OpenAI or through OpenRouter.

Proposed Solution

No response

Alternatives Considered

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    externalfeature requestRequest for an enhancement / additional functionalityopenrouter`langchain-openrouter` package issues & PRs

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions