xapi-to 0.1.18 → 0.1.19
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/LICENSE +21 -0
- package/README.md +51 -10
- package/dist/index.js +384 -46
- package/package.json +9 -2
- package/skills/xapi/SKILL.md +485 -0
- package/skills/xapi/guides/ai.md +200 -0
- package/skills/xapi/guides/ai_gateway.md +263 -0
- package/skills/xapi/guides/crypto.md +197 -0
- package/skills/xapi/guides/douyin.md +297 -0
- package/skills/xapi/guides/google_search.md +194 -0
- package/skills/xapi/guides/linkedin.md +198 -0
- package/skills/xapi/guides/reddit.md +312 -0
- package/skills/xapi/guides/sms.md +186 -0
- package/skills/xapi/guides/tiktok.md +322 -0
- package/skills/xapi/guides/twitter.md +276 -0
- package/skills/xapi/guides/weibo.md +301 -0
- package/skills/xapi/guides/ws_gateway.md +206 -0
- package/skills/xapi/guides/xiaohongshu.md +315 -0
- package/skills/xapi/scripts/download_tweet_videos.sh +125 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 xAPI Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -22,15 +22,20 @@ The published CLI runs on Node.js 18+. Bun is only required for local source dev
|
|
|
22
22
|
```bash
|
|
23
23
|
# 1. Register a new account (apiKey saved automatically)
|
|
24
24
|
xapi-to register
|
|
25
|
+
# Open the returned private bindUrl to upgrade the virtual account through Twitter OAuth
|
|
25
26
|
|
|
26
27
|
# 1b. Or register with an inviter's referral code (please replace xapito to your referral code)
|
|
27
28
|
xapi-to register --referral-code xapito
|
|
28
29
|
|
|
29
|
-
# 2. Or set an existing key
|
|
30
|
-
|
|
30
|
+
# 2. Or set an existing key without putting it in shell history
|
|
31
|
+
read -rsp 'xAPI key: ' XAPI_KEY_INPUT
|
|
32
|
+
printf '\n'
|
|
33
|
+
printf '%s\n' "$XAPI_KEY_INPUT" | xapi-to config set apiKey=-
|
|
34
|
+
unset XAPI_KEY_INPUT
|
|
31
35
|
|
|
32
36
|
# 3. Or via env var
|
|
33
37
|
export XAPI_KEY=sk-xxx
|
|
38
|
+
# XAPI_API_KEY is also accepted; XAPI_KEY has higher precedence
|
|
34
39
|
|
|
35
40
|
# 4. Verify connectivity
|
|
36
41
|
xapi-to config health
|
|
@@ -55,6 +60,9 @@ xapi-to list --service-id <id> # filter by service
|
|
|
55
60
|
|
|
56
61
|
xapi-to search "twitter" # search by keyword
|
|
57
62
|
xapi-to search "token price" --source api # search APIs only
|
|
63
|
+
xapi-to search "token price" --sort relevance # strongest text match
|
|
64
|
+
xapi-to search "token price" --sort price # lowest comparable price
|
|
65
|
+
xapi-to search "twitter" --include-all-versions # include active non-default majors
|
|
58
66
|
|
|
59
67
|
xapi-to categories # list all categories
|
|
60
68
|
xapi-to categories --source capability # categories for capabilities only
|
|
@@ -63,9 +71,27 @@ xapi-to services # list all services
|
|
|
63
71
|
xapi-to services --category Social --page-size 10 # filter and paginate
|
|
64
72
|
|
|
65
73
|
xapi-to get twitter.tweet_detail # get action schema
|
|
74
|
+
xapi-to get-batch twitter.tweet_detail crypto.token.price # get several schemas
|
|
66
75
|
xapi-to call twitter.tweet_detail --input '{"tweet_id":"1234567890"}' # execute
|
|
76
|
+
xapi-to call ai.text.chat.fast --input '{"messages":[{"role":"user","content":"Hi"}]}' --stream
|
|
67
77
|
```
|
|
68
78
|
|
|
79
|
+
Search uses `--sort default|relevance|price`. `default` is the recommended
|
|
80
|
+
order: it considers keyword coverage and match quality first, then favors
|
|
81
|
+
stable built-in capabilities when matches are otherwise comparable.
|
|
82
|
+
`relevance` is source-neutral and selects the strongest text match. `price`
|
|
83
|
+
preserves keyword coverage and an exact action ID first, keeps endpoint-local
|
|
84
|
+
matches ahead of service-only matches, then orders comparable fixed per-call
|
|
85
|
+
USD list prices from low to high. Dynamic, per-token, per-resource, and unknown
|
|
86
|
+
prices appear after comparable prices in the same match bucket and are never
|
|
87
|
+
treated as free. All three modes rank the full matching result set before
|
|
88
|
+
applying `--page` and `--page-size`.
|
|
89
|
+
|
|
90
|
+
`--stream` forwards an HTTP Server-Sent Events (SSE) response; it is not a
|
|
91
|
+
WebSocket client. Active SSE and raw downloads may run longer than 60 seconds,
|
|
92
|
+
but abort after 60 seconds without data by default. Set
|
|
93
|
+
`XAPI_TRANSFER_IDLE_TIMEOUT_MS` to change that idle timeout.
|
|
94
|
+
|
|
69
95
|
### Async Task Commands
|
|
70
96
|
|
|
71
97
|
Task helpers built on top of the `task.poll` capability.
|
|
@@ -82,6 +108,8 @@ Bind third-party OAuth accounts (e.g. Twitter) to your API key.
|
|
|
82
108
|
|
|
83
109
|
```bash
|
|
84
110
|
xapi-to oauth bind --provider twitter # bind Twitter account
|
|
111
|
+
xapi-to oauth providers # inspect current providers/default scopes
|
|
112
|
+
xapi-to oauth bind --provider twitter --scopes "<scope list>" # optional explicit override
|
|
85
113
|
xapi-to oauth status # list current bindings
|
|
86
114
|
xapi-to oauth unbind <binding-id> # remove a binding
|
|
87
115
|
xapi-to oauth providers # list available providers
|
|
@@ -93,6 +121,7 @@ xapi-to oauth providers # list available provide
|
|
|
93
121
|
xapi-to register # create account, saves apiKey automatically
|
|
94
122
|
xapi-to register --referral-code xapito # register with an inviter's referral code (please replace xapito to your referral code)
|
|
95
123
|
xapi-to register xapito # positional shorthand for --referral-code
|
|
124
|
+
xapi-to register --force # replace an existing file-based key
|
|
96
125
|
xapi-to balance # show USD balance
|
|
97
126
|
xapi-to topup # generate payment URL
|
|
98
127
|
xapi-to topup --method stripe --amount 10 # stripe, $10
|
|
@@ -103,10 +132,14 @@ xapi-to topup --method x402 # x402 (USDC on Base)
|
|
|
103
132
|
|
|
104
133
|
```bash
|
|
105
134
|
xapi-to config show # show current config
|
|
106
|
-
xapi-to config set apiKey
|
|
135
|
+
xapi-to config set apiKey=- # paste key, then press Ctrl-D
|
|
107
136
|
xapi-to config health # check backend connectivity
|
|
108
137
|
```
|
|
109
138
|
|
|
139
|
+
`XAPI_KEY` overrides `XAPI_API_KEY`, and both override the config file. The CLI
|
|
140
|
+
warns when a saved key is shadowed. Unset the environment variable before
|
|
141
|
+
`register`, including `register --force`, so the new account key becomes active.
|
|
142
|
+
|
|
110
143
|
## Workflow: Always GET before CALL
|
|
111
144
|
|
|
112
145
|
Before calling any action, always read its schema first to understand required parameters:
|
|
@@ -133,7 +166,8 @@ xapi-to call openrouter.audio_speech \
|
|
|
133
166
|
|
|
134
167
|
## Output Formats
|
|
135
168
|
|
|
136
|
-
|
|
169
|
+
Normal command output is JSON by default. `call --stream` writes raw HTTP SSE
|
|
170
|
+
frames, while `call --output` writes raw response bytes to the requested file.
|
|
137
171
|
|
|
138
172
|
```bash
|
|
139
173
|
xapi-to list --format json # default, machine-readable
|
|
@@ -146,40 +180,47 @@ xapi-to list --format table # human-readable table
|
|
|
146
180
|
| Variable | Description |
|
|
147
181
|
|---|---|
|
|
148
182
|
| `XAPI_KEY` | API key (overrides config file) |
|
|
183
|
+
| `XAPI_API_KEY` | Compatible API key alias (overrides config file; lower priority than `XAPI_KEY`) |
|
|
149
184
|
| `XAPI_ACTION_HOST` | Action service host (default: `action.xapi.to`) |
|
|
185
|
+
| `XAPI_API_HOST` | Auth/account service host (default: `api.xapi.to`) |
|
|
150
186
|
| `XAPI_OUTPUT` | Default output format (`json`\|`pretty`\|`table`) |
|
|
187
|
+
| `XAPI_TRANSFER_IDLE_TIMEOUT_MS` | SSE/download idle timeout in milliseconds (default: `60000`) |
|
|
151
188
|
|
|
152
189
|
Config is stored at `~/.xapi/config.json`.
|
|
153
190
|
|
|
154
|
-
## Built-in Capabilities
|
|
191
|
+
## Selected Built-in Capabilities
|
|
192
|
+
|
|
193
|
+
This is a small quick-reference subset, not the complete or permanently fixed
|
|
194
|
+
catalog. Use `xapi-to list --source capability`, `search`, and `get` for the
|
|
195
|
+
current IDs and schemas.
|
|
155
196
|
|
|
156
197
|
| ID | Description |
|
|
157
198
|
|---|---|
|
|
158
199
|
| `twitter.tweet_detail` | Get tweet details and replies |
|
|
159
200
|
| `twitter.user_by_screen_name` | Get user profile by username |
|
|
160
|
-
| `twitter.user_by_screen_names` | Batch get user profiles by usernames |
|
|
161
201
|
| `twitter.user_tweets` | Get tweets from a user |
|
|
162
202
|
| `twitter.user_tweets_and_replies` | Get tweets and replies from a user |
|
|
163
203
|
| `twitter.user_media` | Get media posts from a user |
|
|
164
204
|
| `twitter.following` | Get user following list |
|
|
165
205
|
| `twitter.followers` | Get user followers |
|
|
166
206
|
| `twitter.retweeters` | Get tweet retweeters |
|
|
167
|
-
| `twitter.
|
|
207
|
+
| `twitter.search` | Search tweets |
|
|
168
208
|
| `ai.text.chat.fast` | Fast AI chat completion |
|
|
169
209
|
| `ai.text.chat.reasoning` | Advanced reasoning chat |
|
|
210
|
+
| `ai.text.chat.auto` | Model-selected chat with provider fallback |
|
|
170
211
|
| `ai.text.summarize` | Summarize long text |
|
|
171
212
|
| `ai.text.rewrite` | Rewrite text with different styles |
|
|
172
213
|
| `ai.embedding.generate` | Generate vector embeddings |
|
|
173
214
|
| `web.search` | Web search |
|
|
174
215
|
| `web.search.realtime` | Realtime web search with time filters |
|
|
175
|
-
| `
|
|
216
|
+
| `web.search.news` | News search |
|
|
176
217
|
| `crypto.token.price` | Crypto token price and changes |
|
|
177
218
|
| `crypto.token.metadata` | Crypto token metadata |
|
|
178
219
|
|
|
179
220
|
## Security
|
|
180
221
|
|
|
181
|
-
- **NEVER send your API key to any domain other than `*.xapi.to
|
|
182
|
-
- The key is stored at `~/.xapi/config.json
|
|
222
|
+
- **NEVER send your API key to any domain other than `xapi.to`, `*.xapi.to`, `xapi.xyz`, `*.xapi.xyz`, or explicitly configured localhost/loopback development hosts**
|
|
223
|
+
- The key is stored at `~/.xapi/config.json`; the CLI enforces owner-only Unix permissions — do not expose this file
|
|
183
224
|
- `topup` outputs a payment URL containing the API key — do not share publicly
|
|
184
225
|
|
|
185
226
|
## License
|