Quickstart Guide
This guide follows a progressive disclosure approach: you’ll start with commands that work immediately without any setup, then gradually unlock more powerful features as you configure authentication. By the end, you’ll have a fully functional kagi CLI setup tailored to your needs.Progression Overview
Step 1: Unauthenticated Commands (30 seconds)
The fastest way to verify kagi is working is to run commands that don’t require authentication. These use Kagi’s public endpoints.Test 1: Kagi News

Test 2: Small Web Feed
What These Commands Prove
- ✅ Binary is installed and in PATH
- ✅ Network connectivity to Kagi works
- ✅ CLI can parse and output JSON
- ✅ You can run kagi successfully
Step 2: Verify Installation (1 minute)
Before moving to authenticated commands, let’s verify the installation details:kagi auth status will likely show:
Step 3: Subscriber Setup with Session Token
To unlock subscriber-only features (lens search, Assistant, subscriber Summarizer), you need a Kagi Session Token.Getting Your Session Token
- Log into Kagi in your web browser
- Go to Settings → Account Settings
- Find “Session Link” in the API section
- Copy the full URL (looks like
https://kagi.com/search?token=abc123...)
Option A: Environment Variable (Quick Testing)
For immediate testing without saving to disk:Option B: Persistent Configuration (Recommended)
Save the token to a config file:./.kagi.toml with your token. The CLI accepts either:
- The full Session Link URL (recommended)
- Just the raw token value
Testing Subscriber Features
Now that you’re authenticated, test the subscriber commands:


Step 4: Paid API Setup with API Token (Optional)
If you have Kagi API access (separate from your subscription), you can add an API token for additional commands.Getting Your API Token
- Log into Kagi in your web browser
- Go to Settings → API Settings
- Generate a new API token if you don’t have one
- Copy the token (looks like a long alphanumeric string)
Setting Up the API Token
Option A: Environment VariableTesting Paid API Commands
Understanding Dual Token Setup
When you have both tokens configured:- Session Token: Enables lens search, Assistant, subscriber Summarizer
- API Token: Enables FastGPT, public Summarizer, Enrichment APIs
- Base Search: Prefers API token, falls back to session token if needed
Step 5: Persistent Configuration
Now that you’ve tested everything, let’s create a robust configuration.The .kagi.toml File
Kagi uses a TOML configuration file located at./.kagi.toml.
Basic configuration:
Configuration Precedence
Kagi resolves credentials in this order (first match wins):- Environment variables (
KAGI_API_TOKEN,KAGI_SESSION_TOKEN) - Config file (
./.kagi.toml)
Shell Profile Integration
For convenience, add environment variables to your shell profile: Bash (~/.bashrc):Security Best Practices
- File permissions: Set
./.kagi.tomlto 600 (readable only by you) - Environment variables: Don’t commit these to version control
- Token rotation: Regenerate tokens periodically
- Separate contexts: Use different tokens for different environments (dev/staging/prod)
Step 6: First Real Workflows
Now let’s put it all together with practical workflows.Workflow 1: Daily News Briefing
Workflow 2: Research Assistant
Workflow 3: Content Pipeline
Workflow 4: Development Research
Common First Commands Reference
Here’s a quick reference of useful commands organized by category:Information Commands
Search Commands
Content Commands
Feed Commands
What You’ve Learned
By completing this quickstart, you now understand:- ✅ How to verify installation works
- ✅ The difference between session and API tokens
- ✅ How to configure credentials (env vars and config file)
- ✅ Basic search and content commands
- ✅ How to combine commands in workflows
- ✅ Where to find help and documentation
Next Steps
Continue your kagi journey:- Authentication Deep Dive - Understand the complete auth system
- Common Workflows - More real-world patterns
- Command Reference - Complete command documentation
- Advanced Usage - Scripting and automation
Troubleshooting Quick Reference
| Problem | Solution |
|---|---|
| ”command not found” | Check PATH, reload shell |
| ”missing credentials” | Set KAGI_SESSION_TOKEN or KAGI_API_TOKEN |
| ”auth check failed” | Verify token is valid and not expired |
| Empty search results | Try different query or check rate limits |
| JSON parse errors | Verify kagi version, check for CLI updates |
Congratulations! You’re now ready to use kagi CLI effectively. Happy searching!