Skip to content

feat: LLM provider for Grok#62

Merged
calesthio merged 8 commits intocalesthio:masterfrom
3byss:master
Mar 29, 2026
Merged

feat: LLM provider for Grok#62
calesthio merged 8 commits intocalesthio:masterfrom
3byss:master

Conversation

@3byss
Copy link
Copy Markdown
Contributor

@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
Copy Markdown
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.

Copy link
Copy Markdown
Owner

@calesthio calesthio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied the remaining fixes directly to this PR branch before approving. Specifically: wired the Grok provider to the shared \maxTokens\ interface, updated and expanded the Grok tests to cover the new default model and request payload, and synced the README so Grok is documented consistently with the other providers.

@calesthio calesthio merged commit 3f3d050 into calesthio:master Mar 29, 2026
1 check passed
mdrong22 pushed a commit to mdrong22/Crucix-Main that referenced this pull request Mar 29, 2026
commit 212fefd
Merge: 3f3d050 1b80539
Author: Calesthio <celesthioailabs@gmail.com>
Date:   Sat Mar 28 23:14:48 2026 -0700

    Merge pull request calesthio#85 from calesthio/codex/gold-silver-macro

    feat: add gold and silver to macro + markets context

commit 1b80539
Author: calesthio <celesthioailabs@gmail.com>
Date:   Sat Mar 28 22:53:23 2026 -0700

    feat(markets): surface gold and silver across dashboard and briefs

commit 3f3d050
Merge: 53f6d81 1fb5093
Author: Calesthio <celesthioailabs@gmail.com>
Date:   Sat Mar 28 22:41:17 2026 -0700

    Merge pull request calesthio#62 from 3byss/master

    feat: LLM provider for Grok

commit 1fb5093
Author: calesthio <celesthioailabs@gmail.com>
Date:   Sat Mar 28 22:36:33 2026 -0700

    fix(grok): align token caps and docs

commit 18233bc
Merge: 457dba2 e9b04b2
Author: 3byss <ziyadaneffati@gmail.com>
Date:   Fri Mar 27 22:23:07 2026 -0600

    Merge remote-tracking branch 'refs/remotes/origin/master'

commit 457dba2
Author: 3byss <ziyadaneffati@gmail.com>
Date:   Fri Mar 27 22:22:21 2026 -0600

    Fixed any issues with the PR

commit e9b04b2
Merge: caf4430 53f6d81
Author: 3byss <ziyadaneffati@gmail.com>
Date:   Fri Mar 27 22:19:00 2026 -0600

    Merge branch 'calesthio:master' into master

commit 9028d42
Merge: caf4430 53f6d81
Author: 3byss <ziyadaneffati@gmail.com>
Date:   Fri Mar 27 22:13:37 2026 -0600

    Merge remote-tracking branch 'upstream/master'

commit 53f6d81
Merge: 8c1ea37 5c08355
Author: Calesthio <celesthioailabs@gmail.com>
Date:   Wed Mar 25 10:21:02 2026 -0700

    Merge pull request calesthio#68 from schergr/fix/osint-signal-truncation

    Fix remaining OSINT signal text truncation

commit 5c08355
Author: calesthio <celesthioailabs@gmail.com>
Date:   Tue Mar 24 18:48:55 2026 -0700

    Fix Telegram dedup identity and legacy Markdown escaping

commit b7322f1
Author: Greg Scher <greg@212southadvisors.com>
Date:   Mon Mar 23 13:01:32 2026 -0400

    Fix HTML entity decoding and broaden OSINT dedup window

    - Replace single &calesthio#39; handler with generic numeric/hex entity decoder
      so &calesthio#39; and other unpadded entities are properly converted
    - Dedup urgent OSINT posts against all hot memory runs (last 3 sweeps)
      instead of only the previous sweep, preventing posts that drop out
      of one sweep from reappearing as "new" in the next

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

commit 31c305c
Author: Greg Scher <greg@212southadvisors.com>
Date:   Mon Mar 23 12:57:37 2026 -0400

    Escape Markdown in alert signals and cap OSINT text in ideas prompt

    Addresses PR review: escape Markdown-sensitive characters in
    _formatTieredAlert signal bullets to prevent Telegram Bot API
    rejections, and add a 1500-char budget for URGENT_OSINT in
    compactSweepForLLM to bound prompt size while keeping full text upstream.

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

commit caf4430
Merge: cb27575 8c1ea37
Author: 3byss <ziyadaneffati@gmail.com>
Date:   Sat Mar 21 16:17:13 2026 -0600

    Merge branch 'master' into master

commit 2d166c2
Author: Greg Scher <greg@212southadvisors.com>
Date:   Sat Mar 21 12:59:30 2026 -0400

    Remove remaining text truncation across delta engine, memory, and ideas

    The prior fix (753c676) only removed truncation at source ingestion and
    alert formatting. Signals were still being cut to 120 chars in the delta
    engine, 80 chars in memory snapshots, and 120 chars in the ideas LLM
    context — so OSINT posts arrived at the alerter already truncated.

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

commit cb27575
Author: 3byss <ziyadaneffati@gmail.com>
Date:   Fri Mar 20 16:26:30 2026 -0600

    Fixed types and created tests

commit 753c676
Author: Greg Scher <greg@212southadvisors.com>
Date:   Fri Mar 20 16:49:58 2026 -0400

    Remove text truncation limits from Telegram posts

    Posts were being cut to 300 chars (source ingestion) and 150 chars
    (alert evaluation), losing valuable OSINT context. The sendMessage
    chunker already handles the 4096-char Telegram API limit.

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

commit 17b8d9e
Author: 3byss <ziyadaneffati@gmail.com>
Date:   Fri Mar 20 00:46:44 2026 -0600

    Finished the Grok LLM implementation
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