From aa1384552290f9aea590259b0583269e3835733e Mon Sep 17 00:00:00 2001 From: Shun Kakinoki Date: Thu, 9 Jul 2026 05:16:53 +0800 Subject: [PATCH] feat(opencode): add grok 4.5 and default to it via x.ai subscription --- .env.example | 2 ++ config/opencode/opencode.jsonc | 13 ++++++++++++- config/opencode/opencode.tpl.jsonc | 13 ++++++++++++- models.json | 1 + 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 9b943a304..3f8161d60 100644 --- a/.env.example +++ b/.env.example @@ -13,5 +13,7 @@ OPENCLAW_ANTHROPIC_API_KEY=sk-ant-api03-your-key-here OPENCLAW_GATEWAY_TOKEN=your-gateway-token-here # OpenCode API key for OpenCode Go access via cliproxyapi OPENCODE_API_KEY=your-opencode-api-key-here +# xAI API key for Grok access via x.ai subscription (used by opencode xai provider) +XAI_API_KEY=xai-your-key-here # Paperclip database URL DATABASE_URL=postgres://user:password@host:5432/paperclip diff --git a/config/opencode/opencode.jsonc b/config/opencode/opencode.jsonc index 75e7ca3e1..b860f28a8 100644 --- a/config/opencode/opencode.jsonc +++ b/config/opencode/opencode.jsonc @@ -1,6 +1,6 @@ { "$schema": "https://opencode.ai/config.json", - "model": "cliproxyapi/glm-4.7", + "model": "xai/grok-4.5", "small_model": "cliproxyapi/glm-4.7", "autoupdate": true, "agent": { @@ -193,6 +193,17 @@ } } }, + "xai": { + "name": "xAI", + "options": { + "apiKey": "{env:XAI_API_KEY}" + }, + "models": { + "grok-4.5": { + "name": "Grok 4.5 (via xAI subscription)" + } + } + }, "zai-coding-plan": { "models": { "glm-4.7": { diff --git a/config/opencode/opencode.tpl.jsonc b/config/opencode/opencode.tpl.jsonc index 12cdc516e..6e30e0383 100644 --- a/config/opencode/opencode.tpl.jsonc +++ b/config/opencode/opencode.tpl.jsonc @@ -1,6 +1,6 @@ { "$schema": "https://opencode.ai/config.json", - "model": "cliproxyapi/__GLM__", + "model": "xai/__GROK__", "small_model": "cliproxyapi/__GLM__", "autoupdate": true, "agent": { @@ -193,6 +193,17 @@ } } }, + "xai": { + "name": "xAI", + "options": { + "apiKey": "{env:XAI_API_KEY}" + }, + "models": { + "__GROK__": { + "name": "__GROK_PRETTY__ (via xAI subscription)" + } + } + }, "zai-coding-plan": { "models": { "glm-4.7": { diff --git a/models.json b/models.json index f1bc9c3a5..8d076e35e 100644 --- a/models.json +++ b/models.json @@ -10,6 +10,7 @@ "gpt-nano": "gpt-5.4-nano", "gemini-pro": "gemini-3.1-pro-preview", "gemini-flash": "gemini-3.1-flash-preview", + "grok": "grok-4.5", "glm": "glm-4.7", "minimax": "minimax-m2.7", "gemma": "gemma-4-27b-it",