Skip to content

request-logger: add Grok support - #54

Open
gokhan wants to merge 1 commit into
ai-hero-dev:mainfrom
gokhan:request-logger-grok-support
Open

request-logger: add Grok support#54
gokhan wants to merge 1 commit into
ai-hero-dev:mainfrom
gokhan:request-logger-grok-support

Conversation

@gokhan

@gokhan gokhan commented Aug 27, 2026

Copy link
Copy Markdown

Summary

Adds Grok (the xAI coding CLI) to the request-logger catalogue, in the same shape as Copilot: one provider, one env override, no config file.

  • Grok builds the system prompt on the machine and sends it over HTTP to cli-chat-proxy.grok.com, so it can be logged. A grok.com login and an XAI_API_KEY both talk to that host; the API key is a credential fallback, not a different route.
  • The printed command is GROK_CLI_CHAT_PROXY_BASE_URL=http://localhost:PORT/v1 grok. The /v1 suffix is required: Grok appends /responses (and /models) to the default https://cli-chat-proxy.grok.com/v1.
  • The existing OpenAI renderer already reads the Responses API shape Grok uses by default.
  • GROK_MODELS_BASE_URL is a different override (it switches the CLI onto API-key auth against a custom /v1/models endpoint). The command never sets it; a warning tells the student to unset it if it is already in the environment, or the logs folder stays empty.
  • Grok also makes a second model call to title the session, so one turn can write two captures — the same fan-out as OpenCode. Documented in the README next to that note.

Test plan

  • npx vitest run request-logger — 296 tests pass, including new Grok coverage: catalogue order, needsProvider, host, /v1 suffix, OpenAI renderer, POSIX and PowerShell commands, GROK_MODELS_BASE_URL not set, custom-target template reuse, customTargetNeedsModel false
  • npx prettier --check on changed files
  • Live grok -p turn through the proxy: POST /v1/responses returned 200, capture has tools + prompt + reply; GETs (/v1/models, /v1/settings) were forwarded and not logged

Add Grok as a catalogue agent in the Copilot shape: one xAI provider,
GROK_CLI_CHAT_PROXY_BASE_URL, a /v1 suffix, and the OpenAI Responses
renderer. A grok.com login and an XAI_API_KEY both talk to
cli-chat-proxy.grok.com; GROK_MODELS_BASE_URL is a different override
and is warned about, not set.

Tests cover host, command, Windows env syntax, and the custom-target
template. Driven against a live grok -p turn through the proxy.
@gokhan
gokhan force-pushed the request-logger-grok-support branch from 44375bc to 62716f8 Compare August 27, 2026 21:01
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.

1 participant