Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds LiteLLM as a model provider, so a graph can run on any provider the LiteLLM SDK supports (Anthropic, Bedrock, Vertex AI, Azure, Gemini, Groq, ...) with
"model": "litellm/<provider>/<model>". LiteLLM is an optional extra (pip install scrapegraphai[litellm]) and is imported lazily, so the base install is unchanged.Changes
scrapegraphai/models/litellm.py:LiteLLMchat model onlitellm.completion/acompletion, withdrop_params=True, provider env var credentials whenapi_keyis not set, and usage and cost in the response metadata.abstract_graph.py:litellmroute and context window lookup.custom_callback.py: uses the cost a model reports when it is not in the price table.pyproject.toml/uv.lock:litellm>=1.94.0,<1.105.0extra. litellm's minimums also bumpopenai(2.13 to 2.54),aiohttp,boto3/botocore,s3transfer,pydantic-settingsandyarlin the shared lock.test-suite.yml: adds the new test file to the CI list.examples/smart_scraper_graph/litellm/, README note,tests/test_litellm_model.py(23 tests).Tests
ruff,isort,blackclean on changed files.SmartScraperGraphwith a Pydantic schema onlitellm/vertex_ai/gemini-2.5-flash:invokeandainvokeongpt-4.1-mini: cost split into prompt and completion, summed correctly by the callback.