API
Table of contents
chat.nvim provides APIs for external integration and automation.
Overview
chat.nvim offers HTTP API for external applications to interact with your chat sessions:
- HTTP Server: Built-in server for receiving messages
- Session Management: List and preview sessions via API
- External Integration: Connect scripts, CI/CD, monitoring tools
Endpoints
| Endpoint | Method | Description |
| ———– | —— | ———————————– |
| / | POST | Send message to a session |
| /sessions | GET | Get session list with details |
| /session | GET | Get HTML preview of a session |
Endpoints
| Endpoint | Method | Description |
|---|---|---|
/ |
POST | Send message to a session |
/sessions |
GET | Get list of active session IDs |
/session |
GET | Get HTML preview of a session |
Example
curl -X POST http://127.0.0.1:7777/ \
-H "X-API-Key: your-secret-key" \
-H "Content-Type: application/json" \
-d '{"session": "my-session", "content": "Hello from curl!"}'
Learn more: HTTP API
Building Applications
The HTTP API enables you to build applications on top of chat.nvim. You can create custom integrations, bots, or standalone tools that leverage AI capabilities.
Example: Nova
Nova is an AI assistant built on chat.nvim’s HTTP API. It demonstrates how to:
- Integrate with chat.nvim: Use the HTTP API to communicate with chat sessions
- Build custom UI: Create your own interface for AI interactions
- Extend functionality: Add features specific to your use case
# Example: Using Nova with chat.nvim
# Nova sends requests to chat.nvim HTTP server
curl -X POST http://127.0.0.1:7777/ \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{"session": "nova", "content": "Help me with this code"}'
Getting Started
- Enable HTTP API: Configure
api.enabled = truein your chat.nvim setup - Set API Key: Configure
api.api_keyfor authentication - Choose Port: Default is
7777, configurable viaapi.port - Build Your App: Use any HTTP client to interact with the API
See HTTP API for complete API reference.
Quick Links
- HTTP API - Complete HTTP API documentation
Next Steps
- HTTP API - HTTP API integration
- IM Integration - Messaging platforms