Skip to content

feat: LLM provider for Grok#62

Open
3byss wants to merge 3 commits intocalesthio:masterfrom
3byss:master
Open

feat: LLM provider for Grok#62
3byss wants to merge 3 commits intocalesthio:masterfrom
3byss:master

Conversation

@3byss
Copy link

@3byss 3byss commented Mar 20, 2026

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.mjs
  • test/llm-grok.test.mjs

Updated

  • README.md
  • lib/llm/index.mjs
  • .env.example
  • crucix.config.mjs

All configurations in a .env file are the same no additional information needed to run the provider

Addresses issue #54

@3byss 3byss requested a review from calesthio as a code owner March 20, 2026 22:36
@3byss 3byss marked this pull request as draft March 21, 2026 02:00
@3byss 3byss marked this pull request as ready for review March 21, 2026 02:04
@3byss 3byss marked this pull request as draft March 21, 2026 22:07
@3byss 3byss marked this pull request as ready for review March 21, 2026 22:17
@calesthio
Copy link
Owner

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:

  1. 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.

  2. 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.

  3. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants