JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19
  • Score
    100M100P100Q79530F
  • License MIT

SharedLLM CLI — route agentic coding tools (Claude Code, etc.) through the SharedLLM gateway

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sharedllm) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    sharedllm

    Launch agentic coding tools (Claude Code today; Codex and Aider next) through the SharedLLM gateway with one command. Pick a model from an interactive list, let Auto route to the best available one, track every request, and map Anthropic-tier aliases (Opus / Sonnet / Haiku) to whichever upstream you've configured.

    The CLI is a launcher, not a proxy. It loads your SharedLLM credentials, sets the right environment variables, and execs the target tool. The gateway handles auth, model resolution, billing, and forwarding.


    Install

    One-line installer (recommended):

    macOS / Linux:

    curl -fsSL https://sharedllm.com/install.sh | sh

    Windows (PowerShell):

    irm https://sharedllm.com/install.ps1 | iex

    Both pick whichever JS package manager you already have (bunpnpmnpm; the Unix script also tries yarn and can bootstrap bun), install sharedllm globally, and put the install dir on your PATH — appending to ~/.bashrc / ~/.zshrc / fish config on Unix, or your User PATH on Windows.

    Or pick a package manager directly:

    bun  add -g sharedllm     # bun  (macOS / Linux / Windows)
    pnpm add -g sharedllm     # pnpm (macOS / Linux / Windows)
    npm  install -g sharedllm # npm  (Unix may need sudo for /usr/local)

    On Windows, the npm/pnpm global launchers are rewritten to call node directly by the package's postinstall step, so sharedllm / sllm work from cmd.exe and PowerShell out of the box (Node.js ≥ 18 required).

    The package installs both sharedllm (long) and sllm (short) on your PATH. Use whichever you prefer. Examples below use sllm.

    Quickstart

    sllm login                 # opens browser, creates a CLI key
    sllm claude                # pick a model from the interactive list

    Or name a model directly (skips the picker):

    sllm claude --model kimi-2.6

    Don't have a browser handy (SSH, CI, sandboxes)? Grab a key from your dashboard and paste it:

    sllm login --no-browser --key sk-sharedllm-...

    Choosing a model

    Interactive picker

    Run sllm claude with no --model in a terminal and you get a searchable, colour-coded list:

    Select a model  ↑/↓ navigate · type to search · enter select · esc cancel
      search: kimi
    ❯ ollama     kimi-2.6        translated/chat
      3/41 models
    • ↑/↓ (or Ctrl-P/Ctrl-N) to move, Enter to select, Esc / Ctrl-C to cancel.
    • Type to filter by provider, model id, or type; Backspace edits, Ctrl-U clears the search.
    • Each row shows the provider and whether it runs native (green) or via translated (yellow) Anthropic↔OpenAI conversion. Your default is marked with a .

    Set NO_COLOR=1 to disable colour; on non-interactive shells (pipes / CI) the CLI falls back to a plain numbered prompt.

    Auto (smart routing)

    auto resolves, per request, to the first model in a priority list that currently has an available key — your own contributed key first, then the shared pool:

    sllm claude --model auto

    The priority order comes from your list (set it in the dashboard under Playground → Auto, up to 10 models), falling back to the admin default order, and finally to the best available model. Pick Auto at the top of the interactive picker to do the same thing.

    Make it your default so plain sllm claude always uses it:

    sllm config set default_model auto

    Commands

    sllm login [--key <key>] [--endpoint <url>] [--no-browser]
    sllm logout [--all] [--profile <name>]
    sllm status [--profile <name>]
    
    sllm <tool> [--model <id>] [--profile <name>] [--no-preflight] [--no-pick] [-- <tool args...>]
      tools: claude
      --model accepts any model id, or "auto"
    
    sllm models [--provider <name>] [--type <type>] [--json]
    sllm models resolve <model-id>
    
    sllm usage [--days <n>] [--json]
    
    sllm config show
    sllm config set <key> <value>
    sllm config path
    
    sllm version

    Pass-through to the wrapped tool

    Anything after a bare -- is forwarded verbatim to the child binary:

    sllm claude --model kimi-2.6 -- --resume --dangerously-skip-permissions

    Tier overrides for Claude

    If you want Claude Code's built-in Opus/Sonnet/Haiku selectors to map to specific upstream models, set them once:

    sllm config set tier_models.opus   claude-opus-4-20250918
    sllm config set tier_models.sonnet claude-sonnet-4-20250514
    sllm config set tier_models.haiku  claude-haiku-4-5-20251001

    From then on, selecting Sonnet inside Claude Code routes through the model you mapped, no flags needed.

    Profiles

    Multiple SharedLLM accounts or endpoints (prod / staging / self-hosted)? Profiles are first-class:

    sllm login --profile staging --endpoint https://api.staging.sharedllm.com
    sllm config set active_profile staging
    sllm claude                          # uses staging
    sllm claude --profile default

    Self-hosted gateway

    sllm login \
      --endpoint http://localhost:3000 \
      --endpoint-dashboard http://localhost:3001

    When the gateway runs on :3000, the CLI defaults the dashboard to :3001. Override either with the flags above, or via SHAREDLLM_ENDPOINT / SHAREDLLM_ENDPOINT_DASHBOARD env vars.

    Configuration

    Config is stored at:

    • macOS / Linux: ~/.config/sharedllm/config.json
    • Windows: %APPDATA%\sharedllm\config.json

    Permissions are enforced to 0600 on POSIX (the file contains your API token). Run sllm config path to see the location, or sllm config show for a redacted dump.

    Setting precedence: CLI flag → SHAREDLLM_* env var → active profile → built-in default.

    Environment variables the CLI sets for claude

    When sllm claude runs, it sets these for the child process:

    Variable Value
    ANTHROPIC_BASE_URL <endpoint>/anthropic
    ANTHROPIC_AUTH_TOKEN your SharedLLM key
    ANTHROPIC_API_KEY "" (must be empty for AUTH_TOKEN to take effect)
    ANTHROPIC_MODEL from --model or default_model (may be auto)
    ANTHROPIC_DEFAULT_OPUS_MODEL from tier_models.opus (if set)
    ANTHROPIC_DEFAULT_SONNET_MODEL from tier_models.sonnet (if set)
    ANTHROPIC_DEFAULT_HAIKU_MODEL from tier_models.haiku (if set)

    If you already have ANTHROPIC_* vars in your shell, the CLI overrides them and prints a one-line warning so the source of changes stays obvious.

    Troubleshooting

    Symptom Fix
    claude not found in PATH npm install -g @anthropic-ai/claude-code
    Not authenticated. Run: sllm login Run that.
    Stored key was rejected The key was revoked from the dashboard. Run sllm login to issue a new one.
    Auto: no model … has an available key Add a provider key (dashboard → Resource Pool), or adjust your Auto order.
    Browser doesn't open The login URL is printed; open it manually. Or pass --no-browser and --key sk-sharedllm-....
    Config has loose permissions chmod 600 ~/.config/sharedllm/config.json

    License

    MIT