From 45e5bc45dce2e9dee7940d9727cb0d3ad2d6438f Mon Sep 17 00:00:00 2001 From: Pascal Fend Date: Sat, 12 Jul 2025 23:08:16 +0200 Subject: [PATCH 1/6] Adding the grok4 model information to the xai models - verifying information for token prices - Date: 2025-07-12 --- internal/llm/models/xai.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/internal/llm/models/xai.go b/internal/llm/models/xai.go index 00caf3b89..b7d403a8f 100644 --- a/internal/llm/models/xai.go +++ b/internal/llm/models/xai.go @@ -7,6 +7,7 @@ const ( XAIGrok3MiniBeta ModelID = "grok-3-mini-beta" XAIGrok3FastBeta ModelID = "grok-3-fast-beta" XAiGrok3MiniFastBeta ModelID = "grok-3-mini-fast-beta" + XAIGrok40709 ModelID = "grok-4-0709" ) var XAIModels = map[ModelID]Model{ @@ -58,4 +59,18 @@ var XAIModels = map[ModelID]Model{ ContextWindow: 131_072, DefaultMaxTokens: 20_000, }, + XAIGrok40709: { + ID: XAIGrok40709, + Name: "Grok 4 0709", + Provider: ProviderXAI, + APIModel: "grok-4-0709", + CostPer1MIn: 3.0, + CostPer1MInCached: 0.75, + CostPer1MOut: 15.0, + CostPer1MOutCached: 0.75, + ContextWindow: 256_000, + DefaultMaxTokens: 20_000, + CanReason: true, + SupportsAttachments: true, + }, } From 4ab2b7d2f89bf9825057f86269f95bddff9dd3be Mon Sep 17 00:00:00 2001 From: Pascal Fend Date: Sat, 12 Jul 2025 23:39:03 +0200 Subject: [PATCH 2/6] add model to schema --- opencode-schema.json | 1 + 1 file changed, 1 insertion(+) diff --git a/opencode-schema.json b/opencode-schema.json index 406c75f8c..94a0fed09 100644 --- a/opencode-schema.json +++ b/opencode-schema.json @@ -173,6 +173,7 @@ "openrouter.claude-3.7-sonnet", "openrouter.gpt-4.5-preview", "grok-3-mini-beta", + "grok-4-0709", "claude-3.7-sonnet", "gemini-2.0-flash", "openrouter.deepseek-r1-free", From c62ce8afb7e065ac10ff47773f253a098eea7b04 Mon Sep 17 00:00:00 2001 From: Pascal Fend Date: Sat, 12 Jul 2025 23:41:27 +0200 Subject: [PATCH 3/6] add xai to readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index eee06acd9..d5e8436fa 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,10 @@ This is useful if you want to use a different shell than your default system she "openrouter": { "apiKey": "your-api-key", "disabled": false + }, + "xai": { + "apiKey": "your-api-key", + "disabled": false } }, "agents": { From 7bd09cf9d86c30f70a2c1e56525abdb7cb1e3831 Mon Sep 17 00:00:00 2001 From: Pascal Fend Date: Sat, 12 Jul 2025 23:52:01 +0200 Subject: [PATCH 4/6] Update readme.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index d5e8436fa..837a9f8af 100644 --- a/README.md +++ b/README.md @@ -274,6 +274,14 @@ OpenCode supports a variety of AI models from different providers: - Gemini 2.5 - Gemini 2.5 Flash +### XAI + +- Grok 3 Beta +- Grok 3 Mini Beta +- Grok 3 Fast Beta +- Grok 3 Mini Fast Beta +- Grok 4 0709 + ## Usage ```bash From 5ab1957a84780e1505d5a07e38d2248c006d8098 Mon Sep 17 00:00:00 2001 From: Pascal Fend Date: Sun, 13 Jul 2025 00:01:47 +0200 Subject: [PATCH 5/6] no reasoning supported --- internal/llm/models/xai.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/llm/models/xai.go b/internal/llm/models/xai.go index b7d403a8f..0a52aebdf 100644 --- a/internal/llm/models/xai.go +++ b/internal/llm/models/xai.go @@ -69,8 +69,6 @@ var XAIModels = map[ModelID]Model{ CostPer1MOut: 15.0, CostPer1MOutCached: 0.75, ContextWindow: 256_000, - DefaultMaxTokens: 20_000, - CanReason: true, - SupportsAttachments: true, + DefaultMaxTokens: 20_000 }, } From 706d543b3ca299e0ae160feab02553f3e01c3105 Mon Sep 17 00:00:00 2001 From: Pascal Fend Date: Sun, 13 Jul 2025 00:06:24 +0200 Subject: [PATCH 6/6] comma missing --- internal/llm/models/xai.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/llm/models/xai.go b/internal/llm/models/xai.go index 0a52aebdf..5dbd308b0 100644 --- a/internal/llm/models/xai.go +++ b/internal/llm/models/xai.go @@ -69,6 +69,6 @@ var XAIModels = map[ModelID]Model{ CostPer1MOut: 15.0, CostPer1MOutCached: 0.75, ContextWindow: 256_000, - DefaultMaxTokens: 20_000 + DefaultMaxTokens: 20_000, }, }