### Get System Information (Bash) Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Retrieves current system information, including version, vector database, LLM provider, and embedding provider details. Requires an API key for authentication. ```bash curl -X GET http://localhost:3001/v1/system \ -H "Authorization: Bearer " ``` -------------------------------- ### Setup AnythingLLM Project Dependencies Source: https://github.com/mintplex-labs/anything-llm/blob/master/BARE_METAL.md Installs all necessary dependencies for running AnythingLLM in production and for debugging. This command should be run after cloning the repository. ```bash cd anything-llm yarn setup ``` -------------------------------- ### Get System Information Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Retrieves current system information, including version, providers, and models. ```APIDOC ## GET /v1/system ### Description Fetches general information about the running AnythingLLM instance. ### Method GET ### Endpoint /v1/system ### Response #### Success Response (200) - **version** (string) - The current version of AnythingLLM. - **vectorDB** (string) - The configured vector database. - **llmProvider** (string) - The configured LLM provider. - **embeddingProvider** (string) - The configured embedding provider. - **embeddingModel** (string) - The configured embedding model. #### Response Example ```json { "version": "1.9.0", "vectorDB": "lancedb", "llmProvider": "openai", "embeddingProvider": "openai", "embeddingModel": "text-embedding-3-small" } ``` ``` -------------------------------- ### Example Script to Update AnythingLLM Source: https://github.com/mintplex-labs/anything-llm/blob/master/BARE_METAL.md An example bash script to automate the process of updating AnythingLLM. It pulls the latest code, rebuilds the frontend, restarts services, and installs dependencies. ```bash #!/bin/bash cd $HOME/anything-llm &&\ git checkout . &&\ git pull origin master &&\ echo "HEAD pulled to commit $(git log -1 --pretty=format:"%h" | tail -n 1)" echo "Freezing current ENVs" curl -I "http://localhost:3001/api/env-dump" | head -n 1|cut -d$' ' -f2 echo "Rebuilding Frontend" cd $HOME/anything-llm/frontend && yarn && yarn build && cd $HOME/anything-llm echo "Copying to Server Public" rm -rf server/public cp -r frontend/dist server/public echo "Killing node processes" pkill node echo "Installing collector dependencies" cd $HOME/anything-llm/collector && yarn echo "Installing server dependencies & running migrations" cd $HOME/anything-llm/server && yarn cd $HOME/anything-llm/server && npx prisma migrate deploy --schema=./prisma/schema.prisma cd $HOME/anything-llm/server && npx prisma generate echo "Booting up services." truncate -s 0 /logs/server.log # Or any other log file location. truncate -s 0 /logs/collector.log cd $HOME/anything-llm/server (NODE_ENV=production node index.js) &> /logs/server.log & cd $HOME/anything-llm/collector (NODE_ENV=production node index.js) &> /logs/collector.log & ``` -------------------------------- ### Run Dockerized AnythingLLM on Windows Source: https://github.com/mintplex-labs/anything-llm/blob/master/docker/HOW_TO_USE_DOCKER.md Starts the AnythingLLM Docker container on Windows using PowerShell. This script ensures the storage directory and .env file exist, mounts them to the container for persistent storage, and maps the necessary ports. It's designed to handle Windows-specific path conventions. ```powershell # Run this in powershell terminal $env:STORAGE_LOCATION="$HOME\Documents\anythingllm"; ` If(!(Test-Path $env:STORAGE_LOCATION)) {New-Item $env:STORAGE_LOCATION -ItemType Directory}; ` If(!(Test-Path "$env:STORAGE_LOCATION\.env")) {New-Item "$env:STORAGE_LOCATION\.env" -ItemType File}; ` docker run -d -p 3001:3001 ` --cap-add SYS_ADMIN ` -v "$env:STORAGE_LOCATION`:/app/server/storage" ` -v "$env:STORAGE_LOCATION\.env:/app/server/.env" ` -e STORAGE_DIR="/app/server/storage" ` mintplexlabs/anythingllm; ``` -------------------------------- ### Server Environment Variables Configuration (.env.development) Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Example `.env.development` file for configuring AnythingLLM server settings. It includes variables for server port, JWT secret, LLM and embedding provider configurations (OpenAI, Ollama), vector database options (lancedb, pinecone), and authentication settings. ```bash # Server SERVER_PORT=3001 JWT_SECRET=your-secret-key-min-32-chars # LLM Provider LLM_PROVIDER=openai OPEN_AI_KEY=sk-... OPEN_MODEL_PREF=gpt-4 OPEN_AI_TEMPERATURE=0.7 # Embedding Provider EMBEDDING_ENGINE=openai EMBEDDING_MODEL_PREF=text-embedding-3-small # Vector Database VECTOR_DB=lancedb # Document Processor COLLECTOR_API=http://localhost:8888 # Optional: Use local models # LLM_PROVIDER=ollama # OLLAMA_BASE_PATH=http://localhost:11434 # OLLAMA_MODEL_PREF=llama2 # Optional: External Vector DB # VECTOR_DB=pinecone # PINECONE_API_KEY=... # PINECONE_INDEX=anythingllm # Privacy DISABLE_TELEMETRY=true # Authentication (single-user) AUTH_TOKEN=my-secure-password # Multi-user mode ``` -------------------------------- ### Install and Enable Nginx on Amazon Linux Source: https://github.com/mintplex-labs/anything-llm/blob/master/cloud-deployments/aws/cloudformation/aws_https_instructions.md Installs the Nginx web server and enables it to start automatically on boot, then starts the service. This is a prerequisite for configuring Nginx as a reverse proxy. ```bash sudo yum install nginx -y sudo systemctl enable nginx && sudo systemctl start nginx ``` -------------------------------- ### Configure AnythingLLM with Docker Compose Source: https://github.com/mintplex-labs/anything-llm/blob/master/docker/HOW_TO_USE_DOCKER.md Defines the AnythingLLM service using Docker Compose. This YAML file specifies the Docker image, container name, port mappings, capabilities, environment variables for LLM and embedding configurations, and volume mounts for persistent storage. It allows for a more complex and declarative setup. ```yaml version: '3.8' services: anythingllm: image: mintplexlabs/anythingllm container_name: anythingllm ports: - "3001:3001" cap_add: - SYS_ADMIN environment: # Adjust for your environment - STORAGE_DIR=/app/server/storage - JWT_SECRET="make this a large list of random numbers and letters 20+" - LLM_PROVIDER=ollama - OLLAMA_BASE_PATH=http://127.0.0.1:11434 - OLLAMA_MODEL_PREF=llama2 - OLLAMA_MODEL_TOKEN_LIMIT=4096 - EMBEDDING_ENGINE=ollama - EMBEDDING_BASE_PATH=http://127.0.0.1:11434 - EMBEDDING_MODEL_PREF=nomic-embed-text:latest - EMBEDDING_MODEL_MAX_CHUNK_LENGTH=8192 - VECTOR_DB=lancedb - WHISPER_PROVIDER=local - TTS_PROVIDER=native - PASSWORDMINCHAR=8 # Add any other keys here for services or settings # you can find in the docker/.env.example file volumes: - anythingllm_storage:/app/server/storage restart: always volumes: anythingllm_storage: driver: local driver_opts: type: none o: bind device: /path/on/local/disk ``` -------------------------------- ### Get Workspace Details (Bash) Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Fetches detailed information for a specific workspace, identified by its slug. Requires JWT authentication. Includes details about the workspace's documents and associated threads. ```bash curl -X GET http://localhost:3001/api/workspace/product-docs \ -H "Authorization: Bearer " # Response { "workspace": { "id": 5, "name": "Product Documentation", "slug": "product-docs", "vectorTag": "product-docs", "documents": [ { "id": "doc-123", "name": "user-guide.pdf", "metadata": { "title": "User Guide", "pages": 45 }, "pinned": false } ], "threads": [] } } ``` -------------------------------- ### OpenAI-Compatible Models List Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Retrieves a list of available OpenAI-compatible models. ```APIDOC ## GET /v1/openai/models ### Description Retrieves a list of available OpenAI-compatible models that can be used with the AnythingLLM API. ### Method GET ### Endpoint /v1/openai/models ### Parameters #### Query Parameters - **Authorization** (string) - Required - Bearer token for authentication. ### Response #### Success Response (200) - **data** (array) - A list of model objects. - **id** (string) - The unique identifier for the model. - **object** (string) - The type of object, should be 'model'. - **created** (integer) - Timestamp of model creation. - **owned_by** (string) - The owner of the model. #### Response Example ```json { "data": [ { "id": "product-docs", "object": "model", "created": 1737012345, "owned_by": "anythingllm" }, { "id": "support-kb", "object": "model", "created": 1737012346, "owned_by": "anythingllm" } ], "object": "list" } ``` ``` -------------------------------- ### Enable Multi-User Mode Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Enables multi-user mode by setting up the initial administrator credentials. ```APIDOC ## POST /api/system/enable-multi-user ### Description Initializes multi-user functionality by setting the administrator's username and password. ### Method POST ### Endpoint /api/system/enable-multi-user ### Parameters #### Request Body - **username** (string) - Required - The email address for the administrator account. - **password** (string) - Required - The password for the administrator account. ### Request Example ```json { "username": "admin@company.com", "password": "secureAdminPassword" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **message** (string) - A confirmation message. #### Response Example ```json { "success": true, "message": "Multi-user mode enabled" } ``` ``` -------------------------------- ### Set Welcome Messages Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Configures the welcome messages displayed to users. ```APIDOC ## POST /api/system/set-welcome-messages ### Description Sets a list of welcome messages that can be displayed to users upon interaction. ### Method POST ### Endpoint /api/system/set-welcome-messages ### Parameters #### Request Body - **messages** (array of strings) - Required - A list of welcome messages. ### Request Example ```json { "messages": [ "How can I help you today?", "What would you like to know?", "Ask me anything about our products!" ] } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **welcomeMessages** (array of strings) - The newly set welcome messages. #### Response Example ```json { "success": true, "welcomeMessages": ["How can I help you today?", ...] } ``` ``` -------------------------------- ### Frontend React Integration Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Provides examples for integrating AnythingLLM chat functionality into a React application, including initializing chat with a workspace and streaming responses. ```APIDOC ## Frontend React Integration ### Initialize Chat with Workspace This section demonstrates how to fetch workspace details and chat history using the `Workspace` model in React. ```javascript import { useState, useEffect } from 'react'; import Workspace from '@/models/workspace'; function WorkspaceChat({ slug }) { const [workspace, setWorkspace] = useState(null); const [chatHistory, setChatHistory] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { async function fetchWorkspace() { try { const ws = await Workspace.bySlug(slug); const history = await Workspace.chatHistory(slug); setWorkspace(ws.workspace); setChatHistory(history); } catch (error) { console.error('Failed to load workspace:', error); } finally { setLoading(false); } } fetchWorkspace(); }, [slug]); if (loading) return
Loading workspace...
; return (

{workspace.name}

); } ``` ### Stream Chat Response in React This section shows how to send messages and receive streaming responses from the chat model in a React component. ```javascript import { useEffect, useState } from 'react'; import Workspace from '@/models/workspace'; function ChatInterface({ workspaceSlug }) { const [messages, setMessages] = useState([]); const [streaming, setStreaming] = useState(false); const [currentResponse, setCurrentResponse] = useState(''); const sendMessage = async (message) => { setStreaming(true); setCurrentResponse(''); setMessages(prev => [...prev, { role: 'user', content: message }]); try { await Workspace.streamChat( workspaceSlug, message, 'chat', (chunk) => { if (chunk.type === 'textResponseChunk') { setCurrentResponse(prev => prev + chunk.textResponse); } if (chunk.type === 'textResponse' && chunk.close) { setMessages(prev => [...prev, { role: 'assistant', content: currentResponse, sources: chunk.sources, chatId: chunk.chatId }]); setCurrentResponse(''); setStreaming(false); } }, () => { setStreaming(false); } ); } catch (error) { console.error('Chat error:', error); setStreaming(false); } }; return (
{messages.map((msg, idx) => (
{msg.content} {msg.sources && (
{msg.sources.map((src, i) => ( {src.title} ))}
)}
))} {streaming && (
{currentResponse}
)}
); } ``` ``` -------------------------------- ### Create Workspace Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Creates a new workspace for organizing documents and conversations. ```APIDOC ## POST /v1/workspace/new ### Description Creates a new workspace within the AnythingLLM application. Workspaces are used to organize documents and maintain separate contexts for different knowledge bases. ### Method POST ### Endpoint /v1/workspace/new ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication. - **Content-Type** (string) - Required - Application JSON. #### Request Body - **name** (string) - Required - The display name for the new workspace. - **slug** (string) - Required - A unique identifier for the workspace (URL-friendly). ### Request Example ```json { "name": "Customer Support KB", "slug": "support-kb" } ``` ### Response #### Success Response (200) - **workspace** (object) - Details of the newly created workspace. - **id** (integer) - The unique identifier for the workspace. - **name** (string) - The display name of the workspace. - **slug** (string) - The unique slug of the workspace. #### Response Example ```json { "workspace": { "id": 7, "name": "Customer Support KB", "slug": "support-kb" } } ``` ``` -------------------------------- ### Process Raw Text using cURL Source: https://context7.com/mintplex-labs/anything-llm/llms.txt This example demonstrates processing raw text content directly. It requires the text content and optional metadata like title, description, and author. The API will create a document from the provided text and return its details, including a filename and content information. ```bash curl -X POST http://localhost:8888/process-raw-text \ -H "Content-Type: application/json" \ -d '{ "textContent": "This is my important note that I want to add to the knowledge base.", "metadata": { "title": "Quick Note", "description": "Important information", "author": "John Doe" } }' # Response { "success": true, "filename": "quick-note-1737012345.txt", "documents": [ { "id": "uuid-789", "pageContent": "This is my important note...", "title": "Quick Note", "token_count_estimate": 15 } ] } ``` -------------------------------- ### Update System Settings Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Allows administrators to update environment variables and system configurations. ```APIDOC ## POST /api/system/update-env ### Description Updates system environment variables such as LLM provider, API keys, vector database, and embedding models. ### Method POST ### Endpoint /api/system/update-env ### Parameters #### Request Body - **LLMProvider** (string) - Optional - The preferred Language Model provider. - **OpenAiKey** (string) - Optional - Your OpenAI API key. - **OpenAiModelPref** (string) - Optional - The preferred OpenAI model. - **VectorDB** (string) - Optional - The preferred vector database. - **EmbeddingEngine** (string) - Optional - The preferred embedding engine. - **EmbeddingModelPref** (string) - Optional - The preferred embedding model. ### Request Example ```json { "LLMProvider": "openai", "OpenAiKey": "sk-...", "OpenAiModelPref": "gpt-4", "VectorDB": "lancedb", "EmbeddingEngine": "openai", "EmbeddingModelPref": "text-embedding-3-small" } ``` ### Response #### Success Response (200) - **newValues** (object) - Contains the updated settings. Note: sensitive keys like API keys are returned as booleans indicating their presence. - **error** (object | null) - Contains error information if any occurred. #### Response Example ```json { "newValues": { "LLMProvider": "openai", "OpenAiKey": true, "OpenAiModelPref": "gpt-4" }, "error": null } ``` ``` -------------------------------- ### GitHub Repository Integration Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Integrates a GitHub repository by cloning its content and preparing it for embedding. ```APIDOC ## POST /ext/github-repo ### Description Clones a specified GitHub repository and processes its files to generate embeddings. You can configure which files and directories to ignore during the process. ### Method POST ### Endpoint /ext/github-repo ### Parameters #### Header Parameters - **Content-Type** (string) - Required - Application JSON. #### Request Body - **repo** (string) - Required - The GitHub repository in the format 'owner/repository'. - **branch** (string) - Optional - The specific branch to clone (defaults to 'main'). - **accessToken** (string) - Optional - A GitHub Personal Access Token for private repositories or increased rate limits. - **ignorePaths** (array) - Optional - A list of file paths or glob patterns to ignore during processing. ### Request Example ```json { "repo": "owner/repository", "branch": "main", "accessToken": "ghp_...", "ignorePaths": [".github/", "node_modules/", "*.test.js"] } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the repository integration was successful. - **data** (object) - Information about the processed repository. - **files** (integer) - The number of files processed. - **destination** (string) - An identifier for the repository content. #### Response Example ```json { "success": true, "data": { "files": 156, "destination": "github-owner-repository-main" } } ``` ``` -------------------------------- ### User Management (Multi-User Mode) Source: https://context7.com/mintplex-labs/anything-llm/llms.txt APIs for managing users when multi-user mode is enabled. ```APIDOC ## POST /api/admin/users/new ### Description Creates a new user account in the system. ### Method POST ### Endpoint /api/admin/users/new ### Parameters #### Request Body - **username** (string) - Required - The username (email) for the new user. - **password** (string) - Required - The initial password for the new user. - **role** (string) - Optional - The role assigned to the user (e.g., 'default', 'manager', 'admin'). Defaults to 'default'. ### Request Example ```json { "username": "jane.smith@company.com", "password": "initialPassword123", "role": "default" } ``` ### Response #### Success Response (200) - **user** (object) - Details of the newly created user. - **id** (integer) - The unique identifier for the user. - **username** (string) - The username of the user. - **role** (string) - The assigned role of the user. - **createdAt** (string) - The timestamp when the user was created. - **error** (object | null) - Contains error information if any occurred. #### Response Example ```json { "user": { "id": 5, "username": "jane.smith@company.com", "role": "default", "createdAt": "2025-01-15T12:00:00.000Z" }, "error": null } ``` ``` ```APIDOC ## GET /api/admin/users ### Description Retrieves a list of all users in the system. ### Method GET ### Endpoint /api/admin/users ### Response #### Success Response (200) - **users** (array of objects) - A list containing details of each user. - **id** (integer) - The unique identifier for the user. - **username** (string) - The username of the user. - **role** (string) - The assigned role of the user. - **createdAt** (string) - The timestamp when the user was created. #### Response Example ```json { "users": [ { "id": 1, "username": "admin@company.com", "role": "admin", "createdAt": "2025-01-01T00:00:00.000Z" }, { "id": 5, "username": "jane.smith@company.com", "role": "default", "createdAt": "2025-01-15T12:00:00.000Z" } ] } ``` ``` ```APIDOC ## POST /api/admin/user/{userId} ### Description Updates the role of a specific user. ### Method POST ### Endpoint /api/admin/user/{userId} ### Parameters #### Path Parameters - **userId** (integer) - Required - The ID of the user to update. #### Request Body - **role** (string) - Required - The new role to assign to the user (e.g., 'manager', 'default'). ### Request Example ```json { "role": "manager" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **user** (object) - Details of the updated user. - **id** (integer) - The unique identifier for the user. - **username** (string) - The username of the user. - **role** (string) - The updated role of the user. #### Response Example ```json { "success": true, "user": { "id": 5, "username": "jane.smith@company.com", "role": "manager" } } ``` ``` ```APIDOC ## POST /api/admin/workspace-users ### Description Assigns or unassigns users to specific workspaces. ### Method POST ### Endpoint /api/admin/workspace-users ### Parameters #### Request Body - **workspaceId** (integer) - Required - The ID of the workspace. - **userIds** (array of integers) - Required - A list of user IDs to assign to the workspace. ### Request Example ```json { "workspaceId": 5, "userIds": [5] } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the operation was successful. - **message** (string) - A confirmation message. #### Response Example ```json { "success": true, "message": "Workspace users updated" } ``` ``` ```APIDOC ## POST /api/admin/invite/new ### Description Creates a new invitation link for users to join specific workspaces. ### Method POST ### Endpoint /api/admin/invite/new ### Parameters #### Request Body - **workspaceIds** (array of integers) - Required - A list of workspace IDs the invited user will have access to. - **role** (string) - Optional - The default role assigned to users who accept the invite. Defaults to 'default'. ### Request Example ```json { "workspaceIds": [5, 6], "role": "default" } ``` ### Response #### Success Response (200) - **invite** (object) - Details of the created invitation. - **id** (integer) - The unique identifier for the invite. - **code** (string) - The invitation code. - **status** (string) - The status of the invite (e.g., 'active'). - **createdAt** (string) - The timestamp when the invite was created. - **error** (object | null) - Contains error information if any occurred. #### Response Example ```json { "invite": { "id": 3, "code": "abc123def456", "status": "active", "createdAt": "2025-01-15T12:30:00.000Z" }, "error": null } ``` **Note**: Share the link `http://localhost:3001/accept-invite/{invite.code}` with users. ``` -------------------------------- ### AI Agent Configuration Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Configure AI agent settings for a workspace, including mode, provider, and model. ```APIDOC ## POST /api/workspace/{workspace_slug}/update ### Description Updates the AI agent configuration for a specific workspace. This allows you to define how the AI agent operates, including its interaction mode, the LLM provider, and the specific model to use. ### Method POST ### Endpoint /api/workspace/{workspace_slug}/update ### Parameters #### Path Parameters - **workspace_slug** (string) - Required - The slug of the workspace to configure. #### Header Parameters - **Authorization** (string) - Required - JWT token for authentication. - **Content-Type** (string) - Required - Application JSON. #### Request Body - **agentMode** (string) - Optional - The interaction mode for the agent (e.g., 'chat'). - **agentProvider** (string) - Optional - The LLM provider to use (e.g., 'openai'). - **agentModel** (string) - Optional - The specific model to use (e.g., 'gpt-4'). ### Request Example ```json { "agentMode": "chat", "agentProvider": "openai", "agentModel": "gpt-4" } ``` ``` ```APIDOC ## POST /api/workspace/{workspace_slug}/stream-chat ### Description Initiates a chat with the AI agent in a specific workspace, streaming the response back to the client. This endpoint is suitable for real-time conversational interactions. ### Method POST ### Endpoint /api/workspace/{workspace_slug}/stream-chat ### Parameters #### Path Parameters - **workspace_slug** (string) - Required - The slug of the workspace to chat with. #### Header Parameters - **Authorization** (string) - Required - JWT token for authentication. - **Content-Type** (string) - Required - Application JSON. #### Request Body - **message** (string) - Required - The user's message to the AI agent. - **mode** (string) - Optional - The mode of interaction (e.g., 'chat'). ### Request Example ```json { "message": "Search the web for the latest version and compare with our docs", "mode": "chat" } ``` ``` -------------------------------- ### Developer API (v1) - OpenAI Compatible Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Provides an OpenAI-compatible API endpoint for chat completions. ```APIDOC ## POST /v1/openai/chat/completions ### Description An OpenAI-compatible endpoint for generating chat completions. AnythingLLM routes requests to the configured LLM provider, with each workspace acting as a distinct 'model'. ### Method POST ### Endpoint /v1/openai/chat/completions ### Parameters #### Request Body - **model** (string) - Required - The identifier for the model (often a workspace name). - **messages** (array of objects) - Required - A list of message objects in the chat conversation. - **role** (string) - Role of the message sender ('user', 'assistant', 'system'). - **content** (string) - The content of the message. - **temperature** (number) - Optional - Controls randomness. Lower values make output more focused and deterministic. - **stream** (boolean) - Optional - Whether to stream the response. Defaults to false. ### Request Example ```json { "model": "product-docs", "messages": [ { "role": "user", "content": "What are the installation requirements?" } ], "temperature": 0.7, "stream": false } ``` ### Response (Response format follows OpenAI's Chat Completions API structure.) #### Success Response (200) - **choices** (array) - A list of generated completion choices. - **usage** (object) - Information about token usage. #### Response Example ```json { "id": "chatcmpl-123", "object": "chat.completion", "created": 1677652288, "model": "product-docs", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "To install AnythingLLM, you need Docker..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 10, "completion_tokens": 20, "total_tokens": 30 } } ``` ``` -------------------------------- ### Configure QDrant Environment Variables Source: https://github.com/mintplex-labs/anything-llm/blob/master/server/utils/vectorDbProviders/qdrant/QDRANT_SETUP.md These environment variables are used to configure the connection to a QDrant vector database. Ensure these are set in your `.env.development` file or defined at runtime for development mode. ```dotenv VECTOR_DB="qdrant" QDRANT_ENDPOINT="https://.qdrant.io:6333" QDRANT_API_KEY="abc...123xyz" ``` -------------------------------- ### List OpenAI-Compatible Models Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Retrieves a list of available OpenAI-compatible models hosted by the AnythingLLM instance. This requires an API key for authorization. ```bash curl -X GET http://localhost:3001/v1/openai/models \ -H "Authorization: Bearer " # Response { "data": [ { "id": "product-docs", "object": "model", "created": 1737012345, "owned_by": "anythingllm" }, { "id": "support-kb", "object": "model", "created": 1737012346, "owned_by": "anythingllm" } ], "object": "list" } ``` -------------------------------- ### Get Chat History Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Retrieves the history of past chat conversations. ```APIDOC ## GET /api/workspace/product-docs/chats ### Description Retrieves the history of past chat conversations. ### Method GET ### Endpoint `/api/workspace/product-docs/chats` ### Parameters None ### Request Example ```bash curl -X GET http://localhost:3001/api/workspace/product-docs/chats \ -H "Authorization: Bearer " ``` ### Response #### Success Response (200) - **history** (array) - An array of chat history objects. - **id** (integer) - The unique identifier for the chat. - **prompt** (string) - The user's prompt. - **response** (string) - The AI's response. - **createdAt** (string) - The timestamp when the chat was created. - **include** (boolean) - Indicates if the chat should be included. - **user** (object|null) - Information about the user. #### Response Example ```json { "history": [ { "id": 1, "prompt": "What are the key features?", "response": "Based on the documentation...", "createdAt": "2025-01-15T10:30:00.000Z", "include": true, "user": null }, { "id": 2, "prompt": "Explain the installation process", "response": "To install the product...", "createdAt": "2025-01-15T10:35:00.000Z", "include": true, "user": null } ] } ``` ``` -------------------------------- ### Configure AnythingLLM Server Environment Source: https://github.com/mintplex-labs/anything-llm/blob/master/BARE_METAL.md Copies the example environment file for the server, which contains instance settings. You must ensure at least STORAGE_DIR is set. ```bash cp server/.env.example server/.env # Ensure STORAGE_DIR is set in server/.env ``` -------------------------------- ### GET /api/system/local-files - List All Documents Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Retrieves a list of all documents stored in the system, organized by folders. ```APIDOC ## GET /api/system/local-files ### Description Retrieves a list of all documents stored in the system, organized by folders. ### Method GET ### Endpoint http://localhost:3001/api/system/local-files ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET http://localhost:3001/api/system/local-files \ -H "Authorization: Bearer " ``` ### Response #### Success Response (200) - **localFiles** (object) - An object representing the file structure: - **name** (string) - The name of the root folder. - **type** (string) - The type of the item (e.g., 'folder', 'file'). - **items** (array) - An array of items within the folder, which can be other folders or files. - Each item object may contain: - **name** (string) - The name of the file or folder. - **type** (string) - The type of the item. - **id** (string) - A unique identifier for the file, often its path. - **cached** (boolean) - Indicates if the file is cached locally. #### Response Example ```json { "localFiles": { "name": "documents", "type": "folder", "items": [ { "name": "custom-documents", "type": "folder", "items": [ { "name": "document.pdf", "type": "file", "id": "custom-documents/document-1737012345.pdf", "cached": false } ] } ] } } ``` ``` -------------------------------- ### Authentication API Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Endpoints for authenticating users and obtaining API keys. This includes logging in to get JWT tokens, verifying token validity, and generating API keys for developer access. ```APIDOC ## POST /api/request-token ### Description Logs in a user and returns a JWT token for authentication. Supports both single-user (password-based) and multi-user modes. ### Method POST ### Endpoint `/api/request-token` ### Parameters #### Request Body - **username** (string) - Required - The username or email for login. - **password** (string) - Required - The user's password. ### Request Example ```json { "username": "john.doe@company.com", "password": "securePassword123" } ``` ### Response #### Success Response (200) - **valid** (boolean) - Indicates if authentication was successful. - **user** (object) - User details including id, username, and role. - **token** (string) - The JWT token for subsequent authenticated requests. - **message** (string) - Confirmation message. #### Response Example ```json { "valid": true, "user": { "id": 1, "username": "default", "role": "admin" }, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "message": "Valid auth credentials" } ``` ## GET /api/system/check-token ### Description Verifies the validity of a provided JWT token. ### Method GET ### Endpoint `/api/system/check-token` ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication (e.g., `Bearer `). ### Response #### Success Response (200) - **valid** (boolean) - Indicates if the token is valid. #### Response Example ```json { "valid": true } ``` ## POST /api/system/generate-api-key ### Description Generates an API key for developer access. This endpoint is intended for single-user mode. ### Method POST ### Endpoint `/api/system/generate-api-key` ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication (e.g., `Bearer `). ### Response #### Success Response (200) - **apiKey** (object) - Contains the generated API key details. - **id** (integer) - The ID of the API key. - **secret** (string) - The secret API key. - **createdAt** (string) - The timestamp when the API key was created. - **createdBy** (integer) - The ID of the user who created the API key. - **error** (null) - Placeholder for potential errors. #### Response Example ```json { "apiKey": { "id": 1, "secret": "ANLLM-a1b2c3d4e5f6...", "createdAt": "2025-01-15T10:30:00.000Z", "createdBy": 1 }, "error": null } ``` ## POST /api/admin/generate-api-key ### Description Generates an API key for developer access. This endpoint is intended for multi-user admin mode. ### Method POST ### Endpoint `/api/admin/generate-api-key` ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication (e.g., `Bearer `). ### Response #### Success Response (200) - **apiKey** (object) - Contains the generated API key details. - **id** (integer) - The ID of the API key. - **secret** (string) - The secret API key. - **createdAt** (string) - The timestamp when the API key was created. - **createdBy** (integer) - The ID of the admin who created the API key. - **error** (null) - Placeholder for potential errors. #### Response Example ```json { "apiKey": { "id": 2, "secret": "ANLLM-f7g8h9i0j1k2...", "createdAt": "2025-01-15T10:35:00.000Z", "createdBy": 99 }, "error": null } ``` ``` -------------------------------- ### Running AnythingLLM with Docker Commands Source: https://context7.com/mintplex-labs/anything-llm/llms.txt A set of bash commands for deploying and managing the AnythingLLM Docker container. It includes commands to pull the latest image, run the container with specified ports and environment variables, view logs, and access the application via localhost. ```bash # Pull latest image docker pull mintplexlabs/anythingllm:latest # Run container docker run -d \ --name anythingllm \ -p 3001:3001 \ -e LLM_PROVIDER=openai \ -e OPEN_AI_KEY=sk-... \ -eDISABLE_TELEMETRY=true \ -v anythingllm_storage:/app/server/storage \ mintplexlabs/anythingllm:latest # Check logs docker logs -f anythingllm # Access application # http://localhost:3001 ``` -------------------------------- ### Create Workspace via v1 API Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Creates a new workspace using the v1 API. This endpoint requires an authorization token and accepts workspace name and slug in the JSON body. ```bash curl -X POST http://localhost:3001/v1/workspace/new \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "name": "Customer Support KB", "slug": "support-kb" }' # Response { "workspace": { "id": 7, "name": "Customer Support KB", "slug": "support-kb" } } ``` -------------------------------- ### Verify JWT Token Validity (Bash) Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Checks the validity of a provided JWT token by sending a GET request to the system endpoint. Returns a JSON object indicating whether the token is valid. ```bash curl -X GET http://localhost:3001/api/system/check-token \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." # Response { "valid": true } ``` -------------------------------- ### Configure Weaviate Environment Variables (.env.development) Source: https://github.com/mintplex-labs/anything-llm/blob/master/server/utils/vectorDbProviders/weaviate/WEAVIATE_SETUP.md This snippet shows the essential environment variables required to configure Anything LLM to use a Weaviate vector database. It includes the database type, the Weaviate endpoint URL, and an optional API key. These variables are typically set in a `.env.development` file or defined at runtime. ```dotenv VECTOR_DB="weaviate" WEAVIATE_ENDPOINT='http://localhost:8080' WEAVIATE_API_KEY= # Optional ``` -------------------------------- ### Get Chat History Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Retrieves the history of past chat conversations. It returns a list of chat objects, each containing the prompt, response, and metadata like creation time. This is useful for displaying previous interactions to the user. ```bash curl -X GET http://localhost:3001/api/workspace/product-docs/chats \ -H "Authorization: Bearer " # Response { "history": [ { "id": 1, "prompt": "What are the key features?", "response": "Based on the documentation...", "createdAt": "2025-01-15T10:30:00.000Z", "include": true, "user": null }, { "id": 2, "prompt": "Explain the installation process", "response": "To install the product...", "createdAt": "2025-01-15T10:35:00.000Z", "include": true, "user": null } ] } ``` -------------------------------- ### Create New Workspace (Bash) Source: https://context7.com/mintplex-labs/anything-llm/llms.txt Creates a new workspace with specified settings, including name, slug, and LLM configuration parameters like temperature and history length. Requires JWT authentication. Returns the newly created workspace details. ```bash curl -X POST http://localhost:3001/api/workspace/new \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ \ "name": "Product Documentation", \ "slug": "product-docs", \ "openAiTemp": 0.7, \ "openAiHistory": 20, \ "similarityThreshold": 0.25, \ "topN": 4 \ }' # Response { "workspace": { "id": 5, "name": "Product Documentation", "slug": "product-docs", "createdAt": "2025-01-15T10:30:00.000Z" }, "message": "Workspace created" } ``` -------------------------------- ### Example AnythingLLM Helm values-secret.yaml Source: https://github.com/mintplex-labs/anything-llm/blob/master/cloud-deployments/helm/charts/anythingllm/README.md A sample `values-secret.yaml` file for `helm install`. It configures the container image, service type, port, references a Kubernetes Secret for environment variables, and sets persistent volume size and mount path. ```yaml image: repository: mintplexlabs/anythingllm tag: "1.9.0" service: type: ClusterIP port: 3001 # Reference secret containing API keys envFrom: - secretRef: name: openai-secret # Optionally override other values persistentVolume: size: 16Gi mountPath: /storage ```