12 releases
Uses new Rust 2024
| 0.1.11 | Mar 19, 2026 |
|---|---|
| 0.1.10 | Mar 15, 2026 |
#2216 in Authentication
59 downloads per month
235KB
6K
SLoC
apix
apix is a local-first Rust CLI for API discovery and execution, designed for both AI agents and human developers.
It converts monolithic OpenAPI 3.0/3.1 specs into a file-system-native markdown vault, so API docs can be explored directly from the terminal without scraping web UIs or loading huge JSON blobs into context.
apix follows a progressive disclosure workflow:
searchandlsto discover APIs and routes with low token costpeekfor condensed required inputsshowfor full endpoint/type docs only when neededcallto execute requests directly from route metadata
Vaults are plain markdown files on disk (with YAML frontmatter), so they work well with standard shell tools (ls, cat, grep) and remain usable offline after pull/import.
Features
- Import vaults from OpenAPI 3.0/3.1 specs (
apix import) - Browse endpoint/type docs (
apix show,apix peek) - Search local vault content (
apix grep) - Execute HTTP calls from vault frontmatter (
apix call) - Sync registry + namespaces with sparse-checkout (
apix update,apix pull) - Shell completions (
apix completions) - Auto-initializes
~/.apixon first use
Install
curl | sh
Install script is maintained in the web repo.
Latest:
curl -fsSL https://apix.sh/install | sh
Pinned version:
curl -fsSL https://apix.sh/install | sh -s -- --version v0.1.0
Custom install directory:
curl -fsSL https://apix.sh/install | sh -s -- --bin-dir "$HOME/.local/bin"
Homebrew
brew tap apix-sh/tap
brew install apix
Explicit form:
brew install apix-sh/tap/apix
Build from source
Prerequisites:
- Rust toolchain (
rustup,cargo,rustc)
Build:
cargo build --release
Binary path:
./target/release/apix
Verify install
apix --version
apix --help
Quick Start
# Show help
cargo run -- --help
# Initialize config/home explicitly (optional)
cargo run -- init
# Import a local vault from an OpenAPI 3.0/3.1 spec
cargo run -- import tests/fixtures/petstore.json --name petstore
# Import directly into a vault repo worktree
cargo run -- import tests/fixtures/petstore.json --name petstore --output /path/to/vault
# Show full route markdown
cargo run -- show petstore/v1/pets/GET
# Show condensed view (frontmatter + required request fields)
cargo run -- peek petstore/v1/pets/{petId}/GET
# Full-text grep within a namespace
cargo run -- grep petstore pet --limit 20 --source .local
# Indexed search across sources
cargo run -- search pet
# List local inventory
cargo run -- ls
cargo run -- ls --source .local
cargo run -- ls petstore
# List detailed routes for a namespace/version
cargo run -- ls petstore/v1
cargo run -- ls petstore/v1 --source core
# Filter routes by path prefix
cargo run -- ls petstore/v1/pet
cargo run -- ls petstore/v1/store/order
Command Reference
apix search <query> [--source <name>] [--all-sources] [--no-auto-update]: Search indexed APIsapix update [--source <name>] [--all-sources]: Clone/pull source registry metadataapix pull <namespace>[/<version>] [--source <name>]: Sparse-checkout a namespace (or specific version) from a source (default:core)apix import <source> --name <namespace> [--output <vault_root>] [--overwrite]: Generate vault files from an OpenAPI 3.0/3.1 JSON or YAML specapix ls [namespace|namespace/version[/path...]] [--source <name>]: List local inventory or detailed routesapix info <namespace/version> [--source <name>]: Print API metadata from frontmatterapix show <route> [--source <name>]: Print full markdown for a route/type fileapix peek <route> [--source <name>]: Print frontmatter + condensed required input infoapix grep <namespace> <query> [--limit N] [--source <name>]: Search local markdown filesapix call <route> ... [--source <name>]: Execute HTTP request resolved from route frontmatterapix completions <bash|zsh|fish|elvish|powershell>: Generate shell completionsapix init: Create~/.apixstructure and default configapix source add/remove/list: Manage third-party sourcesapix registry rebuild [--source <name>] [--path <vault_root>]: Rebuild registry index from a source root or vault repo path
Route Format
Route strings are slash-separated.
Short form:
<namespace>/<version>/<path segments>/<METHOD>
Explicit source form:
<source>/<namespace>/<version>/<path segments>/<METHOD>
Example:
petstore/v1/pets/{petId}/GET
core/petstore/v1/pets/{petId}/GET
apix call Examples
# Route with literal path segment auto-mapped to {id}
cargo run -- call demo/v1/items/item_123/GET
# Explicit path/query/header/body flags
cargo run -- call demo/v1/items/{id}/POST \
-p id=item_123 \
-q expand=full \
-H "Authorization: Bearer <token>" \
-d '{"name":"item"}'
# Body from stdin
echo '{"name":"item"}' | cargo run -- call demo/v1/items/{id}/POST -p id=item_123 -d @-
# Body from file
cargo run -- call demo/v1/items/{id}/POST -p id=item_123 -d @payload.json
Configuration
Default home directory:
~/.apix- override with
APIX_HOME
Default registry remote:
https://github.com/apix-sh/vault.git- override with
APIX_REGISTRY_URL
Auto-update controls:
auto_update = true|false(default:true)auto_update_ttl_seconds = 21600(6 hours,0disables time-based auto-update checks)APIX_AUTO_UPDATEoverridesauto_updateAPIX_AUTO_UPDATE_TTL_SECONDSoverridesauto_update_ttl_seconds
Default source priority:
.local,core- override with
APIX_SOURCES(comma-separated), e.g.APIX_SOURCES=.local,core,acme
Default config file:
color = true
pager = ""
auto_update = true
auto_update_ttl_seconds = 21600
sources = [".local", "core"]
[registry]
remote = "https://github.com/apix-sh/vault.git"
[source.acme]
remote = "https://github.com/acme/apix-vaults.git"
Source Model
- Local builds are stored at
~/.apix/vaults/.local/<namespace>/<version>/... - Core registry is stored at
~/.apix/vaults/core/<namespace>/<version>/... - Third-party sources are stored at
~/.apix/vaults/<source>/<namespace>/<version>/...
Short route resolution order follows sources config (or APIX_SOURCES).
If a short route exists in multiple sources, apix returns an ambiguity error and asks for --source or explicit source-prefixed route.
Search vs Grep
search: Indexed API discovery across sources usingregistry.json(can include not-yet-pulled APIs)grep: Full-text markdown search within one namespace/source (content-level search)ls: Local inventory and route listing from local files
ls modes:
apix ls: list namespaces grouped by sourceapix ls <namespace>: list versions for a namespace across sourcesapix ls <namespace>/<version>: list paths and methods with one-line route summariesapix ls <namespace>/<version>/<path...>: filter routes to those under the given path prefix- Route-detail mode resolves from one source only:
--sourceif provided, else first match by priority (.local->core-> third-party)
Registry lifecycle:
core/third-party sources: registry index comes from source root (registry.json) afterupdate/pull.localsource: registry index is auto-rebuilt afterimport- Manual reindex:
- local source:
apix registry rebuild --source .local - vault repo path:
apix registry rebuild --path /path/to/vault
- local source:
Vault repo spec (for --path mode and source compatibility):
Search auto-update:
searchcan auto-refresh sourceregistry.jsonbefore matching- Auto-update uses registry-only fetch; it does not update pulled namespace content
.localis excluded from auto-update and timestamp tracking- Last successful source refresh timestamp:
~/.apix/vaults/<source>/.last-updated - Skip once with
apix search ... --no-auto-update
Output Behavior
- If stdout is a TTY: markdown is rendered for humans (
termimad) - If stdout is piped: raw markdown is emitted
--rawforces raw markdown even in TTY mode--no-colororNO_COLOR=1disables color stylingshowandls <namespace>/<version>auto-page output in TTY mode usingpagerconfig /PAGER(fallback:less -FRX)--no-pagerdisables pager usage
Development
cargo fmt --all
cargo test --locked
cargo check --locked
Release Automation
Releases are automated with GitHub Actions + release-plz:
.github/workflows/release-plz.yml:- opens/updates release PRs from commits on
main - bumps
Cargo.tomlversion and changelog - publishes crate + creates GitHub release after release PR merge
- opens/updates release PRs from commits on
.github/workflows/release.yml:- builds multi-platform binaries
- uploads release tarballs and
SHA256SUMSto the published GitHub release
Recommended commit style for clean changelogs:
- Conventional Commits (
feat:,fix:,feat!:)
Dependencies
~20–37MB
~600K SLoC