Skip to main content

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.

MethodPathAuthDescription
POST/api/v1/conversationJWT, API KeySend a message -- returns streaming SSE or JSON response. This is the primary endpoint for AI chat.
GET/api/v1/conversation/chat-historyJWTPaginated chat history for the current user
GET/api/v1/conversation/searchJWTSearch conversations by query, tags, sorting, pagination
GET/api/v1/conversation/multiple?ids=PublicGet full conversations by multiple IDs
GET/api/v1/conversation/:conversationIdJWTGet a single conversation with all messages
PATCH/api/v1/conversation/:conversationIdJWTUpdate conversation (title, etc.)
DELETE/api/v1/conversation/:conversationIdJWTSoft-delete a conversation
GET/api/v1/conversation/message-reaction/:messageIdJWTGet reaction for a message
POST/api/v1/conversation/message-reaction/:messageIdJWTSet 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.

MethodPathAuthDescription
POST/api/v1/agentJWTCreate an agent
GET/api/v1/agentJWTList user's agents (paginated)
GET/api/v1/agent/multiple?ids=JWTGet agents by multiple IDs
GET/api/v1/agent/treeJWTGet agent folder tree
GET/api/v1/agent/organizationJWTList organization-wide agents
GET/api/v1/agent/:idJWTGet agent by ID
GET/api/v1/agent/:id/filesJWTGet agent's associated files
PUT/api/v1/agent/:idJWTFull update
PATCH/api/v1/agent/:idJWTPartial update
DELETE/api/v1/agent/:idJWTDelete
DELETE/api/v1/agent/bulkJWTBulk delete
PUT/api/v1/agent/bulkJWTBulk update
PATCH/api/v1/agent/bulkJWTBulk patch

Agent types: simple, cortex, workflow, system, organization.

Model and Provider Endpoints

Manage the catalog of available LLM models and providers.

Models

MethodPathAuthDescription
POST/api/v1/modelsJWTCreate a model definition
GET/api/v1/modelsJWTList enabled models
GET/api/v1/models/allJWTList all models including disabled
GET/api/v1/models/completionJWTList completion models
GET/api/v1/models/embeddingJWTList embedding models
GET/api/v1/models/:idJWTGet model by ID
PATCH/api/v1/models/:idJWTUpdate
DELETE/api/v1/models/:idJWTDelete

Providers

MethodPathAuthDescription
POST/api/v1/model-providersJWTCreate a provider
GET/api/v1/model-providersJWTList enabled providers
GET/api/v1/model-providers/allJWTList all including disabled
GET/api/v1/model-providers/:nameJWTGet provider by name
GET/api/v1/model-providers/:name/config-schemaJWTGet provider config schema
PATCH/api/v1/model-providers/:nameJWTUpdate
DELETE/api/v1/model-providers/:nameJWTDelete

Available Models (model + provider combinations)

MethodPathAuthDescription
POST/api/v1/available-modelsJWTCreate an available model entry
GET/api/v1/available-modelsJWTList enabled
GET/api/v1/available-models/allJWTList all
GET/api/v1/available-models/selectionsJWTGet selections
GET/api/v1/available-models/selections/completionJWTCompletion model selections
GET/api/v1/available-models/selections/embeddingJWTEmbedding model selections
POST/api/v1/available-models/validateJWTValidate model IDs
POST/api/v1/available-models/by-idsJWTGet by IDs
GET/api/v1/available-models/:idJWTGet by ID
GET/api/v1/available-models/provider/:providerIdJWTGet by provider
GET/api/v1/available-models/model/:modelIdJWTGet by model
PATCH/api/v1/available-models/:idJWTUpdate
DELETE/api/v1/available-models/:idJWTDelete

Canvas Endpoints

Interactive editable content areas within conversations.

MethodPathAuthDescription
GET/api/v1/canvas/:canvasIdJWTGet canvas with current version
POST/api/v1/canvas/:canvasId/versionsJWTCreate a new version
GET/api/v1/canvas/:canvasId/export?fileType=JWTExport canvas to file (streamable)

Template Endpoints

MethodPathAuthDescription
GET/api/v1/templatesJWTList all templates (paginated)
GET/api/v1/templates/enabledJWTList enabled templates
GET/api/v1/templates/:idJWTGet by ID
POST/api/v1/templates/by-idsJWTGet by IDs

Conversion Endpoints

Text transformations (grammar, translation, summarization).

MethodPathAuthDescription
POST/api/v1/conversionJWTCreate a conversion
GET/api/v1/conversionJWTList user's conversions
PATCH/api/v1/conversion/:idJWTUpdate
DELETE/api/v1/conversion/bulkJWTBulk delete

Services Config

MethodPathAuthDescription
GET/api/v1/services-config/models-providersPublicGet model/provider configuration (consumed by completion-service)
GET/api/v1/services-config/mcp-serversPublicGet MCP server configuration

RabbitMQ Consumer

PatternDescription
transactionReceives token usage events from completion-service. Stores in model_transactions table.

Inter-Service Communication

TargetProtocolPurpose
completion-serviceHTTPPOST /api/v1/completions -- LLM completions
agent-serviceHTTPPOST /api/v1/agent/run -- Agent execution
document-serviceHTTPDocument metadata, content, folders, exports
user-serviceHTTPPins, tags, favorites, sharing, user info
LangflowHTTPRun workflows, upload files
RabbitMQAMQPConsume transaction events