kagi assistant
Prompt Kagi Assistant and continue existing conversation threads. Access AI-powered assistance directly from your terminal.

Synopsis
Description
Thekagi assistant command provides programmatic access to Kagi’s AI Assistant feature. Send prompts, receive responses, and continue multi-turn conversations via thread continuation.
This command is ideal for:
- Quick questions without opening a browser
- Building conversational workflows
- Integrating AI assistance into scripts
- Continuing previous conversations
Authentication
Required:KAGI_SESSION_TOKEN
The Assistant feature requires a Kagi subscription and session token authentication.
Arguments
<QUERY> (Required)
The prompt or question to send to the Assistant.
Example:
Options
--thread-id <THREAD_ID>
Continue an existing conversation thread.
Type: String
Source: Previous Assistant response
Example:
Output Format
Fields
| Field | Type | Description |
|---|---|---|
meta | object | Stream metadata such as version and trace id |
thread | object | Thread metadata for continuation |
message | object | The assistant reply payload |
Examples
Basic Queries
Conversation Chains
Processing Output
Building Tools
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success - response received |
| 1 | Error - see stderr |
- Missing session token
- Invalid thread ID
- Rate limiting
- Network error
Thread Management
Starting New Threads
Eachkagi assistant call without --thread-id starts a new conversation:
Continuing Threads
Save thethread.id from responses to continue:
Thread Persistence
- Threads persist across CLI sessions
- Threads are associated with your Kagi account
- You can continue threads from the web interface
- Thread IDs are alphanumeric strings
Best Practices
Clear Prompts
Context Management
Error Handling
Limitations
- Requires active Kagi subscription
- Subject to rate limits
- Thread availability may vary
- Response length may be limited
See Also
- fastgpt - Quick answers via API
- Authentication - Token setup
- Workflows - AI integration patterns