Skip to content

Add an OpenRouterModel #2936

@DouweM

Description

@DouweM

Description

The OpenRouter API is mostly but not completely OpenAI Chat Completions-compatible, so using OpenAIChatModel with OpenRouterProvider mostly works, but not entirely:

And some OpenRouter-only features cannot currently be implemented easily:

Two PR to implement an OpenRouterModel was recently submitted, but it involved too much duplication with OpenAIChatModel for my taste, instead of subclassing and only changing what's necessary: #1870 #2409. However, the Groq and HuggingFace models basically copy-paste OpenAIChatModel as well, so I think the benefit outweighs the cost. I've reopened the most recent of those 2 PRs.

References

No response

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions