Skip to content

feat: add OpenRouter provider with full dispatch wiring#1107

Closed
ghshhf wants to merge 2 commits into
ScrapeGraphAI:mainfrom
ghshhf:feat/openrouter-provider
Closed

feat: add OpenRouter provider with full dispatch wiring#1107
ghshhf wants to merge 2 commits 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.

Contributor and others added 2 commits June 20, 2026 06:54
- Fix filename typos: schema_trasform.py -> schema_transform.py
- Fix filename typos in examples: serch_graph_scehma -> search_graph_schema,
  screenshot_scaping -> screenshot_scraping, undected_playwright -> undetected_playwright
- Fix variable typos: simplefied_schema -> simplified_schema
- Fix comment/log typos: exctrcated -> extracted, deisred -> desired,
  infromation -> information, Synax -> Syntax, informations -> information
- Fix pyproject.toml typo: scraperaphai -> scrapegraphai
- Fix example prompt typo: Appke -> Apple
- Fix TODO in burr_bridge.py: use app_instance_id from config instead of
  always generating random UUID
- Fix TODO in burr_bridge.py: proper final node detection instead of
  relying on last action
- Improve docstring grammar in prompt_refiner_node.py and reasoning_node.py
- Add type annotations to schema_transform.py
- Write missing tests for test_json_scraper_multi_graph.py (was empty)
- Write missing tests for test_smart_scraper_multi_concat_graph.py (was empty)
- Add ValueError to schema_transform.py for invalid input
- Fix ReasoningNode default node_name from PromptRefiner to ReasoningNode
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request tests Improvements or additions to test labels Jul 13, 2026
@ghshhf ghshhf closed this Jul 13, 2026
@ghshhf
ghshhf deleted the feat/openrouter-provider branch July 13, 2026 15:11
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:L This PR changes 100-499 lines, ignoring generated files. tests Improvements or additions to test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant