feat: add OrcaRouter as a provider for the LLM analysis pass - #135
Open
kuswardhanietidims-svg wants to merge 1 commit into
Open
feat: add OrcaRouter as a provider for the LLM analysis pass#135kuswardhanietidims-svg wants to merge 1 commit into
kuswardhanietidims-svg wants to merge 1 commit into
Conversation
Add ORCAROUTER_API_KEY support to LLMSEOEnhancer. When set, the AI optimization pass is routed through OrcaRouter's Anthropic-compatible endpoint (https://api.orcarouter.ai) instead of Anthropic directly. OrcaRouter exposes many models under a vendor/model namespace; the default is anthropic/claude-sonnet-4.6 and can be overridden with the ORCAROUTER_MODEL environment variable. Update README with the new env var and Docker usage, and extend the LLMSEOEnhancer unit tests to cover both provider paths. Co-Authored-By: Claude <noreply@anthropic.com>
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.
What & why
The AI optimization pass currently routes through Anthropic only — you set
ANTHROPIC_API_KEYand--run-llm-analysisevaluates content withclaude-3-sonnet-20240229. This PR adds a second first-class provider: setORCAROUTER_API_KEYinstead and the same analysis runs through OrcaRouter, an OpenAI- and Anthropic-compatible AI gateway.OrcaRouter is a single endpoint in front of many models (OpenAI, Anthropic, Google, DeepSeek, and more) plus adaptive routing, automatic failover, zero-markup inference, observability, guardrails, and agent-tool governance. It also runs gateway-level, zero-trust security for AI agents on the same endpoint — screening every prompt/response and governing every tool call on a default-deny basis, with no application code changes. Because it speaks the Anthropic protocol, this project's existing
ChatAnthropicwiring works unchanged:LLMSEOEnhancerjust pointsanthropic_api_urlat OrcaRouter's endpoint and uses OrcaRouter'svendor/modelnamespace.That means this project's users get the whole OrcaRouter stack without treating it as an anonymous custom base URL — the same way Anthropic is already a named provider here.
What changed
pyseoanalyzer/llm_analyst.py— whenORCAROUTER_API_KEYis set,LLMSEOEnhancerbuilds aChatAnthropicinstance pointed athttps://api.orcarouter.ai, defaulting to theanthropic/claude-sonnet-4.6model (configurable viaORCAROUTER_MODEL, e.g.openai/gpt-4o). Otherwise the original Anthropic path is used, unchanged.README.md— documents the new env var in the AI Optimization section and adds Docker--run-llm-analysisexamples for both pre-built and locally-built images.tests/test_llm_analyst.py— covers both provider paths and theORCAROUTER_MODELoverride.Verification
main— themax_pagesmock mismatch intest_analyzer.py, the crawler-access HTTP mocks intest_website.py, and the LLM integration tests that need a real key — are unchanged; theLLMSEOEnhancerinit tests now pass).ORCAROUTER_API_KEY: the fullenhance_seo_analysispipeline (entity, credibility, conversation, platform, recommendations) completed end-to-end withopenai/gpt-4ovia OrcaRouter, and a rawChatAnthropicinvoke againstanthropic/claude-sonnet-4.6returned a valid completion.Discord: discord.gg/YEubt8enRA · X: https://x.com/OrcaRouter
I'm an engineer on the OrcaRouter team.