link-assistant-router 0.45.0

Link.Assistant.Router — Claude MAX OAuth proxy and token gateway for Anthropic APIs
Documentation
# CLI: Grok CLI through the router

**Dialect:** OpenAI Chat Completions. **Router endpoint:**
`/v1/chat/completions`.

## Configuration

[superagent-ai/grok-cli](https://github.com/superagent-ai/grok-cli) documents
`GROK_API_KEY` for authentication and an optional `GROK_BASE_URL` (default
`https://api.x.ai/v1`), with user settings persisted at
`~/.grok/user-settings.json`.

```bash
export GROK_BASE_URL=http://127.0.0.1:8080/v1
export GROK_API_KEY=la_sk_...            # your task token
grok
```

The current settings schema can store `apiKey` in
`~/.grok/user-settings.json`, but the implementation reads the base URL only
from `GROK_BASE_URL`. The router therefore keeps both values in the launching
shell: this avoids persisting the token and avoids writing an ignored base-URL
field.

`link-assistant-router clients setup grok-cli` prints both exports.

## Which subscription answers

Any active `UPSTREAM_PROVIDER`. Grok CLI speaks plain Chat Completions, which
the router either translates to Anthropic Messages (`anthropic`), converts to
Responses (`codex`), or forwards natively (`qwen`, `openai-compatible`, `gonka`).

## Smoke test

```bash
curl -s http://127.0.0.1:8080/v1/chat/completions \
  -H "Authorization: Bearer $GROK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o","messages":[{"role":"user","content":"ping"}]}' | jq -r '.choices[0].message.content'
```

## Troubleshooting

| Symptom | Cause |
| --- | --- |
| Requests still hit `api.x.ai` | `GROK_BASE_URL` was not exported in the shell that launched `grok` |
| `404` | the base URL must include the `/v1` suffix |
| Model not recognised upstream | unknown OpenAI ids map to the default Sonnet tier on `UPSTREAM_PROVIDER=anthropic`; set an explicit `claude-…` id if you need a specific model |