Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ C:\Users\ysnock\.config\opencode\opencode.json

It now includes `provider.xai-oauth` with these model IDs:

- `grok-4.5`
- `grok-composer-2.5-fast`
- `grok-4.3`
- `grok-4.20-0309-reasoning`
- `grok-4.20-0309-non-reasoning`
Expand All @@ -89,6 +91,12 @@ Equivalent config block:
"baseURL": "https://api.x.ai/v1"
},
"models": {
"grok-4.5": {
"name": "Grok 4.5"
},
"grok-composer-2.5-fast": {
"name": "Composer 2.5 Fast"
},
"grok-4.3": {
"name": "Grok 4.3"
},
Expand Down Expand Up @@ -140,7 +148,7 @@ xAI Grok OAuth
6. Select a model in OpenCode:

```text
xai-oauth/grok-4.3
xai-oauth/grok-4.5
```

## Models
Expand All @@ -149,13 +157,16 @@ xai-oauth/grok-4.3

| Model ID | Use |
| ------------------------------ | ----------------------------------------- |
| `grok-4.3` | Default general-purpose Grok OAuth model. |
| `grok-4.5` | Default general-purpose Grok OAuth model. |
| `grok-composer-2.5-fast` | Composer 2.5 Fast coding model. |
| `grok-4.3` | Previous general-purpose Grok OAuth model.|
| `grok-4.20-0309-reasoning` | Reasoning-heavy tasks. |
| `grok-4.20-0309-non-reasoning` | Faster non-reasoning variant. |
| `grok-4.20-multi-agent-0309` | Multi-agent oriented Grok variant. |

The fallback list mirrors the Hermes Agent xAI OAuth model list as of this
implementation. If xAI renames or retires models, update `src/constants.ts` and
The fallback list includes current SuperGrok OAuth chat models (`grok-4.5`,
`grok-composer-2.5-fast`) plus the earlier Hermes-compatible Grok IDs. If xAI
renames or retires models, update `src/constants.ts` and
`~/.config/opencode/opencode.json`.

## Configuration
Expand Down Expand Up @@ -232,7 +243,7 @@ C:\Users\ysnock\.config\opencode\opencode.json
Then restart OpenCode and select:

```text
xai-oauth/grok-4.3
xai-oauth/grok-4.5
```

### API Key Missing
Expand Down
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export const XAI_ACCESS_TOKEN_REFRESH_SKEW_MS = 120_000;
export const OAUTH_CALLBACK_TIMEOUT_MS = 180_000;

export const DEFAULT_XAI_MODELS = [
"grok-4.5",
"grok-composer-2.5-fast",
"grok-4.3",
"grok-4.20-0309-reasoning",
"grok-4.20-0309-non-reasoning",
Expand Down
5 changes: 4 additions & 1 deletion test/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ describe("plugin config", () => {
const provider = (config.provider as Record<string, unknown>)["xai-oauth"] as Record<string, unknown>;
expect(provider.npm).toBe("@ai-sdk/openai");
expect((provider.options as Record<string, unknown>).baseURL).toBe("https://api.x.ai/v1");
expect(Object.keys(provider.models as Record<string, unknown>)).toContain("grok-4.3");
const modelIds = Object.keys(provider.models as Record<string, unknown>);
expect(modelIds).toContain("grok-4.5");
expect(modelIds).toContain("grok-composer-2.5-fast");
expect(modelIds).toContain("grok-4.3");
});

it("only treats api.x.ai as a safe API token destination", () => {
Expand Down