Skip to content

fix: register provider aliases (xai/grok) on client init#53

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/justllms-repository-improvements-ed3f
Draft

fix: register provider aliases (xai/grok) on client init#53
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/justllms-repository-improvements-ed3f

Conversation

@cursor

@cursor cursor Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a bug where provider aliases were not registered on the Client, causing provider="xai" calls to fail when only XAI_API_KEY is set (which configures the grok provider key).

Problem

  • Config.from_env() registers xAI under the grok key when XAI_API_KEY is set
  • The SXS CLI and other code use provider="xai" as the provider name
  • get_provider_class("xai") works at the registry level, but Client.providers only contained "grok", leading to Provider 'xai' not found errors

Solution

Added _register_provider_aliases() to automatically register alternate provider names (e.g. xai/grok, claude/anthropic, gemini/google) that share the same provider class when a provider is initialized or manually added via add_provider().

Separately configured aliases are not overwritten.

Tests

Added tests/test_provider_aliases.py with 4 test cases.

CI

All checks pass: ruff, black, mypy, pytest (98 tests), build.

Open in Web View Automation 

When XAI_API_KEY is loaded via Config.from_env(), the grok provider is
initialized but the xai alias was missing. SXS and explicit
provider='xai' calls failed with Provider not found.

Register all known aliases (xai, claude, gemini) that share the same
provider class after initialization, without overwriting explicitly
configured alternate names.

Co-authored-by: Darshan Harihar <DarshanHarihar1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant