openclaw - ✅(Solved) Fix [Feature]: OAuth Rotation for same Model Provider (Multi-Team Subscription Support) [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#43681Fetched 2026-04-08 00:17:17
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
1
Author
Participants
Timeline (top)
cross-referenced ×1labeled ×1

I am requesting an enhancement to the Auth Profile system to support multiple team subscriptions under the exact same OAuth account. This would allow users with multiple business tier subscriptions (like OpenAI Codex) to fully utilize OpenClaw's built-in fallback and auth rotation mechanisms.

Current Behavior

Desired Behavior

Use Case

Environment

Provider: openai-codex

Component: Auth Profile Manager / CLI

Error Message

Better Developer Experience: Eliminates the need for manual, error-prone edits to the configuration JSON files.

Root Cause

I am requesting an enhancement to the Auth Profile system to support multiple team subscriptions under the exact same OAuth account. This would allow users with multiple business tier subscriptions (like OpenAI Codex) to fully utilize OpenClaw's built-in fallback and auth rotation mechanisms.

Current Behavior

Desired Behavior

Use Case

Environment

Provider: openai-codex

Component: Auth Profile Manager / CLI

Fix Action

Fix / Workaround

Currently, the only workaround is to manually edit the configuration JSON file (~/.openclaw/auth-profiles.json) to artificially separate the profiles. However, this is not user-friendly and risks being overwritten the next time the CLI auth command is run.

PR fix notes

PR #43694: CLI: support OpenAI Codex OAuth profile aliases

Description (problem / solution / changelog)

Summary

  • add --profile-alias <name> to openclaw models auth login for the built-in openai-codex OAuth flow
  • pass the alias through login handling so OAuth credentials can be saved under a distinct profile id instead of only ${provider}:${email|default}
  • extend writeOAuthCredentials with optional profileName support and normalize aliases to profile-safe slugs
  • add coverage for alias-based profile creation and login wiring
  • refresh stale Codex default-model expectations in existing models auth tests

Validation

  • pnpm test src/commands/models/auth.test.ts src/commands/onboard-auth.test.ts src/cli/models-cli.test.ts
    • Passed: 3 files, 41 tests

Closes #43681

Changed files

  • src/cli/models-cli.ts (modified, +5/-0)
  • src/commands/models/auth.test.ts (modified, +33/-3)
  • src/commands/models/auth.ts (modified, +2/-0)
  • src/commands/onboard-auth.credentials.ts (modified, +6/-1)
  • src/commands/onboard-auth.test.ts (modified, +27/-0)
RAW_BUFFERClick to expand / collapse

Summary

I am requesting an enhancement to the Auth Profile system to support multiple team subscriptions under the exact same OAuth account. This would allow users with multiple business tier subscriptions (like OpenAI Codex) to fully utilize OpenClaw's built-in fallback and auth rotation mechanisms.

Current Behavior

Desired Behavior

Use Case

Environment

Provider: openai-codex

Component: Auth Profile Manager / CLI

Problem to solve

Currently, when I run openclaw models auth login to add a new profile using the same email account but for a different team subscription, the CLI overwrites the previous configuration. They both end up saving to the same default identifier (like openai-codex:default) instead of keeping the profiles separate.

Proposed solution

OpenClaw should allow users to register and maintain multiple Auth Profiles under the same provider and account. A potential solution could be:

Extracting and separating profiles by Team ID or Organization ID during the OAuth flow.

Allowing the user to define a custom alias for the profile during the login command.

Once configured, if one team subscription hits an API rate limit (HTTP 429), OpenClaw should gracefully failover and rotate to the next available team profile within that same account.

Alternatives considered

Currently, the only workaround is to manually edit the configuration JSON file (~/.openclaw/auth-profiles.json) to artificially separate the profiles. However, this is not user-friendly and risks being overwritten the next time the CLI auth command is run.

Impact

Adding this feature will significantly improve the reliability and developer experience of OpenClaw for enterprise and power users.

Maximized Uptime: Ensures that automated workflows and agents are not unnecessarily interrupted by rate limits when valid, paid quotas are still available on other team subscriptions.

Better Developer Experience: Eliminates the need for manual, error-prone edits to the configuration JSON files.

Full Feature Utilization: Allows users to fully leverage OpenClaw's built-in failover and rotation mechanisms as originally intended, broadening the tool's appeal to professional teams and agencies.

Evidence/examples

No response

Additional information

This feature is highly valuable for enterprise users, agencies, or developers who use a single SSO or email account to manage different client workspaces or departmental budgets within the same AI provider ecosystem.

extent analysis

Fix Plan

To support multiple team subscriptions under the same OAuth account, we will implement the following steps:

  • Extract and separate profiles by Team ID or Organization ID during the OAuth flow.
  • Allow users to define a custom alias for the profile during the login command.
  • Implement a failover mechanism to rotate to the next available team profile within the same account when an API rate limit is hit.

Example Code

We will modify the openclaw CLI to accept a --team-id or --org-id flag during the login command:

import click

@click.command()
@click.option('--team-id', help='Team ID or Organization ID')
@click.option('--alias', help='Custom alias for the profile')
def login(team_id, alias):
    # Implement OAuth flow with team_id and alias
    # ...
    # Save the profile to the configuration file with the custom alias
    profile = {
        'provider': 'openai-codex',
        'team_id': team_id,
        'alias': alias,
        # ...
    }
    save_profile(profile)

We will also modify the save_profile function to handle multiple profiles with the same provider and account:

def save_profile(profile):
    # Load existing profiles from the configuration file
    profiles = load_profiles()
    # Check if a profile with the same provider and team_id already exists
    existing_profile = next((p for p in profiles if p['provider'] == profile['provider'] and p['team_id'] == profile['team_id']), None)
    if existing_profile:
        # Update the existing profile with the new alias
        existing_profile['alias'] = profile['alias']
    else:
        # Add the new profile to the list of profiles
        profiles.append(profile)
    # Save the updated profiles to the configuration file
    save_profiles(profiles)

Verification

To verify that the fix worked, we can test the following scenarios:

  • Run the openclaw models auth login command with the --team-id and --alias flags to add a new profile.
  • Verify that the new profile is saved to the configuration file with the custom alias.
  • Run the openclaw models auth login command again with a different --team-id and --alias to add another profile.
  • Verify that the second profile is saved to the configuration file with a different alias.
  • Test the failover mechanism by hitting an API rate limit and verifying that the next available team profile is used.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING