Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (kob-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
๐ค KOB AI CLI
Command-line interface for interacting with KOB AI API. Built with Bun and TypeScript.
Developed by Kob AI โ www.kob-ai.dev | Developer in Thailand ๐น๐ญ
โจ Features
- ๐ Authentication - Verify credentials and check balance
- ๐ฌ AI Chat - Send messages and get AI responses
- ๐ Streaming - Real-time streaming AI responses
- ๐ค Models - Browse available AI models and pricing
- ๐ Projects - Create, update, list, and delete projects
- ๐ Rules - Manage project rules (forbidden, required, custom)
- ๐ฐ Credits - View credit history and transactions
- ๐จ Rich Output - Beautiful terminal output with colors and formatting
๐ Quick Start
Prerequisites
- Bun runtime installed (Install Bun)
- KOB AI API credentials (API Key)
Installation via npm (recommended)
npm install -g kob-cliInstallation from source
- Clone or navigate to the kob-cli directory:
cd kob-cli- Install dependencies:
bun install- Set up environment variables:
# Copy the example env file
cp .env.example .env
# Edit .env and add your credentials
# KOB_API_BASE_URL=https://www.kob-ai.dev
# KOB_API_KEY=kob_your_api_keyOr export them directly:
export KOB_API_KEY=kob_your_api_keyUsage
Run the CLI directly with Bun:
bun run src/index.ts <command>Or use the npm script:
bun dev <command>๐ Commands
Authentication
Verify credentials:
bun dev auth:verifyShows user information, package details, and credit balance.
Check balance:
bun dev balanceQuick check of your current credit balance.
AI Chat
Send a message:
bun dev chat "Explain quantum computing" \
--provider DeepSeek \
--model deepseek-chat \
--temperature 0.7Interactive chat mode:
bun dev chat:interactive \
--provider OpenRouter \
--model openai/gpt-4oInteractive commands:
/clear- Clear conversation history/stats- Show conversation statistics/help- Show available commands/exit- Exit chat mode
Streaming
Stream AI response:
bun dev stream "Write a poem about coding" \
--provider OpenRouter \
--model google/gemini-flash-1.5Real-time token-by-token display as AI generates response.
Models
List all models:
bun dev modelsFilter by provider:
bun dev models --provider DeepSeekJSON output:
bun dev models --format jsonProjects
List projects:
bun dev projects:listCreate project:
bun dev projects:create "My Chatbot" \
--description "AI chatbot for customer support"Update project:
bun dev projects:update <project-id> \
--name "Updated Name" \
--description "New description"Delete project:
bun dev projects:delete <project-id>Rules
List rules:
bun dev rules:list --project-id <project-id>Create rule:
bun dev rules:create \
--project-id <project-id> \
--text "Must respond in Thai only" \
--type requiredRule types:
forbidden- ๐ซ Things AI must not dorequired- โ Things AI must docustom- ๐ Custom rules
Update rule:
bun dev rules:update <rule-id> \
--project-id <project-id> \
--text "Updated rule text" \
--active falseDelete rule:
bun dev rules:delete <rule-id> --project-id <project-id>Credits
View credit history:
bun dev credits:historyWith pagination:
bun dev credits:history --limit 50 --offset 0๐ง Options
Chat & Stream Options
| Option | Description | Default |
|---|---|---|
-p, --provider |
AI provider (DeepSeek, OpenRouter, DeepInfra) | DeepSeek |
-m, --model |
Model ID | deepseek-chat |
-t, --temperature |
Temperature (0.0-2.0) | 0.7 |
--max-tokens |
Maximum tokens | 4096 |
--project-id |
Project ID for rules | - |
--system-prompt |
System prompt | - |
Common Providers and Models
DeepSeek:
deepseek-chat(DeepSeek V3)deepseek-reasoner(DeepSeek R1)deepseek-v4-prodeepseek-v4-flash
OpenRouter:
openai/gpt-4oopenai/gpt-4o-minianthropic/claude-3.5-sonnetgoogle/gemini-1.5-pro
DeepInfra:
meta-llama/Meta-Llama-3.1-8B-Instructmeta-llama/Meta-Llama-3.1-70B-InstructQwen/Qwen2.5-72B-Instruct
๐ก Examples
Complete Workflow
# 1. Verify connection
bun dev auth:verify
# 2. Check available models
bun dev models --provider DeepSeek
# 3. Create a project
bun dev projects:create "Customer Support Bot"
# 4. Add rules to project
bun dev rules:create \
--project-id <id> \
--text "Always respond in Thai" \
--type required
# 5. Chat with AI using project rules
bun dev chat "เธชเธงเธฑเธชเธเธต เธเนเธงเธขเนเธเธฐเธเธณเธชเธดเธเธเนเธฒเธซเธเนเธญเธข" \
--project-id <id>
# 6. Stream response for longer content
bun dev stream "Write a detailed guide about AI" \
--model openai/gpt-4o
# 7. Check credit usage
bun dev balance
bun dev credits:history๐ Development
Project Structure
kob-cli/
โโโ src/
โ โโโ index.ts # CLI entry point
โ โโโ commands/ # Command implementations
โ โ โโโ auth.ts # Authentication commands
โ โ โโโ chat.ts # Chat commands
โ โ โโโ stream.ts # Streaming command
โ โ โโโ models.ts # Models command
โ โ โโโ projects.ts # Project CRUD
โ โ โโโ rules.ts # Rules CRUD
โ โ โโโ credits.ts # Credit history
โ โโโ utils/ # Utility modules
โ โ โโโ api.ts # API client
โ โ โโโ config.ts # Configuration
โ โ โโโ format.ts # Output formatting
โ โ โโโ errors.ts # Error handling
โ โโโ types/ # TypeScript types
โ โโโ index.ts
โโโ .env.example # Environment variables template
โโโ package.json
โโโ README.mdAdding New Commands
- Create command file in
src/commands/ - Export the command
- Import and add to
src/index.ts
Build for Distribution
bun run buildThis creates a compiled binary kob-cli.exe.
โ Troubleshooting
Error: KOB_API_KEY environment variable is required
- Make sure you've set your environment variables
- Check that they're exported correctly or in .env file
Authentication failed
- Verify your API key is correct
- Check that your key is active on the Kob AI dashboard
Insufficient credits
- Check your balance with
bun dev balance - Top up your account at https://www.kob-ai.dev
Model not available
- List available models with
bun dev models - Verify the model ID is correct
๐ API Documentation
For detailed API documentation, see the official KOB AI API docs in the parent directory:
/my-app/docs/api-token-verify.md/my-app/docs/api-ai-chat.md/my-app/docs/api-ai-stream.md/my-app/docs/api-models.md/my-app/docs/api-projects.md/my-app/docs/api-project-rules.md/my-app/docs/api-credit-history.md
๐ License
KOB AI CLI - Non-Commercial Open Source License
Copyright (c) 2025 KOB AI Project Owner
This software is open source and free to use, modify, and distribute for non-commercial purposes only.
Commercial use is strictly prohibited without prior written permission from the owner.
For commercial licensing inquiries, please contact the project owner.
See the LICENSE file for full terms.
๐ค Support
For issues or questions, please visit https://www.kob-ai.dev or contact the Kob AI development team.