Skip to content

Add Responses API support for OpenRouter provider#1528

Open
chtushar wants to merge 3 commits intoPortkey-AI:mainfrom
chtushar:chtushar/openrouter-responses-api
Open

Add Responses API support for OpenRouter provider#1528
chtushar wants to merge 3 commits intoPortkey-AI:mainfrom
chtushar:chtushar/openrouter-responses-api

Conversation

@chtushar
Copy link

@chtushar chtushar commented Feb 18, 2026

Description:

  • Added endpoint mappings for OpenRouter Responses API: POST /v1/responses, GET /v1/responses/:id, DELETE /v1/responses/:id, GET /v1/responses/:id/input_items
  • Reuses open-ai-base infrastructure for request parameter mapping and response transformation
  • Supports OpenRouter-specific parameters: provider routing, plugins, top_k, frequency_penalty, presence_penalty, session_id, and trace
  • Both streaming and non-streaming modes are supported via native SSE passthrough and JSON-to-stream conversion for cache hits

Tests Run/Test cases added:

  • Type-checked with TypeScript compiler (no new errors introduced)
  • Build succeeds with Rollup
  • All existing gateway unit tests pass (47/47)

Type of Change:

  • New feature (non-breaking change which adds functionality)

Fixes
#1527

@chtushar chtushar marked this pull request as ready for review February 18, 2026 15:01
Implement support for the OpenRouter Responses API endpoints by adding
endpoint mappings and configuration for POST /v1/responses, GET
/v1/responses/:id, DELETE /v1/responses/:id, and GET /v1/responses/:id/input_items.

Reuses the open-ai-base infrastructure for request parameter mapping and
response transformation. Supports OpenRouter-specific parameters including
provider routing, plugins, sampling, penalties, session management, and tracing.
@chtushar chtushar force-pushed the chtushar/openrouter-responses-api branch from 43519b0 to b585c21 Compare February 26, 2026 14:16
Comment on lines +18 to +25
case 'createModelResponse':
return '/v1' + basePath;
case 'getModelResponse':
return '/v1' + basePath;
case 'deleteModelResponse':
return '/v1' + basePath;
case 'listResponseInputItems':
return '/v1' + basePath;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to relook if this is correct. We need to give proper endpoint similar to /v1/chat/completions.

Address PR feedback: use explicit /v1/responses path for createModelResponse
instead of basePath passthrough. Dynamic basePath is still used for get, delete,
and listResponseInputItems since those include route parameters.
Copy link
Member

@narengogi narengogi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chtushar
please revert package-lock changes rest looks fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants