Skip to content

feat: add OpenRouter provider with full dispatch wiring#1109

Closed
ghshhf wants to merge 1 commit into
ScrapeGraphAI:mainfrom
ghshhf:feat/openrouter-provider
Closed

feat: add OpenRouter provider with full dispatch wiring#1109
ghshhf wants to merge 1 commit into
ScrapeGraphAI:mainfrom
ghshhf:feat/openrouter-provider

Conversation

@ghshhf

@ghshhf ghshhf commented Jul 13, 2026

Copy link
Copy Markdown

Adds OpenRouter as a first-class provider (closes the openrouter support request, e.g. #274).

OpenRouter is an OpenAI-compatible gateway to hundreds of models. This PR:

  • adds scrapegraphai/models/openrouter.py (ChatOpenAI wrapper, base URL https://openrouter.ai/api/v1)
  • registers it in models/__init__.py and helpers/models_tokens.py
  • wires it into graphs/abstract_graph._create_llm (adds openrouter to known_providers and the dispatch branch) so model: "openrouter/<model>" actually resolves. Without this wiring the provider class is never instantiated (the same gap left by the open Atlas Cloud PR Add Atlas Cloud OpenAI-compatible model wrapper #1104).
  • adds tests/test_openrouter_model.py mirroring the Atlas Cloud test

Usage:

graph_config = {"llm": {"model": "openrouter/anthropic/claude-3.5-sonnet", "api_key": OR_KEY}, ...}

Low risk: additive, mirrors the existing DeepSeek/OneApi pattern, and falls back to 8192 tokens if a model is not in the token table.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Jul 13, 2026
@ghshhf ghshhf closed this Jul 13, 2026
@ghshhf
ghshhf deleted the feat/openrouter-provider branch July 13, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant