@kyma-api/cli
v1.3.0
Published
Terminal interface for 21+ AI models. Chat, code, and manage your account.
Downloads
21
Maintainers
Readme
Kyma CLI
Ψ Terminal interface for 21+ AI models. One command to chat, code, and manage your account.
Kyma is an LLM API gateway with 21+ open-source models (Qwen, DeepSeek, Llama, Gemma, Kimi, and more) at transparent pricing. This CLI brings it to your terminal—interactive chat, code agents with tool use, git diff review, and session persistence.
Quick Start
npm install -g @kyma-api/cli
kyma login
kyma "What is a Merkle tree?"Login opens your browser. Create a free account, get $0.50 starting credits.
Examples
Interactive chat:
kyma
> Ask me anything...One-shot prompt:
kyma "Optimize this SQL query for 100M rows"Code agent with tools (read, edit, search, bash):
kyma code "Add error handling to auth.ts"AI-powered git diff review:
kyma diff
kyma diff --staged
kyma diff mainPipe files into the agent:
cat src/server.ts | kyma "Refactor this for readability"Resume a conversation:
kyma history
kyma --continueModes
| Mode | Model | Cost | Best For | |------|-------|------|----------| | fast | Qwen 3-32B | ~$0.10/M | Quick answers, low latency | | cheap | Gemma 4 31B | ~$0.00/M | Free/near-free inference | | deep | Kimi K2.5 | ~$0.50/M | Complex reasoning, best quality | | auto | Kyma picks | varies | Default—best model for your task |
Set mode with -M or --mode:
kyma -M deep "Analyze this algorithm complexity"
kyma --mode cheap "Draft an email"Or use a specific model:
kyma -m deepseek-r1 "Prove this theorem"
kyma -m gemini-3-flash "Extract data from HTML"Commands
kyma [prompt] Chat (interactive or one-shot)
kyma code [task] Code agent with tool use
kyma diff [target] Review git changes with AI
kyma history List & manage past sessions
kyma models Browse available models
kyma balance Show credits and tier
kyma keys Manage API keys
kyma status Account overview
kyma config View/set defaults
kyma login Authenticate
kyma logout Clear saved credentialsConfiguration
Config is stored in ~/.kyma/config.json:
{
"api_key": "ky_xxx",
"default_mode": "auto",
"default_model": "deepseek-v3",
"base_url": "https://kymaapi.com"
}View and set config:
kyma config
kyma config default_mode deepFlags
| Flag | Purpose |
|------|---------|
| -m, --model <id> | Use a specific model (overrides mode) |
| -M, --mode <mode> | Set mode: fast, cheap, deep, auto |
| --api-key <key> | Use a specific API key |
| --continue [id] | Resume a session (use last if no ID given) |
| --staged | For diff—review only staged changes |
| --json | Machine-readable JSON output |
| --quiet | Suppress decorative output |
| --version | Show version |
| --help | Show help |
Real-Time Metrics
Every response shows token count and cost:
⚡ 1,234 tokens in 2.4s (512 cached at 90% discount)
💰 Cost: $0.024 | Saved: $0.216 with prompt cachingSessions persist in ~/.kyma/sessions/ and auto-resume where you left off.
Code Agent Tools
When you run kyma code, you get tools that the agent can use:
- read — Read file contents
- edit — Modify files
- search — Grep + glob for patterns
- bash — Execute shell commands
The agent runs in an approval-required loop: each tool use is shown before executing.
Architecture
Kyma CLI is built on 5 core equations:
- INPUT — Parse user intent, collect context
- ROUTE — Choose the right model (by mode or explicit selection)
- OUTPUT — Stream or display the response
- SETTLE — Track tokens, cost, and cache hits
- OBSERVE — Save sessions, provide metrics
Each maps to a core module. Sessions maintain message history and can be resumed.
Supported Models
21 models across 5 quality tiers:
- Tier 1 (best): Qwen 3.6, DeepSeek V3/R1, Kimi K2.5, Gemma 4, Qwen 3-Coder, Llama 3.3, MiniMax
- Tier 2 (high): Kimi K2, Gemma 4 MoE, Nemotron, Gemini 2.5 Flash, Qwen 3-Coder
- Tier 3 (fast): Llama Scout, Gemini 2.5 Flash Lite, Step 3.5, GLM 4.5
Prices vary by model. Use kyma models to see all options and current pricing.
Billing
- Free plan: $0.50 starting credits, no card required
- Pay-as-you-go: $0.00–$0.50 per million tokens (varies by model)
- Auto top-up: Set a threshold and amount, charges your saved card
Check your balance:
kyma balancePurchase credits at https://kymaapi.com/dashboard/billing or via the CLI.
Environment Variables
Optional overrides (flags take precedence):
KYMA_API_KEY="ky_xxx" # API key
KYMA_MODE="deep" # Default mode
KYMA_MODEL="deepseek-r1" # Default model
KYMA_BASE_URL="https://..." # Custom endpoint (dev/self-hosted)Scripting & Automation
For scripting, combine --json and --quiet:
kyma "Summarize this" --json --quiet | jq '.cost'Pipe stdin into prompts:
find . -name "*.ts" | kyma "Find security issues in these files"What Makes Kyma Different
- Simple routing: 21 models, no account juggling. Set a mode, we pick the best.
- Transparent pricing: See exact token count and cost on every response.
- Prompt caching: Repeated context costs 90% less (10% of input price).
- Tool use: Code agent with read/edit/search/bash for agentic workflows.
- Session persistence: Conversations saved locally, resume anytime.
- Open source: MIT licensed. Self-host if you prefer—use
KYMA_BASE_URLto point to your own server.
Docs
- Full API reference: https://docs.kymaapi.com
- Models & pricing: https://kymaapi.com/models
- Dashboard: https://kymaapi.com/dashboard
Development
Clone the repo and build:
git clone https://github.com/kyma-api/cli
cd kyma-cli
npm install
npm run build
./dist/cli.js --versionTech stack:
- Runtime: Bun (compile to Node.js)
- CLI framework: Clack (for prompts), Chalk (for colors)
- Size: 99KB minified
- Dependencies: 2 runtime (chalk, @clack/prompts)
Contributing
Contributions welcome. Start with issues marked good first issue.
License
MIT. See LICENSE.
Need Help?
- Docs: https://docs.kymaapi.com
- Status: https://kymaapi.com/status
- GitHub Issues: https://github.com/kyma-api/cli/issues
