Skip to content

feat: add OrcaRouter as a provider for the LLM analysis pass - #135

Open
kuswardhanietidims-svg wants to merge 1 commit into
sethblack:mainfrom
kuswardhanietidims-svg:feat/add-orcarouter-provider
Open

feat: add OrcaRouter as a provider for the LLM analysis pass#135
kuswardhanietidims-svg wants to merge 1 commit into
sethblack:mainfrom
kuswardhanietidims-svg:feat/add-orcarouter-provider

Conversation

@kuswardhanietidims-svg

Copy link
Copy Markdown

What & why

The AI optimization pass currently routes through Anthropic only — you set ANTHROPIC_API_KEY and --run-llm-analysis evaluates content with claude-3-sonnet-20240229. This PR adds a second first-class provider: set ORCAROUTER_API_KEY instead 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 ChatAnthropic wiring works unchanged: LLMSEOEnhancer just points anthropic_api_url at OrcaRouter's endpoint and uses OrcaRouter's vendor/model namespace.

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 — when ORCAROUTER_API_KEY is set, LLMSEOEnhancer builds a ChatAnthropic instance pointed at https://api.orcarouter.ai, defaulting to the anthropic/claude-sonnet-4.6 model (configurable via ORCAROUTER_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-analysis examples for both pre-built and locally-built images.
  • tests/test_llm_analyst.py — covers both provider paths and the ORCAROUTER_MODEL override.

Verification

  • Existing test suite: no regressions (the pre-existing failures on main — the max_pages mock mismatch in test_analyzer.py, the crawler-access HTTP mocks in test_website.py, and the LLM integration tests that need a real key — are unchanged; the LLMSEOEnhancer init tests now pass).
  • Live test through the new code path with ORCAROUTER_API_KEY: the full enhance_seo_analysis pipeline (entity, credibility, conversation, platform, recommendations) completed end-to-end with openai/gpt-4o via OrcaRouter, and a raw ChatAnthropic invoke against anthropic/claude-sonnet-4.6 returned a valid completion.

Discord: discord.gg/YEubt8enRA · X: https://x.com/OrcaRouter

I'm an engineer on the OrcaRouter team.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant