← Back to PRs

#10961: feat: Support routingHint and improve URL routing for Anthropic (Claude Max) subscriptions

by catveloper open 2026-02-07 07:09 View on GitHub →
commands agents stale
## Summary This PR adds support for the `routingHint` parameter in Anthropic (Claude Max/Pro) subscription-based "token" authentication. It also improves the onboarding flow to optionally prompt for this value and ensures that the authentication headers correctly include the routing hint when provided. ## Changes - **Credential Schemas**: Added `routingHint` to `TokenCredential` and `OAuthCredential` types. - **Zod Schema**: Updated `OpenClawSchema` to include `routingHint` in auth profiles. - **Onboarding**: Updated the Anthropic onboarding flow to ask for an optional routing hint when using setup-tokens or session tokens. - **Auth Logic**: Updated `buildOAuthApiKey` and `resolveApiKeyForProfile` to include the `routingHint` in the returned API key payload for the Anthropic provider. ## Why this is needed Claude Max/Pro subscription sessions often require a `routingHint` to correctly route requests through Anthropic's infrastructure. Without this, users frequently encounter 401 (Unauthorized) errors even with valid session tokens. Additionally, the default URL patterns for standard API keys often cause 404 errors when used with subscription tokens; this PR provides the infrastructure to pass necessary hints to the underlying model provider. ## Verification Tested locally by manually injecting the `routingHint` into `auth-profiles.json` and verifying successful communication with Claude Opus 4.6 using a Max subscription. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> - Adds an optional `routingHint` field to auth profile config/schema and to token/OAuth credential types. - Updates Anthropic onboarding to prompt for and persist a `routingHint` alongside setup/session tokens. - Extends API key resolution to wrap Anthropic token/OAuth auth material as JSON `{ token, routingHint }` when a routing hint is present. - Updates OAuth API key construction to optionally emit routing-hint payloads for Anthropic in addition to existing Google projectId payloads. <h3>Confidence Score: 3/5</h3> - This PR is close to merge-ready but has a functional issue where Anthropic routingHint can be dropped after OAuth refresh, and the onboarding flow can persist invalid routingHint values. - Core schema/type changes are straightforward, but the OAuth refresh path returns an apiKey that is not re-wrapped with routingHint (so behavior changes over time), and the new routingHint prompt has no validation, increasing likelihood of persistent misconfiguration. - src/agents/auth-profiles/oauth.ts; src/commands/auth-choice.apply.anthropic.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs