-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: add support for Grok-4 Fast model via OpenRouter and xAI #8218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Added grok-4-fast to xAI models configuration with free pricing - Added special handling in OpenRouter fetcher to override pricing for free promotion - Added tests for the new model in both xAI and OpenRouter test suites - Model supports 256K context window and image inputs Fixes #8217
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing my own code again. It's like proofreading your own typos - you never see them until it's in production.
| contextWindow: 256000, | ||
| supportsImages: true, | ||
| supportsPromptCache: true, | ||
| inputPrice: 0.0, // Currently free on OpenRouter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pricing maintenance concern: This hardcodes free pricing (0.0) for grok-4-fast, but OpenRouter also overrides it to free. When the promotion ends, you'll need to update prices in both places. Consider either:
- Removing the hardcoded free pricing here and letting OpenRouter handle the override
- Adding a more prominent warning about the dual maintenance requirement
| cacheReadsPrice: 0.0, | ||
| description: "xAI's Grok-4 Fast model with 256K context window - currently free on OpenRouter", | ||
| // TODO: Update pricing when OpenRouter promotion ends | ||
| // TODO: Add direct xAI API support for this model (lower priority) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API support validation: The TODO mentions "Add direct xAI API support for this model (lower priority)" but the code assumes it already works with the xAI handler. Consider adding validation or clearer documentation about whether the xAI API actually supports grok-4-fast yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing grok-4-fast-reasoning?
| modelInfo.maxTokens = 32768 | ||
| } | ||
|
|
||
| // Set xai/grok-4-fast model configuration (currently free on OpenRouter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding timeline reference: The comment mentions "currently free on OpenRouter" but doesn't indicate when this might change. Consider adding a date or reference link to track when to revisit the pricing.
|
The changes to the openrouter provider are unnecessary |
Summary
This PR adds support for the Grok-4 Fast model, prioritizing OpenRouter integration where it's currently available for free.
Changes
grok-4-fastto xAI models configuration with 256K context window and image supportTesting
Notes
Fixes #8217
Checklist
Important
Add support for Grok-4 Fast model with free pricing via OpenRouter, including configuration and test updates.
grok-4-fasttoxaiModelsinxai.tswith 256K context window and image support.grok-4-fastinopenrouter.tsduring OpenRouter promotion.xai.spec.tsforgrok-4-fastmodel handling and free pricing verification.openrouter.spec.tsforgrok-4-fastpricing override.xai.ts.This description was created by
for 606cd8b. You can customize this summary. It will automatically update as commits are pushed.