feat(xai): add first-class xai-oauth provider + correct base grok-4.3 context length (512k)#1
Open
am423 wants to merge 2 commits into
Open
feat(xai): add first-class xai-oauth provider + correct base grok-4.3 context length (512k)#1am423 wants to merge 2 commits into
am423 wants to merge 2 commits into
Conversation
… context length (512k) This PR introduces proper first-class support for using Grok models via the official Grok CLI OAuth login (xai-oauth). ### Changes - New model provider plugin: plugins/model-providers/xai-oauth/ - Runtime resolution forces chat_completions for OAuth tokens (prevents the 'response.created before error' failure on the Responses API) - x-grok-conv-id header is now sent on the chat_completions transport for any *.x.ai endpoint (enables prompt caching for OAuth users) - Correct context length fallbacks: base grok-4.3 = 512k, grok-4.3-fast and newer variants = 2M - Comprehensive README with setup, troubleshooting, and context notes - Updated public documentation (providers.md) to clearly document both xai-oauth and xai paths - Added regression test for xai-oauth runtime resolution - Added contributor guidance in AGENTS.md for OAuth model providers This enables reliable, zero-config use of grok-4.3 (and other Grok models) for users who already authenticate via the official Grok CLI.
- New guide: website/docs/guides/grok-oauth.md (setup, context notes, troubleshooting, comparison with xai provider) - Updated integrations/providers.md to link to the new guide and clearly document both xai-oauth and xai paths
Owner
Author
PR OverviewThis adds proper Scope
Review Focus Areas
Happy to address any feedback quickly. Thanks! |
🔎 Lint report:
|
| Rule | Count |
|---|---|
invalid-argument-type |
3 |
unresolved-import |
1 |
First entries
run_agent.py:13711: [invalid-argument-type] invalid-argument-type: Argument to function `_is_oauth_token` is incorrect: Expected `str`, found `str | dict[Unknown | str, Unknown | str | dict[str, str]] | Any | ... omitted 3 union elements`
run_agent.py:7480: [invalid-argument-type] invalid-argument-type: Argument to function `build_anthropic_client` is incorrect: Expected `str`, found `str | dict[Unknown | str, Unknown | str | dict[str, str]] | Any | ... omitted 3 union elements`
run_agent.py:13714: [invalid-argument-type] invalid-argument-type: Argument to function `len` is incorrect: Expected `Sized`, found `(str & ~AlwaysFalsy) | (dict[Unknown | str, Unknown | str | dict[str, str]] & ~AlwaysFalsy) | (Any & ~AlwaysFalsy) | ... omitted 3 union elements`
hermes_cli/runtime_provider.py:288: [unresolved-import] unresolved-import: Module `hermes_cli.auth` has no member `resolve_xai_oauth_runtime_credentials`
✅ Fixed issues (3):
| Rule | Count |
|---|---|
invalid-argument-type |
3 |
First entries
run_agent.py:7480: [invalid-argument-type] invalid-argument-type: Argument to function `build_anthropic_client` is incorrect: Expected `str`, found `str | dict[Unknown, Unknown] | Any | ... omitted 3 union elements`
run_agent.py:13714: [invalid-argument-type] invalid-argument-type: Argument to function `len` is incorrect: Expected `Sized`, found `(str & ~AlwaysFalsy) | (dict[Unknown, Unknown] & ~AlwaysFalsy) | (Any & ~AlwaysFalsy) | ... omitted 3 union elements`
run_agent.py:13711: [invalid-argument-type] invalid-argument-type: Argument to function `_is_oauth_token` is incorrect: Expected `str`, found `str | dict[Unknown, Unknown] | Any | ... omitted 3 union elements`
Unchanged: 4385 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds proper first-class support for using Grok models via the official Grok CLI OAuth login (
xai-oauth).This fixes the "response.created before
error" issue for users who usegrok logincredentials in Hermes.Key Changes
plugins/model-providers/xai-oauth/chat_completionsfor OAuth tokensx-grok-conv-idheader support on chat_completions transportwebsite/docs/guides/grok-oauth.mdTesting
Ready for review.