You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for opening this. Adding a Grok provider makes sense, but there are a few issues I think should be fixed before this is merged:
The Grok provider currently ignores opts.maxTokens. Every existing remote provider forwards that option, and the main call sites rely on it to bound outputs for trade ideas and alert evaluation. With LLM_PROVIDER=grok, those caps silently stop applying, which can increase latency/cost and produce oversized generations. Please pass through max_tokens here like the other providers do.
The response parsing is not null-safe in the same way as the other providers. data.choices?.[0].message?.content will throw if choices is an empty array, because [0] is not optional-chained before .message. Please change this to match the other providers so a 200 response with no choices degrades cleanly instead of breaking the sweep.
The default model should be updated. Right now this provider defaults to grok-3, but xAI?s current docs recommend the latest alias approach and their current flagship family is Grok 4. grok-4-latest should be the recommended default/model guidance here instead of grok-3, and the docs/config comments should be updated consistently.
There are also a couple README references that still list the old provider count/provider set, so those should be brought back into sync while you?re here.
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
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
Added a file for a provider for the Grok AI, changed documentation for the introduction of the Grok provider, and implemented tests for grok
Additions
lib/llm/grok.mjstest/llm-grok.test.mjsUpdated
README.mdlib/llm/index.mjs.env.examplecrucix.config.mjsAll configurations in a
.envfile are the same no additional information needed to run the providerAddresses issue #54