Skip to content

feat: route platform LLM calls through CommonStack first - #535

Draft
FlyM1ss wants to merge 1 commit into
mainfrom
feat/commonstack-first
Draft

FlyM1ss wants to merge 1 commit into
mainfrom
feat/commonstack-first

Conversation

@FlyM1ss

@FlyM1ss FlyM1ss commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

DO NOT MERGE — work in progress: the CommonStack-first routing flip still lands on this branch.

Goal: route every platform-credits LLM call through CommonStack first, and fail over to OpenRouter when CommonStack runs out.

Done so far: Claude Haiku 4.5 (anthropic/claude-haiku-4-5) is added to COMMONSTACK_MODEL_ALLOWLIST. CommonStack's /v1/models confirms it serves that exact id.

  • The provider seed is ON CONFLICT DO NOTHING, so changing the constant alone never reaches prod's existing commonstack row.
  • A new migration marker, commonstack-allowlist-v1, fixes that in both the SQLite and Postgres stores. It adds only missing ids and keeps any an admin added.
  • It leaves an unreadable row untouched, and it records the marker even when nothing changed, so an admin's later removal sticks.

To do:

  • Add a platform provider-order helper (ATL_PLATFORM_PROVIDER_ORDER, default commonstack,openrouter). Apply it at model_providers/service.py resolve_platform_execution_candidates and list_execution_options, and at the legacy fallback in execution/service.py.
  • Add a test pinning that a CommonStack exhaustion response triggers failover. The real error CommonStack returns when its balance runs out is unverified: failover keys on HTTP 402 or the balance/quota strings in adapters/base.py.
  • Add a CLAUDE.md env entry.
  • Out of scope: the AI Hedge Fund runtime stays on OpenRouter Nemotron, which CommonStack does not serve.

🤖 Generated with Claude Code

CommonStack's /v1/models lists anthropic/claude-haiku-4-5, so add it to the
verified allowlist. The provider seed is ON CONFLICT DO NOTHING, so the new id
would never reach a deployment whose commonstack row already exists; a one-shot
backfill (commonstack-allowlist-v1) appends missing seeded ids, keeps any an
admin added, leaves an unreadable row alone, and records itself so a later
admin removal sticks.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agentic-trading-lab Ready Ready Preview Sep 25, 2026 9:47pm UTC

This branch was successfully deployed

1 active deployment
Preview — b589505c Deployed Sep 25, 2026 by vercel[bot]
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