grok-search-cli 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,17 +35,16 @@ If no config exists yet, the CLI creates:
35
35
  ~/.config/grok-search-cli/config.json
36
36
  ```
37
37
 
38
- Update the generated config file using one of the bundled examples. The default xAI official config is:
38
+ In most cases, you only need to set an API key from [xAI](https://x.ai/api):
39
39
 
40
40
  ```json
41
41
  {
42
- "XAI_API_KEY": "your_xai_api_key",
43
- "XAI_MODEL": "grok-4-1-fast-non-reasoning",
44
- "XAI_BASE_URL": "",
45
- "XAI_COMPAT_MODE": false
42
+ "XAI_API_KEY": "your_xai_api_key"
46
43
  }
47
44
  ```
48
45
 
46
+ If you are using a non-official provider, see [Configuration](#configuration).
47
+
49
48
  Run a query:
50
49
 
51
50
  ```bash
@@ -131,29 +130,36 @@ grok-search skill > ~/.codex/skills/grok-search-cli/SKILL.md
131
130
 
132
131
  `process.env` takes priority over `~/.config/grok-search-cli/config.json`, so shell env is the easiest way to override config temporarily.
133
132
 
134
- ### xAI Official
133
+ By default, the CLI uses the official xAI endpoint and the built-in default model `grok-4-1-fast-non-reasoning`.
134
+
135
+ | Field | Required | Default behavior | When you might override it |
136
+ | --- | --- | --- | --- |
137
+ | `XAI_API_KEY` | Yes | No default | Required in all cases |
138
+ | `XAI_MODEL` | No | Uses `grok-4-1-fast-non-reasoning` | When you want a different Grok model |
139
+ | `XAI_BASE_URL` | No | Uses the official xAI endpoint | When routing through OpenRouter or another compatible gateway |
140
+
141
+ If you want to override the model:
135
142
 
136
143
  ```json
137
144
  {
138
145
  "XAI_API_KEY": "your_xai_api_key",
139
- "XAI_MODEL": "grok-4-1-fast-non-reasoning",
140
- "XAI_BASE_URL": "",
141
- "XAI_COMPAT_MODE": false
146
+ "XAI_MODEL": "grok-4-1-fast-non-reasoning"
142
147
  }
143
148
  ```
144
149
 
145
- ### OpenRouter
150
+ Important: model IDs are provider-specific. The official xAI model ID, the OpenRouter model ID, and the model ID expected by another compatible gateway may not match. If you switch providers, check the provider's expected model name instead of reusing the previous one unchanged.
151
+
152
+ ### OpenRouter Example
146
153
 
147
154
  ```json
148
155
  {
149
156
  "XAI_API_KEY": "your_openrouter_api_key",
150
- "XAI_MODEL": "x-ai/grok-4-fast:online",
151
- "XAI_BASE_URL": "https://openrouter.ai/api/v1",
152
- "XAI_COMPAT_MODE": false
157
+ "XAI_MODEL": "x-ai/grok-4.1-fast",
158
+ "XAI_BASE_URL": "https://openrouter.ai/api/v1"
153
159
  }
154
160
  ```
155
161
 
156
- ### Yunwu / Other Compatible Gateways
162
+ ### Other Compatible Gateway Example
157
163
 
158
164
  ```json
159
165
  {
@@ -164,13 +170,23 @@ grok-search skill > ~/.codex/skills/grok-search-cli/SKILL.md
164
170
  }
165
171
  ```
166
172
 
173
+ For gateways such as yunwu, set `XAI_COMPAT_MODE=true`.
174
+
167
175
  ## Provider Guide
168
176
 
169
177
  Recommended order:
170
178
 
171
179
  1. Use official xAI APIs when possible. This is the most direct and stable path for `web_search` and `x_search`.
172
- 2. OpenRouter is also a solid option. It can use native xAI-backed web search for xAI models.
173
- 3. If you use a third-party proxy, verify search support yourself. Many proxies only expose `/chat/completions`, and search only works if the proxy provider has enabled web search on their side.
180
+ 2. OpenRouter is the best fallback when you do not want to use xAI directly. It is the most predictable non-official option here.
181
+ 3. Third-party compatible gateways such as yunwu are a compatibility fallback. Verify search support yourself. Many proxies only expose `/chat/completions`, and search only works if the proxy provider has enabled web search on their side.
182
+
183
+ Recommended model choices:
184
+
185
+ | Provider | Recommended model | Why |
186
+ | --- | --- | --- |
187
+ | xAI official | `grok-4-1-fast-non-reasoning` | Default path in this CLI, best support for `web_search` and `x_search` |
188
+ | OpenRouter | `x-ai/grok-4.1-fast` | Best default when routing through OpenRouter |
189
+ | Other compatible gateways such as yunwu | Provider-specific | Use the model ID your gateway actually exposes, for example `grok-4-fast` on yunwu |
174
190
 
175
191
  ## Search Modes
176
192
 
@@ -192,7 +208,7 @@ Use this when `XAI_BASE_URL` points to `openrouter.ai`.
192
208
 
193
209
  ### Other Compatible Gateways
194
210
 
195
- Use this when you connect through another OpenAI-compatible gateway with `XAI_COMPAT_MODE=true`.
211
+ Use this when you connect through another OpenAI-compatible gateway.
196
212
 
197
213
  - Uses the gateway's compatibility path
198
214
  - Search behavior depends on the gateway
package/README.zh.md CHANGED
@@ -34,17 +34,16 @@ grok-search doctor
34
34
  ~/.config/grok-search-cli/config.json
35
35
  ```
36
36
 
37
- 打开这个文件,并按内置示例更新配置。默认的 xAI 官方配置如下:
37
+ 大多数情况下,你只需要填一个从 [xAI](https://x.ai/api) 获取的 API key:
38
38
 
39
39
  ```json
40
40
  {
41
- "XAI_API_KEY": "your_xai_api_key",
42
- "XAI_MODEL": "grok-4-1-fast-non-reasoning",
43
- "XAI_BASE_URL": "",
44
- "XAI_COMPAT_MODE": false
41
+ "XAI_API_KEY": "your_xai_api_key"
45
42
  }
46
43
  ```
47
44
 
45
+ 如果你使用的是非官方提供商,见下方的[配置方式](#配置方式)。
46
+
48
47
  然后执行查询:
49
48
 
50
49
  ```bash
@@ -130,29 +129,36 @@ grok-search skill > ~/.codex/skills/grok-search-cli/SKILL.md
130
129
 
131
130
  `process.env` 的优先级高于 `~/.config/grok-search-cli/config.json`,因此在临时覆盖配置时,优先使用 shell 环境变量。
132
131
 
133
- ### xAI 官方
132
+ 默认情况下,CLI 会使用 xAI 官方地址和内置默认模型 `grok-4-1-fast-non-reasoning`。
133
+
134
+ | 字段 | 是否必填 | 默认行为 | 什么时候可能要改 |
135
+ | --- | --- | --- | --- |
136
+ | `XAI_API_KEY` | 是 | 无默认值 | 所有场景都必须提供 |
137
+ | `XAI_MODEL` | 否 | 使用 `grok-4-1-fast-non-reasoning` | 当你想切换到其他 Grok 模型时 |
138
+ | `XAI_BASE_URL` | 否 | 使用 xAI 官方地址 | 当你要接 OpenRouter 或其他兼容网关时 |
139
+
140
+ 如果你想手动覆盖模型,可以这样写:
134
141
 
135
142
  ```json
136
143
  {
137
144
  "XAI_API_KEY": "your_xai_api_key",
138
- "XAI_MODEL": "grok-4-1-fast-non-reasoning",
139
- "XAI_BASE_URL": "",
140
- "XAI_COMPAT_MODE": false
145
+ "XAI_MODEL": "grok-4-1-fast-non-reasoning"
141
146
  }
142
147
  ```
143
148
 
144
- ### OpenRouter
149
+ 注意:不同服务商使用的 model id 不一定一样。xAI 官方、OpenRouter、以及其他兼容网关,通常都需要各自对应的模型名。切换服务商时,不要直接沿用原来的 model id。
150
+
151
+ ### OpenRouter 示例
145
152
 
146
153
  ```json
147
154
  {
148
155
  "XAI_API_KEY": "your_openrouter_api_key",
149
- "XAI_MODEL": "x-ai/grok-4-fast:online",
150
- "XAI_BASE_URL": "https://openrouter.ai/api/v1",
151
- "XAI_COMPAT_MODE": false
156
+ "XAI_MODEL": "x-ai/grok-4.1-fast",
157
+ "XAI_BASE_URL": "https://openrouter.ai/api/v1"
152
158
  }
153
159
  ```
154
160
 
155
- ### yunwu / 其他兼容代理站
161
+ ### 其他兼容网关示例
156
162
 
157
163
  ```json
158
164
  {
@@ -163,13 +169,23 @@ grok-search skill > ~/.codex/skills/grok-search-cli/SKILL.md
163
169
  }
164
170
  ```
165
171
 
172
+ 像 yunwu 这类兼容网关,通常需要设置 `XAI_COMPAT_MODE=true`。
173
+
166
174
  ## 服务选择建议
167
175
 
168
176
  推荐顺序:
169
177
 
170
178
  1. 优先使用 xAI 官方服务。这是 `web_search` 和 `x_search` 最直接、最稳定的路径。
171
- 2. OpenRouter 也比较稳。它对 xAI 模型可以走原生 xAI 支持的 web search。
172
- 3. 如果使用第三方代理站,需要自己确认搜索能力。很多代理站只暴露 `/chat/completions`,是否真的能搜索,取决于站点是否在内部为你开启了 web search。
179
+ 2. 如果不直连 xAI,优先用 OpenRouter。这是这里最稳的非官方选项。
180
+ 3. 第三方兼容网关,例如 yunwu,更适合作为兼容兜底。很多代理站只暴露 `/chat/completions`,是否真的能搜索,取决于站点是否在内部为你开启了 web search。
181
+
182
+ 推荐模型:
183
+
184
+ | 服务商 | 推荐模型 | 说明 |
185
+ | --- | --- | --- |
186
+ | xAI 官方 | `grok-4-1-fast-non-reasoning` | 这是当前 CLI 的默认模型,也是 `web_search` 和 `x_search` 支持最完整的路径 |
187
+ | OpenRouter | `x-ai/grok-4.1-fast` | 通过 OpenRouter 接入时,优先用这个 |
188
+ | 其他兼容网关,例如 yunwu | 以网关实际支持的 model id 为准 | 比如 yunwu 示例里使用 `grok-4-fast` |
173
189
 
174
190
  ## 搜索模式
175
191
 
@@ -191,7 +207,7 @@ grok-search skill > ~/.codex/skills/grok-search-cli/SKILL.md
191
207
 
192
208
  ### 其他兼容网关
193
209
 
194
- 当你通过其他 OpenAI-compatible 网关接入,并启用 `XAI_COMPAT_MODE=true` 时使用。
210
+ 当你通过其他 OpenAI-compatible 网关接入时使用。
195
211
 
196
212
  - 使用网关提供的兼容调用路径
197
213
  - 是否真的搜索、怎么搜索,由中转站决定