LLM Core Service
Central orchestration service for the Jeen AI platform. Manages conversations, agents, model/provider catalog, canvas, templates, text conversions, and LLM usage tracking.
- Tech: NestJS 11, TypeORM, PostgreSQL, RabbitMQ (consumer), Redis
- Port: 4000
- Auth: JWT (RS256), API Key
- Database: llm-core DB (18 tables)
Conversation Endpoints
The main user-facing API for AI chat.
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/v1/conversation | JWT, API Key | Send a message -- returns streaming SSE or JSON response. This is the primary endpoint for AI chat. |
| GET | /api/v1/conversation/chat-history | JWT | Paginated chat history for the current user |
| GET | /api/v1/conversation/search | JWT | Search conversations by query, tags, sorting, pagination |
| GET | /api/v1/conversation/multiple?ids= | Public | Get full conversations by multiple IDs |
| GET | /api/v1/conversation/:conversationId | JWT | Get a single conversation with all messages |
| PATCH | /api/v1/conversation/:conversationId | JWT | Update conversation (title, etc.) |
| DELETE | /api/v1/conversation/:conversationId | JWT | Soft-delete a conversation |
| GET | /api/v1/conversation/message-reaction/:messageId | JWT | Get reaction for a message |
| POST | /api/v1/conversation/message-reaction/:messageId | JWT | Set like/dislike on a message |
POST /api/v1/conversation
This is the main entry point for AI chat. It accepts a user message, resolves the agent and model, calls the completion service (or agent service if tools are involved), and returns the response.
Streaming (default): Returns an SSE stream with chunks as they are generated.
Non-streaming: Returns a full JSON response after completion.
The service handles:
- Conversation creation (first message) or continuation (subsequent messages)
- File attachments (images, documents)
- Agent instructions injection
- Tool/function calling delegation to agent-service
- Canvas operations
- Langflow workflow execution
Agent Endpoints
Manage AI agent configurations.
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/v1/agent | JWT | Create an agent |
| GET | /api/v1/agent | JWT | List user's agents (paginated) |
| GET | /api/v1/agent/multiple?ids= | JWT | Get agents by multiple IDs |
| GET | /api/v1/agent/tree | JWT | Get agent folder tree |
| GET | /api/v1/agent/organization | JWT | List organization-wide agents |
| GET | /api/v1/agent/:id | JWT | Get agent by ID |
| GET | /api/v1/agent/:id/files | JWT | Get agent's associated files |
| PUT | /api/v1/agent/:id | JWT | Full update |
| PATCH | /api/v1/agent/:id | JWT | Partial update |
| DELETE | /api/v1/agent/:id | JWT | Delete |
| DELETE | /api/v1/agent/bulk | JWT | Bulk delete |
| PUT | /api/v1/agent/bulk | JWT | Bulk update |
| PATCH | /api/v1/agent/bulk | JWT | Bulk patch |
Agent types: simple, cortex, workflow, system, organization.
Model and Provider Endpoints
Manage the catalog of available LLM models and providers.
Models
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/v1/models | JWT | Create a model definition |
| GET | /api/v1/models | JWT | List enabled models |
| GET | /api/v1/models/all | JWT | List all models including disabled |
| GET | /api/v1/models/completion | JWT | List completion models |
| GET | /api/v1/models/embedding | JWT | List embedding models |
| GET | /api/v1/models/:id | JWT | Get model by ID |
| PATCH | /api/v1/models/:id | JWT | Update |
| DELETE | /api/v1/models/:id | JWT | Delete |
Providers
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/v1/model-providers | JWT | Create a provider |
| GET | /api/v1/model-providers | JWT | List enabled providers |
| GET | /api/v1/model-providers/all | JWT | List all including disabled |
| GET | /api/v1/model-providers/:name | JWT | Get provider by name |
| GET | /api/v1/model-providers/:name/config-schema | JWT | Get provider config schema |
| PATCH | /api/v1/model-providers/:name | JWT | Update |
| DELETE | /api/v1/model-providers/:name | JWT | Delete |
Available Models (model + provider combinations)
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/v1/available-models | JWT | Create an available model entry |
| GET | /api/v1/available-models | JWT | List enabled |
| GET | /api/v1/available-models/all | JWT | List all |
| GET | /api/v1/available-models/selections | JWT | Get selections |
| GET | /api/v1/available-models/selections/completion | JWT | Completion model selections |
| GET | /api/v1/available-models/selections/embedding | JWT | Embedding model selections |
| POST | /api/v1/available-models/validate | JWT | Validate model IDs |
| POST | /api/v1/available-models/by-ids | JWT | Get by IDs |
| GET | /api/v1/available-models/:id | JWT | Get by ID |
| GET | /api/v1/available-models/provider/:providerId | JWT | Get by provider |
| GET | /api/v1/available-models/model/:modelId | JWT | Get by model |
| PATCH | /api/v1/available-models/:id | JWT | Update |
| DELETE | /api/v1/available-models/:id | JWT | Delete |
Canvas Endpoints
Interactive editable content areas within conversations.
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/v1/canvas/:canvasId | JWT | Get canvas with current version |
| POST | /api/v1/canvas/:canvasId/versions | JWT | Create a new version |
| GET | /api/v1/canvas/:canvasId/export?fileType= | JWT | Export canvas to file (streamable) |
Template Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/v1/templates | JWT | List all templates (paginated) |
| GET | /api/v1/templates/enabled | JWT | List enabled templates |
| GET | /api/v1/templates/:id | JWT | Get by ID |
| POST | /api/v1/templates/by-ids | JWT | Get by IDs |
Conversion Endpoints
Text transformations (grammar, translation, summarization).
| Method | Path | Auth | Description |
|---|---|---|---|
| POST | /api/v1/conversion | JWT | Create a conversion |
| GET | /api/v1/conversion | JWT | List user's conversions |
| PATCH | /api/v1/conversion/:id | JWT | Update |
| DELETE | /api/v1/conversion/bulk | JWT | Bulk delete |
Services Config
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/v1/services-config/models-providers | Public | Get model/provider configuration (consumed by completion-service) |
| GET | /api/v1/services-config/mcp-servers | Public | Get MCP server configuration |
RabbitMQ Consumer
| Pattern | Description |
|---|---|
transaction | Receives token usage events from completion-service. Stores in model_transactions table. |
Inter-Service Communication
| Target | Protocol | Purpose |
|---|---|---|
| completion-service | HTTP | POST /api/v1/completions -- LLM completions |
| agent-service | HTTP | POST /api/v1/agent/run -- Agent execution |
| document-service | HTTP | Document metadata, content, folders, exports |
| user-service | HTTP | Pins, tags, favorites, sharing, user info |
| Langflow | HTTP | Run workflows, upload files |
| RabbitMQ | AMQP | Consume transaction events |