aimlapi
aimlapi
Connect your coding agent to AI/ML API with one command.
npx aimlapi claude
The first run signs you in through the browser (or a device code over SSH),
creates an API key, points the agent at AI/ML API and starts it. Add
--dry-run to see what would change without touching anything, and --undo
to revert it.
Let your agent set it up
Tell your coding agent (Claude Code, Codex, OpenCode, Cline, OpenClaude, OpenClaw, Hermes Agent, zero or ZCode):
Read https://docs.aimlapi.com/quickstart/cli/aimlapi-setup.md and follow it to connect this agent to AI/ML API.
It signs you in through the browser (you approve; you never paste a key into
the chat), shows what it will change with --dry-run, applies it after you
confirm, and tells you how to undo it.
In Claude Code you can also install it as a skill and then just ask it to "set up AI/ML API":
mkdir -p ~/.claude/skills/aimlapi-setup
curl -fsSL https://raw.githubusercontent.com/aimlapi/api-docs/main/skills/aimlapi-setup/SKILL.md \
-o ~/.claude/skills/aimlapi-setup/SKILL.md
Supported agents
| Agent | Command |
|---|---|
| Claude Code | npx aimlapi claude |
| Codex | npx aimlapi codex |
| OpenCode | npx aimlapi opencode |
| Cline | npx aimlapi cline |
| OpenClaude | npx aimlapi openclaude |
| OpenClaw | npx aimlapi openclaw |
| zero | npx aimlapi zero |
| ZCode (Z.ai, GLM models) | npx aimlapi zcode |
| Hermes Agent | npx aimlapi hermes |
The agent itself must already be installed; if it is not, aimlapi prints the
install command and exits.
OpenClaw has no per-run provider switch: aimlapi openclaw writes the
AI/ML API provider and default model into its openclaw.json (a running
Gateway reloads it) and then starts openclaw. That config points at
aimlapi's credentials file instead of holding the key, so sign in with
aimlapi login (setting AIMLAPI_API_KEY alone is not enough) and run
openclaw secrets reload after signing in with a new key.
ZCode's terminal agent (zcode) has no published package yet: build it from
its repository.
aimlapi zcode --config also sets up the ZCode desktop app, which shares the
provider config with zcode (and gets its own copy when its settings keep its
data in another folder). A provider you add inside an aimlapi zcode session
is saved into aimlapi's per-session file, not ZCode's own, and is gone after
aimlapi zcode --undo or aimlapi logout: add your providers in a plain
zcode session or the desktop app.
Commands
aimlapi <agent> [--model <id>] [--config] [--dry-run] [--undo] [-- <agent args>]
aimlapi login [--device] # sign in explicitly
aimlapi logout # revoke the CLI's API key
aimlapi status # balance, key limit and usage
aimlapi models # models available for an agent
aimlapi update # update aimlapi to the latest version
aimlapi --version
For a permanent aimlapi command install it globally:
npm install -g aimlapi
aimlapi-cli is the same package under another name (npx aimlapi-cli claude,
npm install -g aimlapi-cli); it installs the same aimlapi command. Install
only one of the two globally.
Platforms
macOS and Linux on x64 and arm64. Windows (x64, arm64) is experimental.
This package is a thin Node.js launcher (Node.js >= 18). The aimlapi binary
ships in a platform-specific optional dependency (@ai-ml.api/cli-<os>-<arch>)
that npm installs automatically for your OS and CPU; there are no install
scripts. If you see "platform package is not installed", reinstall without
--omit=optional / --no-optional.
Links
- AI/ML API: https://aimlapi.com
- Changelog: CHANGELOG.md