@aisa-one/cli 0.2.2 → 0.2.4

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +154 -1
  2. package/README.md +250 -103
  3. package/dist/api.d.ts +46 -1
  4. package/dist/api.js +77 -8
  5. package/dist/cache.d.ts +18 -0
  6. package/dist/cache.js +65 -0
  7. package/dist/catalog.d.ts +90 -0
  8. package/dist/catalog.js +101 -0
  9. package/dist/commands/account.js +4 -2
  10. package/dist/commands/api.d.ts +18 -4
  11. package/dist/commands/api.js +357 -24
  12. package/dist/commands/auth.js +1 -1
  13. package/dist/commands/cacheCmd.d.ts +2 -0
  14. package/dist/commands/cacheCmd.js +10 -0
  15. package/dist/commands/completionCmd.d.ts +7 -0
  16. package/dist/commands/completionCmd.js +37 -0
  17. package/dist/commands/configCmd.js +19 -1
  18. package/dist/commands/finance.d.ts +4 -0
  19. package/dist/commands/finance.js +212 -29
  20. package/dist/commands/models.js +6 -0
  21. package/dist/commands/run.d.ts +21 -0
  22. package/dist/commands/run.js +113 -6
  23. package/dist/commands/search.js +8 -3
  24. package/dist/commands/skills.d.ts +6 -2
  25. package/dist/commands/skills.js +199 -144
  26. package/dist/commands/twitter.js +2 -3
  27. package/dist/commands/video.d.ts +40 -0
  28. package/dist/commands/video.js +272 -55
  29. package/dist/completion.d.ts +26 -0
  30. package/dist/completion.js +293 -0
  31. package/dist/constants.d.ts +55 -5
  32. package/dist/constants.js +136 -11
  33. package/dist/index.js +88 -26
  34. package/dist/skills-registry.d.ts +64 -0
  35. package/dist/skills-registry.js +219 -0
  36. package/dist/types.d.ts +24 -0
  37. package/dist/utils/file.d.ts +5 -1
  38. package/dist/utils/file.js +5 -1
  39. package/dist/utils/pool.d.ts +8 -0
  40. package/dist/utils/pool.js +27 -0
  41. package/package.json +10 -4
  42. package/tests/account.test.ts +0 -89
  43. package/tests/streaming.test.ts +0 -73
package/CHANGELOG.md CHANGED
@@ -7,6 +7,157 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.4] — 2026-08-07
11
+
12
+ Text-only follow-up to 0.2.3: no behavioural change, but the URL it printed
13
+ sent people to a 404.
14
+
15
+ ### Fixed
16
+
17
+ - **`aisa usage` and `aisa login` pointed at `aisa.one/dashboard`, which
18
+ returns 404.** The customer console is served at `console.aisa.one`; the
19
+ API-key and usage-log pages are `/api-keys` and `/logs`. Both commands and
20
+ both README references now say so.
21
+
22
+ ### Changed
23
+
24
+ - **The brand is written `AIsa`, not `AISA`,** in `--help` output, the npm
25
+ package description, the skill templates, and the README. The `AISA_*`
26
+ environment variables and `X-AISA-*` response headers are technical
27
+ identifiers and keep their existing casing.
28
+
29
+ ## [0.2.3] — 2026-08-07
30
+
31
+ Every command documented in the README was checked against the live gateway.
32
+ Eight were broken. This release fixes everything that the gateway already
33
+ supports today; nothing here depends on a backend change.
34
+
35
+ ### Added
36
+
37
+ - **`aisa run --show-cost`** prints the gateway's billing headers
38
+ (`X-AISA-Price-USD`, accounted/estimated credits, credit model, pricing
39
+ strategy, price key, request id) on stderr, leaving `--raw | jq` a clean
40
+ pipe. Metered providers are the reason it exists: DataForSEO and Jina bill
41
+ per consumed credit, but `/info/apis` reports every provider's pricing as
42
+ flat `per_request`, so the headers are the only accurate record of what a
43
+ call cost. Routes that report no amount say so explicitly rather than
44
+ printing nothing, which would read as "this was free".
45
+
46
+ - **Shell completion.** `aisa completion <bash|zsh|fish>` prints an installable
47
+ script; with no argument it detects the shell from `$SHELL`. Beyond commands
48
+ and flags it completes provider slugs, a provider's endpoints, skill names,
49
+ and model ids from the local cache. Completion never makes a network request —
50
+ a cold cache simply offers no dynamic values rather than stalling the prompt.
51
+ - **`aisa api list` / `show` / `search` / `code` now work.** They read the
52
+ public `/info/apis` catalog — 29 providers, 950+ endpoints — and **no longer
53
+ require an API key**, so the catalog is browsable before signup. Note that a
54
+ provider's id is not always its URL slug (`brave-search` serves
55
+ `/apis/v1/brave/...`); `api show` prints the runnable path.
56
+ - **`aisa cache clear` / `cache path`** for the on-disk catalog and skills
57
+ cache (`~/.aisa/cache`, overridable with `AISA_CACHE_DIR`). Most commands
58
+ accept `--refresh` to bypass it.
59
+ - **`aisa run --llm` / `--domain`** to override base-URL detection.
60
+ - **`aisa video create` now builds the right request body per model family.**
61
+ The gateway rewrites only the top-level `model` and forwards the rest, so the
62
+ body belongs to the owning vendor: Seedance needs a `content` array and
63
+ rejects the Bailian `input`/`parameters` shape with a 400, while i2v and r2v
64
+ models need `input.media[]`. New `--image` (shorthand for
65
+ `--media first_frame=<url>`), `--media <type=url>` covering `first_frame`,
66
+ `last_frame`, `driving_audio` and `first_clip`, and `--body '<json>'` as a
67
+ verbatim escape hatch. A model that needs source media now fails immediately
68
+ instead of being accepted, billed, and failing upstream a minute later.
69
+ - **`aisa video create --resolution` / `--duration`**, and `--output` now
70
+ actually downloads the finished clip (it was previously accepted and ignored).
71
+ - **`aisa screener --min-market-cap` and `--filter field:op:value`**; sector
72
+ names are normalised to GICS, so `--sector Technology` resolves to
73
+ `Information Technology` rather than silently matching nothing.
74
+ - **`aisa crypto --id` and `--source`**; `aisa skills install --force`;
75
+ `aisa skills list --category` / `--limit` (previously accepted and ignored).
76
+ - `GITHUB_TOKEN` / `GH_TOKEN` is used for skills-registry requests when set,
77
+ raising the GitHub rate limit from 60/hr to 5000/hr.
78
+
79
+ ### Fixed
80
+
81
+ - **`aisa run` reached only 6 of 29 providers.** The slug whitelist listed nine
82
+ entries, two of which (`services`, `crypto`) do not exist, and everything
83
+ outside it was sent to the LLM gateway and 404'd. Detection is inverted: the
84
+ whitelist now covers LLM gateway routes, which are hardcoded server-side, and
85
+ everything else defaults to the integration base — so newly added providers
86
+ work without a CLI release. A 404 now suggests near-miss slugs.
87
+ - **`aisa run classify ...` reached the wrong base.** The gateway serves
88
+ `POST /v1/classify` (Jina classification), but it was missing from the LLM
89
+ route whitelist, so `run` treated `classify` as a provider slug and sent it
90
+ to `/apis/v1/classify` — a 404 with "api endpoint not found". The whitelist
91
+ is now pinned to the server's route table by a test that lists every
92
+ registered `/v1` segment.
93
+ - **Every `aisa skills` subcommand except `init` returned nothing.** The
94
+ registry read only the top level of a repo that nests skills two deep, so it
95
+ treated the six category directories as skills. Slugs are now derived from
96
+ `SKILL.md` locations at any depth, all 42 skills are listed, and a bare name
97
+ (`marketpulse`) resolves to its canonical slug. The repo tree is fetched once
98
+ per process and cached for an hour instead of being re-fetched per command.
99
+ - **`aisa video create` and `video status` always 404'd.** They called
100
+ `/apis/v1/services/aigc/...`, a provider that does not exist; the real
101
+ endpoints are `POST /v1/video/generations` and
102
+ `GET /v1/video/generations/:task_id`. The default model `wan2.6-t2v` also did
103
+ not exist. Polling checked for `PENDING`/`RUNNING`, which the current status
104
+ enum never returns, so `--wait` exited immediately as a failure. Task ids are
105
+ now the gateway's own `video_task_<hex>` — ids saved from 0.2.2 will report
106
+ `task not found`, since they never worked in the first place.
107
+ - **`aisa screener` 404'd** — the path was missing its `/screener` suffix and
108
+ used the wrong method — and it sent an empty filter set, which the upstream
109
+ rejects.
110
+ - **`aisa web-search` defaulted to a broken backend.** `smart` and `full` return
111
+ an upstream 404 for every parameter shape; the default is now `tavily`. The
112
+ same stale example was baked into the `skills init` search template, which
113
+ would have taught agents to call the broken endpoint.
114
+ - **`aisa crypto` returned `403 Crypto access restricted`.** It now uses the
115
+ coingecko provider, which is healthy and cheaper, with a symbol → coin-id
116
+ table; ambiguous symbols list candidates instead of guessing.
117
+ - **`aisa config set baseUrl` only affected half the requests.** Integration
118
+ calls hardcoded their base. All three bases are now derived from one root,
119
+ and `config list` shows what they resolve to. Existing configs holding the
120
+ historical `https://api.aisa.one/v1` default keep working.
121
+ - **`aisa skills install` now replaces the target directory instead of merging
122
+ into it**, so a previous skill's scripts and assets cannot linger and keep
123
+ being loaded by an agent. A partial download aborts the whole install and
124
+ leaves the existing directory untouched, rather than replacing a working
125
+ skill with an incomplete one. Installs record the canonical slug in
126
+ `.aisa-skill.json`: frontmatter `name:` is not an identity, and two skills in
127
+ different categories sharing a leaf name would otherwise overwrite each other
128
+ silently. `aisa skills remove <category>/<name>` checks that marker before
129
+ deleting, so it cannot take out a same-named skill from another category.
130
+ Naming a category means "this specific skill", so both install and remove
131
+ refuse to touch a directory whose ownership they cannot verify — including
132
+ ones installed before markers existed; `--force` overrides. A bare name still
133
+ works unguarded, since it only resolves when the leaf name is unique.
134
+ - Binary files in a skill (images, fonts) are no longer corrupted on install by
135
+ a UTF-8 round trip.
136
+ - Sub-cent prices no longer display as `$0.00` — real catalog values go down to
137
+ `$0.000001`.
138
+
139
+ ### Changed
140
+
141
+ - `aisa api code` defaults to `--lang curl` (was `typescript`) and never
142
+ interpolates your real key — snippets read `AISA_API_KEY` from the
143
+ environment. The catalog reports every method as `GET` server-side, so the
144
+ generated method is advisory; use `--method` to override.
145
+ - `tests/` is no longer published to npm (the package now ships an explicit
146
+ `files` allowlist), and `npm run build` cleans `dist/` first so stale
147
+ artefacts cannot ship.
148
+
149
+ ### Known issues
150
+
151
+ - **`aisa usage` still reports that the API is unavailable.** The gateway does
152
+ not serve `GET /v1/credits/usage` — it 404s in production even though
153
+ `/v1/credits/balance` on the same route group works. The CLI side is
154
+ unblocked and will be wired up once that route ships.
155
+ - `aisa mcp setup` writes `https://docs.aisa.one/mcp`, a domain with no DNS
156
+ record, and **overwrites your agent's MCP config if it cannot parse it** —
157
+ a file with comments or a trailing comma will be emptied. This release does
158
+ not touch the MCP commands; avoid `aisa mcp setup` until it is fixed.
159
+ - `web-search --type smart` and `--type full` remain degraded upstream.
160
+
10
161
  ## [0.2.2] — 2026-08-03
11
162
 
12
163
  ### Added
@@ -66,7 +217,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66
217
  - Config commands (`aisa config get|set|list|reset`) and auth
67
218
  (`aisa login|logout|whoami`).
68
219
 
69
- [Unreleased]: https://github.com/AIsa-team/cli/compare/v0.2.2...HEAD
220
+ [Unreleased]: https://github.com/AIsa-team/cli/compare/v0.2.4...HEAD
221
+ [0.2.4]: https://github.com/AIsa-team/cli/compare/v0.2.3...v0.2.4
222
+ [0.2.3]: https://github.com/AIsa-team/cli/compare/v0.2.2...v0.2.3
70
223
  [0.2.2]: https://github.com/AIsa-team/cli/compare/v0.2.1...v0.2.2
71
224
  [0.2.1]: https://github.com/AIsa-team/cli/releases/tag/v0.2.1
72
225
  [0.2.0]: https://github.com/AIsa-team/cli/releases/tag/v0.2.0
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @aisa-one/cli
2
2
 
3
- CLI for the [AISA](https://aisa.one) unified AI infrastructure platform. Access 70+ LLMs, web search, financial data, Twitter/X, and video generation APIs — all from one command line.
3
+ Command-line access to [AIsa](https://aisa.one): **one API key for 80+ LLMs and
4
+ 950+ endpoints** across 29 API providers — finance, web search, social,
5
+ research, and video generation.
4
6
 
5
7
  ## Install
6
8
 
@@ -11,130 +13,219 @@ npm install -g @aisa-one/cli
11
13
  ## Quick Start
12
14
 
13
15
  ```bash
14
- # Authenticate
16
+ # Authenticate (or set AISA_API_KEY)
15
17
  aisa login --key sk-your-api-key
16
18
 
17
- # Chat with any LLM
19
+ # See what's available — no API key needed for this part
20
+ aisa api list
21
+ aisa api search "insider trades"
22
+
23
+ # Chat with any model
18
24
  aisa chat "Explain quantum computing" --model claude-opus-4-6
19
25
 
26
+ # Look up a stock
27
+ aisa stock AAPL
28
+
20
29
  # Search the web
21
30
  aisa web-search "latest AI research"
22
31
 
23
- # Look up stock data
24
- aisa stock AAPL
32
+ # Call any endpoint in the catalog directly
33
+ aisa run financial /insider-trades -q "ticker=AAPL"
34
+ ```
35
+
36
+ Get your API key at
37
+ [console.aisa.one/api-keys](https://console.aisa.one/api-keys). New accounts
38
+ receive $5 in free credits.
39
+
40
+ ## API Catalog
41
+
42
+ The catalog is the fastest way to find what the platform can do. It reads a
43
+ public endpoint, so `list`, `show`, `search`, and `code` all work before you log
44
+ in.
25
45
 
26
- # Post a tweet
27
- aisa tweet "Hello from AISA CLI!"
46
+ ```bash
47
+ aisa api list # all 29 providers
48
+ aisa api list --category finance # finance, search, social, productivity, other
49
+ aisa api list --health # include provider health
50
+
51
+ aisa api show financial # every endpoint in one provider
52
+ aisa api show financial /news # one endpoint: params, price, run command
53
+ aisa api show dataforseo --all # 453 endpoints (truncated to 40 by default)
54
+
55
+ aisa api search "stock screener" # search across all 950+ endpoints
56
+ aisa api search rank --provider dataforseo
28
57
 
29
- # Generate a video
30
- aisa video create "A cat playing piano" --wait
58
+ aisa api code financial /news --lang curl # curl, python, node, typescript
31
59
  ```
32
60
 
33
- Get your API key at [aisa.one/dashboard](https://aisa.one/dashboard). New accounts receive $5 in free credits.
61
+ Two things worth knowing: a provider's **id is not always its URL slug** —
62
+ `brave-search` serves `/apis/v1/brave/...`, and `api show` prints the path you
63
+ actually call. And the catalog reports every method as `GET`; pass `--method` to
64
+ `api code` when an endpoint takes a POST.
34
65
 
35
- ## Commands
66
+ The catalog is cached in `~/.aisa/cache` (override with `AISA_CACHE_DIR`). Pass
67
+ `--refresh` to any command to bypass it, or `aisa cache clear`.
36
68
 
37
- ### Authentication
69
+ ## Execute Any Endpoint
38
70
 
39
71
  ```bash
40
- aisa login --key <key> # Store API key (also reads AISA_API_KEY env var)
41
- aisa logout # Remove stored key
42
- aisa whoami # Show auth status
72
+ aisa run financial /insider-trades -q "ticker=AAPL"
73
+ aisa run coingecko /simple/price -q "ids=bitcoin&vs_currencies=usd"
74
+ aisa run brave /web/search -q "q=AI agents"
75
+ aisa run tavily /search -d '{"query": "AI news"}'
76
+ aisa run twitter /tweet/advanced_search -q "query=AI agents" --raw
77
+ aisa run dataforseo /serp/google/organic/live -d '{...}' --show-cost
43
78
  ```
44
79
 
45
- ### LLM Gateway
80
+ `run` sends anything that isn't a known LLM gateway route to the integration
81
+ APIs, so providers added to the platform work without a CLI upgrade. Use
82
+ `--llm` or `--domain` to force a base.
83
+
84
+ `--show-cost` prints the gateway's billing headers on stderr, so it stays out of
85
+ the way of `--raw | jq`. Metered providers (DataForSEO, Jina) report the amount
86
+ actually charged and the credits consumed — for those the catalog's flat
87
+ per-request price is not what you pay. Other routes report only a price key, and
88
+ the LLM gateway reports nothing; the output says so rather than implying a call
89
+ was free.
46
90
 
47
- Chat with 70+ models (GPT, Claude, Gemini, Qwen, Deepseek, Grok) through a single OpenAI-compatible endpoint.
91
+ ## LLM Gateway
92
+
93
+ 80+ models (GPT, Claude, Gemini, Qwen, Deepseek, Grok) behind one
94
+ OpenAI-compatible endpoint.
48
95
 
49
96
  ```bash
50
97
  aisa chat "your message" --model gpt-4.1-mini
51
- aisa chat "explain this" --model claude-opus-4-6 --stream
98
+ aisa chat "explain this" --model claude-opus-4-6
52
99
  aisa chat "respond in JSON" --model gemini-2.5-pro --json
53
- echo "summarize this" | aisa chat # pipe support
100
+ echo "summarize this" | aisa chat # pipe support
54
101
 
55
102
  aisa models # list all models
56
103
  aisa models --provider anthropic # filter by provider
57
104
  aisa models show gpt-4.1-mini # model details
58
105
  ```
59
106
 
60
- ### API Discovery & Execution
107
+ Streaming is on by default; pass `--no-stream` to disable it.
108
+
109
+ ## Finance
61
110
 
62
111
  ```bash
63
- aisa api list # 🚧 WIP — not yet available
64
- aisa api search "email finder" # 🚧 WIP
65
- aisa api show finance /stock/price # 🚧 WIP
66
- aisa api code finance /stock/price --lang python # 🚧 WIP
112
+ aisa stock AAPL # summary: company info + estimates + news
113
+ aisa stock AAPL --field insider # insider trades
114
+ aisa stock AAPL --field news # company news
115
+ aisa stock TSLA --field filings # SEC filings
116
+ aisa stock MSFT --field estimates # analyst EPS & revenue estimates
117
+ aisa stock AAPL --field financials # balance sheets, income statements
67
118
 
68
- # Execute any API (works now)
69
- aisa run financial /insider-trades -q "ticker=AAPL"
70
- aisa run tavily /search -d '{"query": "AI news"}'
71
- aisa run twitter /tweet/advanced_search -q "query=AI agents" --raw
119
+ aisa crypto BTC # price, 24h change, market cap
120
+ aisa crypto ETH --period 30d # historical
121
+ aisa crypto --id render-token RNDR # exact CoinGecko id when a symbol is ambiguous
122
+
123
+ aisa screener --sector "Information Technology"
124
+ aisa screener --min-market-cap 1000000000000 --limit 10
125
+ aisa screener --filter market_cap:gt:1e12 --filter sector:eq:Financials
72
126
  ```
73
127
 
74
- ### Web Search
128
+ Sectors use GICS names; short forms like `Technology` are mapped automatically.
129
+
130
+ ## Web Search
75
131
 
76
132
  ```bash
77
- aisa web-search "query" # smart search (default)
78
- aisa web-search "query" --type full # full-text search
133
+ aisa web-search "query" # Tavily (default)
79
134
  aisa web-search "query" --type youtube # YouTube search
80
- aisa web-search "query" --type tavily # Tavily deep search
81
135
  aisa scholar "transformer architecture" # academic papers
82
136
  ```
83
137
 
84
- ### Finance
85
-
86
- ```bash
87
- aisa stock AAPL # summary: company info + estimates + news
88
- aisa stock AAPL --field insider # insider trades
89
- aisa stock AAPL --field news # company news
90
- aisa stock TSLA --field filings # SEC filings
91
- aisa stock MSFT --field estimates # analyst EPS & revenue estimates
92
- aisa stock AAPL --field financials # balance sheets, income statements
93
- aisa crypto BTC # crypto price snapshot
94
- aisa crypto ETH --period 30d # historical
95
- aisa screener --sector Technology # stock screener
96
- ```
138
+ `--type smart` and `--type full` are currently degraded upstream and return 404
139
+ regardless of parameters. Use `tavily` until that is resolved.
97
140
 
98
- ### Twitter/X
141
+ ## Twitter/X
99
142
 
100
143
  ```bash
101
144
  aisa twitter user elonmusk # user profile
102
145
  aisa twitter search "AI agents" --limit 20 # search tweets
103
146
  aisa twitter trends # trending topics
104
- aisa tweet "Hello world!" # post (⚠️ requires login cookies, see docs)
147
+ aisa twitter user-tweets elonmusk # recent tweets
148
+ aisa twitter thread <tweet-id> # full conversation
105
149
  ```
106
150
 
107
- ### Video Generation
151
+ Read operations work with just your API key. **Write operations** (`aisa tweet`,
152
+ `like`, `retweet`, `follow`, `dm`) additionally require Twitter login cookies
153
+ and a proxy — run `aisa twitter login --username <u> --password <p> --proxy <url>`
154
+ first. Run `aisa twitter --help` for the full list of 30+ subcommands.
155
+
156
+ ## Video Generation
108
157
 
109
158
  ```bash
110
- aisa video create "A sunset timelapse" # create task
111
- aisa video create "Dancing robot" --wait # wait for result
112
- aisa video status <task-id> # check status
159
+ aisa video create "A sunset timelapse" # returns a task id
160
+ aisa video create "Dancing robot" --wait # poll until done
161
+ aisa video create "A cat" --output cat.mp4 # wait and download
162
+ aisa video status <task-id>
163
+
164
+ # image-to-video: --image is shorthand for --media first_frame=<url>
165
+ aisa video create "the bird turns its head" --model wan2.7-i2v --image https://…/photo.jpg
166
+ aisa video create "extend this clip" --model wan2.7-r2v --media first_clip=https://…/in.mp4
167
+
168
+ # Seedance uses a different request shape; the CLI handles it
169
+ aisa video create "a cat walking" --model dreamina-seedance-2-0-fast-260128
113
170
  ```
114
171
 
115
- ### Account
172
+ | Model | Needs | Billing |
173
+ |-------|-------|---------|
174
+ | `wan2.7-t2v` (default), `happyhorse-1.1-t2v` | prompt only | per second |
175
+ | `wan2.7-i2v`, `happyhorse-1.1-i2v` | `--image` / `--media first_frame=` | per second |
176
+ | `wan2.7-r2v`, `happyhorse-1.1-r2v` | `--media first_clip=` | per second |
177
+ | `dreamina-seedance-2-0-260128`, `…-fast-260128` | prompt only | per token |
178
+
179
+ Media types: `first_frame`, `last_frame`, `driving_audio`, `first_clip`.
180
+
181
+ The gateway forwards the request body to whichever vendor owns the model, so the
182
+ shape differs per family — the CLI builds it for you and refuses up front if a
183
+ model needs source media you did not supply (the upstream would otherwise accept
184
+ the job, bill it, and fail a minute later). For a vendor or parameter the CLI
185
+ does not model, `--body '<json>'` is sent verbatim.
186
+
187
+ ## Account
116
188
 
117
189
  ```bash
118
- aisa balance # Show wallet and API key credit balance
119
- aisa balance --json # Output the balance response as JSON
120
- aisa usage --limit 20 # 🚧 WIP
190
+ aisa balance # wallet and API key credit balance
191
+ aisa balance --json
121
192
  ```
122
193
 
123
- ## Skills
194
+ `aisa usage` is not available yet — the gateway does not serve
195
+ `GET /v1/credits/usage` (it 404s, while `/v1/credits/balance` on the same route
196
+ group works). Use the [console](https://console.aisa.one/logs) for usage history
197
+ in the meantime.
124
198
 
125
- Skills are markdown files that teach AI coding agents (Claude Code, Cursor, Copilot, etc.) how to use AISA APIs. Skills are sourced from the [agent-skills](https://github.com/AIsa-team/agent-skills) repository.
199
+ ## Skills
126
200
 
127
- ### Browse & Install
201
+ Skills are markdown files that teach AI coding agents (Claude Code, Cursor,
202
+ Copilot, …) how to use AIsa APIs. They come from the
203
+ [agent-skills](https://github.com/AIsa-team/agent-skills) repository — 42 skills
204
+ across six categories.
128
205
 
129
206
  ```bash
130
- aisa skills list # list all available skills
131
- aisa skills search "financial analysis" # search by keyword
132
- aisa skills show marketpulse # show skill details
133
- aisa skills install marketpulse # install to agent directories
134
- aisa skills remove marketpulse # uninstall
207
+ aisa skills list # all skills
208
+ aisa skills list --category financial # one category
209
+ aisa skills search "financial analysis"
210
+ aisa skills show marketpulse # bare name or financial/marketpulse
211
+ aisa skills install marketpulse # install to detected agent directories
212
+ aisa skills install marketpulse --force # replace whatever occupies that directory
213
+ aisa skills remove marketpulse
135
214
  ```
136
215
 
137
- Skills install to agent directories automatically:
216
+ Installing replaces the target directory rather than merging into it, so a
217
+ previous skill's scripts and assets cannot linger and keep being loaded, and a
218
+ partial download aborts without touching what is already there. Each install
219
+ writes a small `.aisa-skill.json` recording which skill owns the directory —
220
+ that marker is what lets the CLI tell two same-named skills apart.
221
+
222
+ Naming a category (`financial/marketpulse`) means "this specific skill", so the
223
+ CLI checks the marker before replacing or removing anything. A directory
224
+ installed before markers existed cannot be verified that way, so those need
225
+ `--force`. A bare name (`marketpulse`) means "whatever holds that directory" and
226
+ always works — it only resolves when the leaf name is unique across the repo.
227
+
228
+ Skills install to whichever agent directories exist on your machine:
138
229
 
139
230
  | Agent | Directory |
140
231
  |-------|-----------|
@@ -149,45 +240,80 @@ Skills install to agent directories automatically:
149
240
  ### Create Skills
150
241
 
151
242
  ```bash
152
- aisa skills init my-skill # create from default template
153
- aisa skills init my-skill --template finance # finance template
154
- aisa skills init my-skill --template llm # LLM template
243
+ aisa skills init my-skill # default template
244
+ aisa skills init my-skill --template finance # finance, llm, search, twitter, video
155
245
  ```
156
246
 
157
- Available templates: `default`, `llm`, `search`, `finance`, `twitter`, `video`
158
-
159
- To publish a skill, submit a pull request to [AIsa-team/agent-skills](https://github.com/AIsa-team/agent-skills).
247
+ To publish a skill, open a pull request against
248
+ [AIsa-team/agent-skills](https://github.com/AIsa-team/agent-skills).
160
249
 
161
250
  ## MCP Server
162
251
 
163
- Auto-configure AISA's MCP server for your AI agents:
164
-
165
252
  ```bash
166
- aisa mcp setup # configure all detected agents
167
- aisa mcp setup --agent cursor # Cursor only
168
- aisa mcp setup --agent claude-desktop # Claude Desktop only
253
+ aisa mcp setup # configure detected agents
169
254
  aisa mcp status # check configuration
170
255
  ```
171
256
 
257
+ > **Not currently usable.** These commands write
258
+ > `https://docs.aisa.one/mcp`, which has no DNS record, and `mcp setup`
259
+ > overwrites an agent config file it cannot parse — a `mcp.json` with comments
260
+ > or a trailing comma will be emptied. Avoid `aisa mcp setup` until this is
261
+ > fixed.
262
+
263
+ ## Shell Completion
264
+
265
+ ```bash
266
+ # zsh
267
+ aisa completion zsh > "${fpath[1]}/_aisa" # then restart your shell
268
+ # or, without touching fpath:
269
+ echo 'eval "$(aisa completion zsh)"' >> ~/.zshrc
270
+
271
+ # bash
272
+ aisa completion bash > /usr/local/etc/bash_completion.d/aisa
273
+ # or:
274
+ echo 'eval "$(aisa completion bash)"' >> ~/.bashrc
275
+
276
+ # fish
277
+ aisa completion fish > ~/.config/fish/completions/aisa.fish
278
+ ```
279
+
280
+ `aisa completion` with no argument detects your shell from `$SHELL`.
281
+
282
+ Completion covers commands, subcommands, and options, plus values pulled from
283
+ the local cache:
284
+
285
+ ```
286
+ aisa run <TAB> → 29 provider slugs
287
+ aisa run financial <TAB> → that provider's endpoints
288
+ aisa api show <TAB> → provider ids
289
+ aisa skills show <TAB> → 42 skill names
290
+ aisa chat --model <TAB> → model ids
291
+ aisa web-search --type <TAB> → tavily, youtube, scholar, …
292
+ ```
293
+
294
+ The cache-backed suggestions only appear once the relevant command has been run
295
+ at least once — completion never makes a network request, so a cold cache
296
+ completes commands and flags but no dynamic values. Run `aisa api list`,
297
+ `aisa models`, and `aisa skills list` once to warm everything up.
298
+
172
299
  ## Configuration
173
300
 
174
301
  ```bash
175
- aisa config set defaultModel claude-opus-4-6 # change default model
176
- aisa config get defaultModel # read a value
177
- aisa config list # show all settings
178
- aisa config reset # reset to defaults
302
+ aisa config set defaultModel claude-opus-4-6
303
+ aisa config get defaultModel
304
+ aisa config list # also shows derived base URLs
305
+ aisa config reset
179
306
  ```
180
307
 
181
308
  Settings:
182
309
  - `defaultModel` — default model for `aisa chat` (default: `gpt-4.1-mini`)
183
- - `baseUrl` — API base URL (default: `https://api.aisa.one`)
184
- - `outputFormat` — output format: `text` or `json`
185
-
186
- Environment variable `AISA_API_KEY` takes precedence over stored key.
310
+ - `baseUrl` — platform root; the LLM (`/v1`), integration (`/apis/v1`), and
311
+ catalog bases are all derived from it
312
+ - `outputFormat` — `text` or `json`
187
313
 
188
- ## Known Issues
189
-
190
- **GPT-4.1 streaming returns empty output.** The AISA gateway currently strips `choices[].delta.content` from GPT model SSE chunks, so streaming mode produces blank output for GPT models. Workaround: use `--no-stream` or switch to Claude/Qwen models which stream correctly. Non-streaming GPT works fine.
314
+ Environment variables: `AISA_API_KEY` takes precedence over the stored key.
315
+ `AISA_CACHE_DIR` relocates the cache. `GITHUB_TOKEN` raises the GitHub rate
316
+ limit for skills commands.
191
317
 
192
318
  ## Development
193
319
 
@@ -200,23 +326,44 @@ npm run dev # watch mode
200
326
  npm test # run tests
201
327
  ```
202
328
 
203
- ## Appendix: Architecture Notes for Contributors
204
-
205
- **Two base URLs.** The AISA platform uses separate base paths:
206
- - LLM endpoints (chat, models): `https://api.aisa.one/v1/`
207
- - Domain API endpoints (search, finance, twitter, video): `https://api.aisa.one/apis/v1/`
208
-
209
- The `domain: true` option in `RequestOptions` (see `src/api.ts`) selects which base URL to use. The `run` command auto-detects based on the slug prefix.
210
-
211
- **Parameter naming varies by endpoint.** Smart/full search uses `q`, scholar uses `query`, finance uses `ticker` (not `symbol`), Twitter uses `userName` (camelCase). Always check the [API Reference](https://docs.aisa.one/reference) for exact parameter names.
212
-
213
- **Video generation is async.** POST to `/services/aigc/video-generation/video-synthesis` with header `X-DashScope-Async: enable`, then poll `GET /services/aigc/tasks?task_id=<id>` for status. Response shape uses `output.task_id`, `output.task_status`, `output.video_url`.
214
-
215
- **Twitter write operations require login cookies.** `create_tweet_v2` and other action endpoints need `login_cookies` and `proxy` fields — they don't work with just the API key.
216
-
217
- **Models API follows OpenAI format.** The `/v1/models` endpoint returns `owned_by` (not `provider`) and has no `name`, `pricing`, or `contextWindow` fields.
218
-
219
- **Some financial endpoints return empty data.** `financial/prices` and `financial/financial-metrics/snapshot` return `{}` for all tickers (backend issue). The default `aisa stock` now fetches `company/facts` + `analyst-estimates` + `news` instead. Working fields: `info`, `estimates`, `financials`, `filings`, `insider`, `institutional`, `news`.
329
+ ## Appendix: Notes for Contributors
330
+
331
+ **Three bases, one root.** `resolveBases()` in `src/api.ts` derives the LLM base
332
+ (`/v1`), the integration base (`/apis/v1`), and the catalog root from a single
333
+ configured `baseUrl`. It tolerates a value with either suffix already attached,
334
+ because the shipped default has always included `/v1` and is persisted in every
335
+ existing user's config.
336
+
337
+ **Routing in `run`.** `resolveRunTarget()` (`src/commands/run.ts`) treats the LLM
338
+ gateway routes as the whitelist and everything else as an integration API. That
339
+ direction matters: gateway routes are hardcoded server-side and change roughly
340
+ annually, while provider slugs are database rows that operations edit
341
+ continuously.
342
+
343
+ **The catalog's shape has three traps.** `endpoints[].method` is hardcoded to
344
+ `GET` server-side. `endpoint_groups[].name` is an operator-entered label
345
+ (`Zero`, `One`, `default`) with no business meaning, which is why `api show`
346
+ flattens by default. And health is tracked per provider, not per endpoint, so
347
+ per-endpoint counts are one value repeated.
348
+
349
+ **Parameter naming varies by endpoint.** Scholar uses `query`, finance uses
350
+ `ticker` (not `symbol`), Twitter uses `userName`. `aisa api show <api> <path>`
351
+ prints each endpoint's description and path parameters.
352
+
353
+ **Video generation is async.** `POST /v1/video/generations` returns `202` with a
354
+ gateway-local `video_task_<hex>` id. Poll `GET /v1/video/generations/:id` until
355
+ `status` is one of `completed`, `failed`, or `cancelled`. The finished URL sits
356
+ at a different place in `result` for each vendor, so `findVideoUrl()` searches
357
+ for it.
358
+
359
+ **Twitter write operations require login cookies.** `create_tweet_v2` and the
360
+ other action endpoints need `login_cookies` and `proxy` in the body — the
361
+ gateway does not hold your Twitter session.
362
+
363
+ **Some financial endpoints return empty data.** `financial/prices` and
364
+ `financial/financial-metrics/snapshot` return `{}` for all tickers. `aisa stock`
365
+ uses `company/facts` + `analyst-estimates` + `news` instead. Working fields:
366
+ `info`, `estimates`, `financials`, `filings`, `insider`, `institutional`, `news`.
220
367
 
221
368
  ## License
222
369