grok-models
v0.1.2
Published
Add third-party OpenAI/Anthropic model support to Grok-Build: a keyboard-first TUI that picks models from the models.dev catalog and writes them safely into your Grok config
Downloads
308
Maintainers
Readme
Grok Model Selector
A standalone Rust TUI that picks a supported OpenAI or Anthropic model from the models.dev catalog and writes it safely into your Grok personal config (config.toml) — no manual TOML editing.
Features
- Browse and search every models.dev provider served through
@ai-sdk/openai,@ai-sdk/openai-compatibleor@ai-sdk/anthropic - Three custom templates (OpenAI responses, OpenAI-compatible chat completions, Anthropic messages) for your own or self-hosted endpoints
- API keys are entered once per provider (masked on screen), stored in the provider table and reused by every model of that provider
- Review a masked diff before writing; cancel never writes anything
- Atomic writes with owner-only (0600) permissions and conflict detection
- models.dev catalog cached for 12 hours with ETag revalidation and offline fallback; press
Ctrl+Rin the provider list to force an update - Optional "set as default model" toggle
- ChatGPT subscription OAuth implementation retained for a future release (not available in this version)
Install
macOS (universal binary) and Linux x64/arm64 (prebuilt binary):
npm install -g grok-models
grok-modelsOr build from source (Rust 1.94.0, Unix):
cargo build --release
./target/release/grok-model-selectorThe npm package supports macOS arm64/x64 and Linux arm64/x64. Windows is not supported by the prebuilt package.
Usage
- Pick a provider; press
Ctrl+Rto force-refresh the models.dev catalog - Enter the API key (skipped when one is already configured for that provider)
- Pick a model
- Review the change preview (credentials are masked)
- In the preview, use
Up/Downto scroll changes,dto toggle "set as default model",Enterto write, orEscto cancel - After writing, press
Enterto add another model for the same provider, orEscto exit
After writing, restart Grok and confirm the model appears via /model or grok models.
The config is written to $GROK_HOME/config.toml (falls back to ~/.grok/config.toml) using stable selector-* keys; all other entries, comments and formatting are preserved.
Supported Providers
The adapter registry is derived from the catalog itself — the npm field of each models.dev provider decides the wire protocol Grok uses:
| models.dev npm | Grok api_backend | Credential placement |
|---|---|---|
| @ai-sdk/openai | responses | provider api_key (Bearer) |
| @ai-sdk/openai-compatible | chat_completions | provider api_key (Bearer) |
| @ai-sdk/anthropic | messages | provider extra_headers x-api-key + anthropic-version |
Providers served through other SDKs (Azure, Google, Cohere, xAI, …) are filtered out and never shown.
Custom Providers
Three templates at the bottom of the provider list let you wire up any endpoint: Custom — OpenAI (responses), Custom — OpenAI-compatible (chat_completions) and Custom — Anthropic (messages).
After choosing a template you enter a name (becomes the provider key), a base URL, an optional API key (fine to skip for local servers like vLLM/Ollama) and a model id. Adding more models to the same custom provider reuses the stored URL and key.
The selector keeps long URLs, model names and configuration paths readable by wrapping long text and showing the visible end of long input values. API keys remain masked in input screens and previews.
Current Release Limitations
- ChatGPT subscription models are not supported in this version and are hidden from the provider picker.
- The OAuth implementation and CLI helpers remain in the source for a future release, but should not be used to create a ChatGPT subscription config with this version.
- Use a supported API-key provider or a custom provider instead.
