xapi-to 0.1.17 → 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 +60 -10
- package/dist/index.js +493 -44
- 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:
|
|
@@ -122,9 +155,19 @@ xapi-to get twitter.tweet_detail
|
|
|
122
155
|
xapi-to call twitter.tweet_detail --input '{"tweet_id":"1234567890"}'
|
|
123
156
|
```
|
|
124
157
|
|
|
158
|
+
For APIs that return binary data, use `--output` to request raw bytes and save
|
|
159
|
+
them directly. The CLI refuses to overwrite an existing file.
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
xapi-to call openrouter.audio_speech \
|
|
163
|
+
--input '{"body":{"input":"Hello","model":"hexgrad/kokoro-82m","voice":"af_bella"}}' \
|
|
164
|
+
--output speech.mp3
|
|
165
|
+
```
|
|
166
|
+
|
|
125
167
|
## Output Formats
|
|
126
168
|
|
|
127
|
-
|
|
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.
|
|
128
171
|
|
|
129
172
|
```bash
|
|
130
173
|
xapi-to list --format json # default, machine-readable
|
|
@@ -137,40 +180,47 @@ xapi-to list --format table # human-readable table
|
|
|
137
180
|
| Variable | Description |
|
|
138
181
|
|---|---|
|
|
139
182
|
| `XAPI_KEY` | API key (overrides config file) |
|
|
183
|
+
| `XAPI_API_KEY` | Compatible API key alias (overrides config file; lower priority than `XAPI_KEY`) |
|
|
140
184
|
| `XAPI_ACTION_HOST` | Action service host (default: `action.xapi.to`) |
|
|
185
|
+
| `XAPI_API_HOST` | Auth/account service host (default: `api.xapi.to`) |
|
|
141
186
|
| `XAPI_OUTPUT` | Default output format (`json`\|`pretty`\|`table`) |
|
|
187
|
+
| `XAPI_TRANSFER_IDLE_TIMEOUT_MS` | SSE/download idle timeout in milliseconds (default: `60000`) |
|
|
142
188
|
|
|
143
189
|
Config is stored at `~/.xapi/config.json`.
|
|
144
190
|
|
|
145
|
-
## 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.
|
|
146
196
|
|
|
147
197
|
| ID | Description |
|
|
148
198
|
|---|---|
|
|
149
199
|
| `twitter.tweet_detail` | Get tweet details and replies |
|
|
150
200
|
| `twitter.user_by_screen_name` | Get user profile by username |
|
|
151
|
-
| `twitter.user_by_screen_names` | Batch get user profiles by usernames |
|
|
152
201
|
| `twitter.user_tweets` | Get tweets from a user |
|
|
153
202
|
| `twitter.user_tweets_and_replies` | Get tweets and replies from a user |
|
|
154
203
|
| `twitter.user_media` | Get media posts from a user |
|
|
155
204
|
| `twitter.following` | Get user following list |
|
|
156
205
|
| `twitter.followers` | Get user followers |
|
|
157
206
|
| `twitter.retweeters` | Get tweet retweeters |
|
|
158
|
-
| `twitter.
|
|
207
|
+
| `twitter.search` | Search tweets |
|
|
159
208
|
| `ai.text.chat.fast` | Fast AI chat completion |
|
|
160
209
|
| `ai.text.chat.reasoning` | Advanced reasoning chat |
|
|
210
|
+
| `ai.text.chat.auto` | Model-selected chat with provider fallback |
|
|
161
211
|
| `ai.text.summarize` | Summarize long text |
|
|
162
212
|
| `ai.text.rewrite` | Rewrite text with different styles |
|
|
163
213
|
| `ai.embedding.generate` | Generate vector embeddings |
|
|
164
214
|
| `web.search` | Web search |
|
|
165
215
|
| `web.search.realtime` | Realtime web search with time filters |
|
|
166
|
-
| `
|
|
216
|
+
| `web.search.news` | News search |
|
|
167
217
|
| `crypto.token.price` | Crypto token price and changes |
|
|
168
218
|
| `crypto.token.metadata` | Crypto token metadata |
|
|
169
219
|
|
|
170
220
|
## Security
|
|
171
221
|
|
|
172
|
-
- **NEVER send your API key to any domain other than `*.xapi.to
|
|
173
|
-
- 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
|
|
174
224
|
- `topup` outputs a payment URL containing the API key — do not share publicly
|
|
175
225
|
|
|
176
226
|
## License
|