grok-search-cli 0.1.1 → 0.1.2
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 +146 -67
- package/README.zh.md +144 -66
- package/dist/cli.js +2 -2
- package/package.json +20 -2
package/README.md
CHANGED
|
@@ -1,55 +1,118 @@
|
|
|
1
1
|
# grok-search-cli
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
[简体中文](./README.zh.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://github.com/timzhong1024/grok-search-cli)
|
|
6
|
+
[](https://www.npmjs.com/package/grok-search-cli)
|
|
7
|
+
[](https://www.npmjs.com/package/grok-search-cli)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
[](https://nodejs.org/)
|
|
6
10
|
|
|
7
|
-
## Get Started
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
Make Grok's access to X and high-value public sources such as GitHub and arXiv available in any agent or shell workflow.
|
|
13
|
+
|
|
14
|
+
This CLI makes that capability directly usable in agent workflows, with fresher information for fast-moving topics and far less operational overhead than building and maintaining a custom search stack.
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
Install the package:
|
|
10
19
|
|
|
11
20
|
```bash
|
|
21
|
+
# Install the CLI globally
|
|
12
22
|
pnpm add -g grok-search-cli
|
|
13
23
|
```
|
|
14
24
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
|
|
25
|
+
Run a health check:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Check whether your config is ready
|
|
29
|
+
grok-search doctor
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
If no config exists yet, the CLI creates:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
~/.config/grok-search-cli/config.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Update the generated config file using one of the bundled examples. The default xAI official config is:
|
|
39
|
+
|
|
40
|
+
```json
|
|
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
|
|
46
|
+
}
|
|
20
47
|
```
|
|
21
48
|
|
|
22
|
-
Run
|
|
49
|
+
Run a query:
|
|
23
50
|
|
|
24
51
|
```bash
|
|
52
|
+
# Run a first search
|
|
25
53
|
grok-search "latest xAI updates"
|
|
26
54
|
```
|
|
27
55
|
|
|
28
|
-
If you do not want a global install
|
|
56
|
+
If you do not want a global install, you can run it with `npx`:
|
|
29
57
|
|
|
30
58
|
```bash
|
|
59
|
+
# Run without a global install
|
|
60
|
+
npx grok-search-cli doctor
|
|
31
61
|
npx grok-search-cli "latest xAI updates"
|
|
32
62
|
```
|
|
33
63
|
|
|
34
|
-
|
|
64
|
+
## What You Can Ask
|
|
35
65
|
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
XAI_MODEL=x-ai/grok-4-fast:online
|
|
66
|
+
```bash
|
|
67
|
+
# Search current discussion on X
|
|
68
|
+
grok-search "What are people saying about xAI on X right now?"
|
|
40
69
|
```
|
|
41
70
|
|
|
42
|
-
|
|
71
|
+
```bash
|
|
72
|
+
# Verify a fresh rumor or claim
|
|
73
|
+
grok-search "Somebody said xAI open-sourced model X today. Is that true?"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Search papers and repos together
|
|
78
|
+
grok-search "Find the latest arXiv papers and GitHub repos about browser-use agents"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Constrain web results to specific domains
|
|
83
|
+
grok-search "latest AI SDK updates" \
|
|
84
|
+
--allowed-domains=ai-sdk.dev,vercel.com
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Constrain X results by handle and date
|
|
89
|
+
grok-search "latest xAI status on X" \
|
|
90
|
+
--allowed-handles=xai,elonmusk \
|
|
91
|
+
--from-date=2026-04-01
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Return machine-readable JSON
|
|
96
|
+
grok-search "latest xAI updates" --json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Why Use It
|
|
100
|
+
|
|
101
|
+
- Research what is happening now, not what the base model remembers
|
|
102
|
+
- Search the web and X in one call
|
|
103
|
+
- Return clean terminal output or JSON for agents
|
|
104
|
+
- Work with xAI, OpenRouter, or compatible gateways
|
|
43
105
|
|
|
44
106
|
## Use With Agents
|
|
45
107
|
|
|
46
108
|
This repo ships with an installable skill:
|
|
47
109
|
|
|
48
110
|
```bash
|
|
49
|
-
|
|
111
|
+
# Install the bundled skill with the skills CLI
|
|
112
|
+
npx skills add timzhong1024/grok-search-cli --skill grok-search-cli
|
|
50
113
|
```
|
|
51
114
|
|
|
52
|
-
For Codex,
|
|
115
|
+
For Codex, a matching preset is included at [agents/codex.yaml](./agents/codex.yaml).
|
|
53
116
|
|
|
54
117
|
Trigger it with:
|
|
55
118
|
|
|
@@ -57,83 +120,98 @@ Trigger it with:
|
|
|
57
120
|
Spawn a grok-research researcher agent with gpt-5.4-mini and low reasoning, then use grok-search for high-freshness web+X research.
|
|
58
121
|
```
|
|
59
122
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
Recommended order:
|
|
123
|
+
The bundled skill can also be printed to `stdout` and redirected:
|
|
63
124
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
125
|
+
```bash
|
|
126
|
+
# Print the bundled skill and save it manually
|
|
127
|
+
grok-search skill > ~/.codex/skills/grok-search-cli/SKILL.md
|
|
128
|
+
```
|
|
67
129
|
|
|
68
|
-
##
|
|
130
|
+
## Configuration
|
|
69
131
|
|
|
70
|
-
|
|
132
|
+
`process.env` takes priority over `~/.config/grok-search-cli/config.json`, so shell env is the easiest way to override config temporarily.
|
|
71
133
|
|
|
72
|
-
|
|
134
|
+
### xAI Official
|
|
73
135
|
|
|
74
|
-
|
|
75
|
-
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"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
|
|
142
|
+
}
|
|
143
|
+
```
|
|
76
144
|
|
|
77
|
-
|
|
145
|
+
### OpenRouter
|
|
78
146
|
|
|
79
|
-
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"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
|
|
153
|
+
}
|
|
154
|
+
```
|
|
80
155
|
|
|
81
|
-
|
|
156
|
+
### Yunwu / Other Compatible Gateways
|
|
82
157
|
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"XAI_API_KEY": "your_proxy_api_key",
|
|
161
|
+
"XAI_MODEL": "grok-4-fast",
|
|
162
|
+
"XAI_BASE_URL": "https://yunwu.ai/v1",
|
|
163
|
+
"XAI_COMPAT_MODE": true
|
|
164
|
+
}
|
|
86
165
|
```
|
|
87
166
|
|
|
88
|
-
|
|
167
|
+
## Provider Guide
|
|
89
168
|
|
|
90
|
-
|
|
169
|
+
Recommended order:
|
|
91
170
|
|
|
92
|
-
|
|
171
|
+
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.
|
|
93
174
|
|
|
94
|
-
|
|
95
|
-
- tool-specific flags such as `--allowed-domains`, `--allowed-handles`, and `--from-date` are not forwarded; the CLI prints a warning if you pass them
|
|
175
|
+
## Search Modes
|
|
96
176
|
|
|
97
|
-
|
|
177
|
+
### xAI Official
|
|
98
178
|
|
|
99
|
-
|
|
100
|
-
grok-search "What are people saying about xAI on X right now?"
|
|
101
|
-
```
|
|
179
|
+
Use this when you connect directly to xAI.
|
|
102
180
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
181
|
+
- Supports both web search and X search
|
|
182
|
+
- Supports web domain filters, X handle filters, date filters, and image or video understanding options
|
|
183
|
+
- Best choice when you want the full feature set
|
|
106
184
|
|
|
107
|
-
|
|
108
|
-
grok-search "Find the latest arXiv papers and GitHub repos about browser-use agents"
|
|
109
|
-
```
|
|
185
|
+
### OpenRouter
|
|
110
186
|
|
|
111
|
-
|
|
112
|
-
grok-search "latest AI SDK updates" \
|
|
113
|
-
--allowed-domains=ai-sdk.dev,vercel.com
|
|
114
|
-
```
|
|
187
|
+
Use this when `XAI_BASE_URL` points to `openrouter.ai`.
|
|
115
188
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
--from-date=2026-04-01
|
|
120
|
-
```
|
|
189
|
+
- Supports web search through OpenRouter's server-side search tool
|
|
190
|
+
- Supports web domain filters
|
|
191
|
+
- Does not currently forward X-specific filters such as handles, dates, image, or video options
|
|
121
192
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
193
|
+
### Other Compatible Gateways
|
|
194
|
+
|
|
195
|
+
Use this when you connect through another OpenAI-compatible gateway with `XAI_COMPAT_MODE=true`.
|
|
196
|
+
|
|
197
|
+
- Uses the gateway's compatibility path
|
|
198
|
+
- Search behavior depends on the gateway
|
|
199
|
+
- Tool-specific filters are not forwarded, so advanced search controls may not be available
|
|
200
|
+
|
|
201
|
+
## CLI Reference
|
|
125
202
|
|
|
126
203
|
```bash
|
|
127
|
-
|
|
204
|
+
# Check whether your config is ready
|
|
205
|
+
grok-search doctor
|
|
128
206
|
```
|
|
129
207
|
|
|
130
|
-
The command prints the bundled skill to `stdout`, so it can also be redirected:
|
|
131
|
-
|
|
132
208
|
```bash
|
|
133
|
-
|
|
209
|
+
# Print the bundled skill to stdout
|
|
210
|
+
grok-search skill
|
|
134
211
|
```
|
|
135
212
|
|
|
136
213
|
```bash
|
|
214
|
+
# Show all CLI options
|
|
137
215
|
grok-search --help
|
|
138
216
|
```
|
|
139
217
|
|
|
@@ -142,6 +220,7 @@ grok-search --help
|
|
|
142
220
|
For local `.env` workflows, `pnpm dev` already runs through `dotenvx`:
|
|
143
221
|
|
|
144
222
|
```bash
|
|
223
|
+
# Run the TypeScript entrypoint through dotenvx in development
|
|
145
224
|
pnpm install
|
|
146
225
|
pnpm dev "latest xAI updates" --verbose
|
|
147
226
|
```
|
package/README.zh.md
CHANGED
|
@@ -2,54 +2,116 @@
|
|
|
2
2
|
|
|
3
3
|
[English](./README.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://github.com/timzhong1024/grok-search-cli)
|
|
6
|
+
[](https://www.npmjs.com/package/grok-search-cli)
|
|
7
|
+
[](https://www.npmjs.com/package/grok-search-cli)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
[](https://nodejs.org/)
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
把 Grok 对 X 以及 GitHub、arXiv 等高价值公开数据源的访问能力,带到任何 agent 和 shell 工作流里。
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
这个 CLI 让这套能力可以直接用于 agent 工作流:在处理快速变化的话题时,更容易获得更新鲜的信息,同时显著降低自建和维护搜索能力的成本。
|
|
14
|
+
|
|
15
|
+
## 快速开始
|
|
16
|
+
|
|
17
|
+
先安装:
|
|
10
18
|
|
|
11
19
|
```bash
|
|
20
|
+
# 全局安装 CLI
|
|
12
21
|
pnpm add -g grok-search-cli
|
|
13
22
|
```
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
#
|
|
19
|
-
|
|
24
|
+
然后做一次健康检查:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# 检查当前配置是否可用
|
|
28
|
+
grok-search doctor
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
如果本地还没有配置文件,CLI 会自动创建:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
~/.config/grok-search-cli/config.json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
打开这个文件,并按内置示例更新配置。默认的 xAI 官方配置如下:
|
|
38
|
+
|
|
39
|
+
```json
|
|
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
|
|
45
|
+
}
|
|
20
46
|
```
|
|
21
47
|
|
|
22
|
-
|
|
48
|
+
然后执行查询:
|
|
23
49
|
|
|
24
50
|
```bash
|
|
51
|
+
# 先跑一个最基本的搜索
|
|
25
52
|
grok-search "latest xAI updates"
|
|
26
53
|
```
|
|
27
54
|
|
|
28
|
-
|
|
55
|
+
如果不想全局安装,也可以通过 `npx` 运行:
|
|
29
56
|
|
|
30
57
|
```bash
|
|
58
|
+
# 不全局安装,直接用 npx 运行
|
|
59
|
+
npx grok-search-cli doctor
|
|
31
60
|
npx grok-search-cli "latest xAI updates"
|
|
32
61
|
```
|
|
33
62
|
|
|
34
|
-
|
|
63
|
+
## 可以怎么搜
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# 看看现在 X 上都在怎么讨论 xAI
|
|
67
|
+
grok-search "现在 X 上大家都在怎么讨论 xAI?"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# 验证一个刚出现的说法是不是真的
|
|
72
|
+
grok-search "有人说 xAI 今天开源了某个模型,这是真的吗?"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# 一次找论文和 GitHub 项目
|
|
77
|
+
grok-search "找最新的 browser-use agents 相关 arXiv 论文和 GitHub 项目"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# 把网页搜索限制在指定站点
|
|
82
|
+
grok-search "latest AI SDK updates" \
|
|
83
|
+
--allowed-domains=ai-sdk.dev,vercel.com
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# 按账号和日期限制 X 搜索范围
|
|
88
|
+
grok-search "latest xAI status on X" \
|
|
89
|
+
--allowed-handles=xai,elonmusk \
|
|
90
|
+
--from-date=2026-04-01
|
|
91
|
+
```
|
|
35
92
|
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
XAI_MODEL=x-ai/grok-4-fast:online
|
|
93
|
+
```bash
|
|
94
|
+
# 返回适合 agent 消费的 JSON
|
|
95
|
+
grok-search "latest xAI updates" --json
|
|
40
96
|
```
|
|
41
97
|
|
|
42
|
-
|
|
98
|
+
## 为什么用它
|
|
99
|
+
|
|
100
|
+
- 查“现在发生了什么”,而不是赌模型记忆有没有过时
|
|
101
|
+
- 一次调用同时看网页和 X
|
|
102
|
+
- 终端可直接读,agent 也能吃 JSON
|
|
103
|
+
- 可接 xAI、OpenRouter 和兼容代理站
|
|
43
104
|
|
|
44
105
|
## 给 Agent 用
|
|
45
106
|
|
|
46
107
|
这个仓库自带一个可安装 skill:
|
|
47
108
|
|
|
48
109
|
```bash
|
|
49
|
-
|
|
110
|
+
# 用 skills CLI 安装仓库自带的 skill
|
|
111
|
+
npx skills add timzhong1024/grok-search-cli --skill grok-search-cli
|
|
50
112
|
```
|
|
51
113
|
|
|
52
|
-
如果是 Codex
|
|
114
|
+
如果是 Codex,仓库里还带了一份可配套使用的 preset,见 [agents/codex.yaml](./agents/codex.yaml)。
|
|
53
115
|
|
|
54
116
|
可直接用这句触发:
|
|
55
117
|
|
|
@@ -57,83 +119,98 @@ npx skills add <owner>/<repo> --skill grok-search-cli
|
|
|
57
119
|
Spawn a grok-research researcher agent with gpt-5.4-mini and low reasoning, then use grok-search for high-freshness web+X research.
|
|
58
120
|
```
|
|
59
121
|
|
|
60
|
-
|
|
122
|
+
内置 skill 也可以直接打印到 `stdout` 后手动安装:
|
|
61
123
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
3. 如果使用第三方代理站,需要自己确认搜索能力。很多代理站只暴露 `/chat/completions`,是否真的能搜索,取决于站点是否在内部为你开启了 web search。
|
|
124
|
+
```bash
|
|
125
|
+
# 把内置 skill 打印出来并手动保存
|
|
126
|
+
grok-search skill > ~/.codex/skills/grok-search-cli/SKILL.md
|
|
127
|
+
```
|
|
67
128
|
|
|
68
|
-
##
|
|
129
|
+
## 配置方式
|
|
69
130
|
|
|
70
|
-
|
|
131
|
+
`process.env` 的优先级高于 `~/.config/grok-search-cli/config.json`,因此在临时覆盖配置时,优先使用 shell 环境变量。
|
|
71
132
|
|
|
72
|
-
|
|
133
|
+
### xAI 官方
|
|
73
134
|
|
|
74
|
-
|
|
75
|
-
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"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
|
|
141
|
+
}
|
|
142
|
+
```
|
|
76
143
|
|
|
77
|
-
|
|
144
|
+
### OpenRouter
|
|
78
145
|
|
|
79
|
-
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"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
|
|
152
|
+
}
|
|
153
|
+
```
|
|
80
154
|
|
|
81
|
-
|
|
155
|
+
### yunwu / 其他兼容代理站
|
|
82
156
|
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"XAI_API_KEY": "your_proxy_api_key",
|
|
160
|
+
"XAI_MODEL": "grok-4-fast",
|
|
161
|
+
"XAI_BASE_URL": "https://yunwu.ai/v1",
|
|
162
|
+
"XAI_COMPAT_MODE": true
|
|
163
|
+
}
|
|
86
164
|
```
|
|
87
165
|
|
|
88
|
-
|
|
166
|
+
## 服务选择建议
|
|
89
167
|
|
|
90
|
-
|
|
168
|
+
推荐顺序:
|
|
91
169
|
|
|
92
|
-
|
|
170
|
+
1. 优先使用 xAI 官方服务。这是 `web_search` 和 `x_search` 最直接、最稳定的路径。
|
|
171
|
+
2. OpenRouter 也比较稳。它对 xAI 模型可以走原生 xAI 支持的 web search。
|
|
172
|
+
3. 如果使用第三方代理站,需要自己确认搜索能力。很多代理站只暴露 `/chat/completions`,是否真的能搜索,取决于站点是否在内部为你开启了 web search。
|
|
93
173
|
|
|
94
|
-
|
|
95
|
-
- `--allowed-domains`、`--allowed-handles`、`--from-date` 这类 tool 参数不会下传;如果传了,CLI 会打印 warning
|
|
174
|
+
## 搜索模式
|
|
96
175
|
|
|
97
|
-
|
|
176
|
+
### xAI 官方
|
|
98
177
|
|
|
99
|
-
|
|
100
|
-
grok-search "现在 X 上大家都在怎么讨论 xAI?"
|
|
101
|
-
```
|
|
178
|
+
直接连接 xAI 官方服务时使用。
|
|
102
179
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
180
|
+
- 同时支持 Web Search 和 X Search
|
|
181
|
+
- 支持网页域名过滤、X 账号过滤、日期过滤,以及图片或视频理解选项
|
|
182
|
+
- 这是能力最完整的模式
|
|
106
183
|
|
|
107
|
-
|
|
108
|
-
grok-search "找最新的 browser-use agents 相关 arXiv 论文和 GitHub 项目"
|
|
109
|
-
```
|
|
184
|
+
### OpenRouter
|
|
110
185
|
|
|
111
|
-
|
|
112
|
-
grok-search "latest AI SDK updates" \
|
|
113
|
-
--allowed-domains=ai-sdk.dev,vercel.com
|
|
114
|
-
```
|
|
186
|
+
当 `XAI_BASE_URL` 指向 `openrouter.ai` 时使用。
|
|
115
187
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
--from-date=2026-04-01
|
|
120
|
-
```
|
|
188
|
+
- 支持通过 OpenRouter 的服务端搜索工具进行网页搜索
|
|
189
|
+
- 只支持网页域名过滤
|
|
190
|
+
- **不支持**配置 X 专属配置,例如账号、日期、以及图片或视频理解选项
|
|
121
191
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
192
|
+
### 其他兼容网关
|
|
193
|
+
|
|
194
|
+
当你通过其他 OpenAI-compatible 网关接入,并启用 `XAI_COMPAT_MODE=true` 时使用。
|
|
195
|
+
|
|
196
|
+
- 使用网关提供的兼容调用路径
|
|
197
|
+
- 是否真的搜索、怎么搜索,由中转站决定
|
|
198
|
+
- 不支持所有搜索高级配置
|
|
199
|
+
|
|
200
|
+
## CLI 参考
|
|
125
201
|
|
|
126
202
|
```bash
|
|
127
|
-
|
|
203
|
+
# 检查当前配置是否可用
|
|
204
|
+
grok-search doctor
|
|
128
205
|
```
|
|
129
206
|
|
|
130
|
-
这个命令会把内置 skill 直接打印到 `stdout`,所以也可以重定向保存:
|
|
131
|
-
|
|
132
207
|
```bash
|
|
133
|
-
|
|
208
|
+
# 把内置 skill 打印到 stdout
|
|
209
|
+
grok-search skill
|
|
134
210
|
```
|
|
135
211
|
|
|
136
212
|
```bash
|
|
213
|
+
# 查看完整命令帮助
|
|
137
214
|
grok-search --help
|
|
138
215
|
```
|
|
139
216
|
|
|
@@ -142,6 +219,7 @@ grok-search --help
|
|
|
142
219
|
本地如果要走 `.env`,`pnpm dev` 已经默认走 `dotenvx`:
|
|
143
220
|
|
|
144
221
|
```bash
|
|
222
|
+
# 开发时通过 dotenvx 运行 TypeScript 入口
|
|
145
223
|
pnpm install
|
|
146
224
|
pnpm dev "latest xAI updates" --verbose
|
|
147
225
|
```
|
package/dist/cli.js
CHANGED
|
@@ -148,12 +148,12 @@ function ae() {
|
|
|
148
148
|
process.stdout.write(`\
|
|
149
149
|
Usage:
|
|
150
150
|
grok-search "<prompt>" [options]
|
|
151
|
-
grok-search skill
|
|
152
151
|
grok-search doctor
|
|
152
|
+
grok-search skill
|
|
153
153
|
|
|
154
154
|
Options:
|
|
155
|
-
skill Print the bundled skill to stdout
|
|
156
155
|
doctor Show config and credential diagnostics
|
|
156
|
+
skill Print the bundled skill to stdout
|
|
157
157
|
--model=<id> Override model. Default: ${e}
|
|
158
158
|
--timeout=<seconds> Request timeout. Default: 60
|
|
159
159
|
--json Output JSON
|
package/package.json
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grok-search-cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "CLI for
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "AI-friendly CLI for high-freshness web and X research with Grok search tool.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agent",
|
|
7
|
+
"agentic",
|
|
8
|
+
"ai",
|
|
9
|
+
"cli",
|
|
10
|
+
"grok",
|
|
11
|
+
"llm",
|
|
12
|
+
"research",
|
|
13
|
+
"search",
|
|
14
|
+
"web-search",
|
|
15
|
+
"x-search",
|
|
16
|
+
"x",
|
|
17
|
+
"xai",
|
|
18
|
+
"freshness",
|
|
19
|
+
"real-time",
|
|
20
|
+
"github",
|
|
21
|
+
"shell"
|
|
22
|
+
],
|
|
5
23
|
"license": "MIT",
|
|
6
24
|
"type": "module",
|
|
7
25
|
"bin": {
|