### Setup Lynkr and Example Dependencies Source: https://github.com/fast-editor/lynkr/blob/main/examples/vercel-ai-sdk/README.md Steps to start the Lynkr server, install example dependencies, and run different chat functionalities. ```bash # 1. Start Lynkr cd /path/to/Lynkr npm start # 2. Install example dependencies cd examples/vercel-ai-sdk npm install # 3. Run examples npm run chat # Basic text generation npm run stream # Streaming response npm run tools # Tool calling ``` -------------------------------- ### Install Lynkr from Source Source: https://github.com/fast-editor/lynkr/blob/main/INSTALL.md Clone the Lynkr repository, install dependencies using npm, copy the example environment file, and start the application. ```bash git clone https://github.com/Fast-Editor/Lynkr.git cd Lynkr npm install cp .env.example .env npm start ``` -------------------------------- ### Install Lynkr from Source Source: https://github.com/fast-editor/lynkr/wiki/Emulating-the-Claude-Code-Backend-for-LLM's-hosted-on-Databricks-&-Azure-Anthropic-(with-MCP,-Git-tools,-and-prompt-caching) Clone the Lynkr repository, install dependencies, and start the application from source. ```bash git clone https://github.com/vishalveerareddy123/Lynkr.git cd Lynkr npm install npm start ``` -------------------------------- ### Configure and Start Lynkr from Source Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md After cloning and installing dependencies, copy the environment file, edit it with provider credentials, and start the server using npm. ```bash cp .env.example .env nano .env npm start ``` -------------------------------- ### Start Lynkr service Source: https://github.com/fast-editor/lynkr/blob/main/INSTALL.md Start the Lynkr service after global installation. ```bash lynkr start ``` -------------------------------- ### Start Lynkr Server Source: https://github.com/fast-editor/lynkr/blob/main/documentation/claude-code-cli.md Start the Lynkr server. If installed from source, use 'npm start'. Wait for the confirmation message indicating the server is listening. ```bash lynkr start # Or: npm start (if installed from source) # Wait for: "Server listening at http://0.0.0.0:8081" ``` -------------------------------- ### Basic Docker Compose Setup Source: https://github.com/fast-editor/lynkr/blob/main/DEPLOYMENT.md Basic setup for deploying Lynkr using Docker Compose. Includes copying environment file, starting services, viewing logs, and stopping services. ```bash # Copy and configure environment cp .env.example .env nano .env # Configure your providers # Start services docker compose up -d # View logs docker compose logs -f lynkr # Stop services docker compose down ``` -------------------------------- ### Environment File Setup Source: https://github.com/fast-editor/lynkr/blob/main/documentation/providers.md Recommended for production, use a .env file to manage credentials and configuration. Copy the example file and edit with your specific details. ```env # Copy example file cp .env.example .env # Edit with your credentials nano .env ``` ```env MODEL_PROVIDER=ollama DATABRICKS_API_BASE=https://your-workspace.databricks.com DATABRICKS_API_KEY=dapi1234567890abcdef PORT=8081 LOG_LEVEL=info # Tier routing (optional — set all 4 to enable) TIER_SIMPLE=ollama:llama3.2 TIER_MEDIUM=openrouter:openai/gpt-4o-mini TIER_COMPLEX=databricks:claude-sonnet TIER_REASONING=databricks:claude-sonnet ``` -------------------------------- ### Install and Run Lynkr Source: https://github.com/fast-editor/lynkr/blob/main/skills/lynkr/SKILL.md Install Lynkr globally, set up Ollama and a model, then start the proxy. Point your AI coding tool to the specified local address. ```bash npm install -g lynkr lynkr-setup # Auto-installs Ollama + pulls a model lynkr # Start the proxy ``` -------------------------------- ### Install and Configure Lynkr with Ollama Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Install Lynkr globally after setting up Ollama locally. Configure Ollama environment variables for the model provider and specific model, then start Lynkr. Ollama requires a separate installation and service start. ```bash # Install Ollama first brew install ollama # macOS # Or download from: https://ollama.ai/download # Start Ollama service ollama serve # Pull a model (in separate terminal) ollama pull llama3.1:8b # Install Lynkr npm install -g lynkr # Configure export MODEL_PROVIDER=ollama export OLLAMA_MODEL=llama3.1:8b # Start lynkr start ``` -------------------------------- ### Install Lynkr via Docker Source: https://github.com/fast-editor/lynkr/blob/main/INSTALL.md Clone the Lynkr repository, navigate to the directory, and start the Docker containers. ```bash git clone https://github.com/Fast-Editor/Lynkr.git cd Lynkr docker-compose up -d ``` -------------------------------- ### Install and Run Ollama Source: https://github.com/fast-editor/lynkr/blob/main/documentation/providers.md Installs Ollama via Homebrew, starts the service, pulls a model, and lists available models. ```bash # Install Ollama brew install ollama # macOS # Or download from: https://ollama.ai/download # Start Ollama service olama serve # Pull a model olama pull llama3.1:8b # Verify model is available olama list ``` -------------------------------- ### Install and Run Ollama Source: https://github.com/fast-editor/lynkr/blob/main/documentation/embeddings.md Install Ollama, start the service, and pull an embedding model. Verify the model is available using `ollama list`. ```bash # 1. Install Ollama (if not already installed) brew install ollama # macOS # Or download from: https://ollama.ai/download # 2. Start Ollama service ollama serve # 3. Pull embedding model (in separate terminal) ollama pull nomic-embed-text # 4. Verify model is available ollama list # Should show: nomic-embed-text ... ``` -------------------------------- ### Clone and Install Dependencies Source: https://github.com/fast-editor/lynkr/blob/main/documentation/contributing.md Steps to clone the repository, install dependencies, and set up the environment file for development. ```bash # Fork the repo on GitHub first, then: git clone https://github.com/YOUR_USERNAME/Lynkr.git cd Lynkr # Install dependencies npm install # Copy environment template cp .env.example .env # Edit .env with your test credentials nano .env ``` -------------------------------- ### Docker Deployment Example Source: https://github.com/fast-editor/lynkr/blob/main/documentation/openclaw-integration.md Example Docker Compose configuration for deploying Lynkr. ```yaml ``` -------------------------------- ### Install Rust and Graphify Source: https://github.com/fast-editor/lynkr/blob/main/README.md Install Rust and then build and install the Graphify tool for optional code intelligence features. Ensure Rust is in your PATH. ```bash # Install Rust if not already installed curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env # Build and install graphify git clone https://github.com/safishamsi/graphify cd graphify cargo build --release sudo cp target/release/graphify /usr/local/bin/ ``` -------------------------------- ### Docker Compose Setup for Lynkr Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Set up and run Lynkr using Docker Compose, which is recommended for production. This includes cloning, configuring .env, and starting services. ```bash git clone https://github.com/Fast-Editor/Lynkr.git cd Lynkr cp .env.example .env nano .env docker-compose up -d ``` -------------------------------- ### Install and Configure Lynkr with Databricks Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Install Lynkr globally, set Databricks environment variables for API access, and start the Lynkr service. Ensure you have your Databricks workspace URL and API key. ```bash npm install -g lynkr export MODEL_PROVIDER=databricks export DATABRICKS_API_BASE=https://your-workspace.cloud.databricks.com export DATABRICKS_API_KEY=dapi1234567890abcdef lynkr start ``` -------------------------------- ### Install and Configure Lynkr with OpenRouter Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Install Lynkr globally, set OpenRouter environment variables with your API key and desired model, and start the Lynkr service. OpenRouter offers a wide selection of models and requires an API key from their platform. ```bash npm install -g lynkr export MODEL_PROVIDER=openrouter export OPENROUTER_API_KEY=sk-or-v1-your-key export OPENROUTER_MODEL=anthropic/claude-3.5-sonnet lynkr start ``` -------------------------------- ### Lynkr Application Initialization and Navigation Source: https://github.com/fast-editor/lynkr/blob/main/public/dashboard.html Handles the initial setup of the application, including setting the default page and starting the refresh countdown. Manages page navigation and updates UI elements accordingly. ```javascript const App = { page: 'overview', data: {}, usageWindow: '7d', logFilters: { provider: '', tier: '', error: false }, _refreshTimer: null, _countdownTimer: null, _countdown: 30, _charts: {}, init() { const hash = location.hash.slice(1) || 'overview'; this.navigate(hash, true); this._startCountdown(); }, navigate(page, initial=false) { this.page = page; location.hash = page; this._updateTabs(); document.getElementById('content').innerHTML = loadingState(); this._destroyCharts(); this.refresh(); }, _updateTabs() { document.querySelectorAll('[data-page]').forEach(btn => { const active = btn.dataset.page === this.page; btn.className = active ? 'ring-tab px-4 py-2 rounded-md text-sm font-medium text-white bg-slate-700' : 'ring-tab px-4 py-2 rounded-md text-sm font-medium text-slate-400 hover:text-white hover:bg-slate-700'; }); }, _startCountdown() { this._countdown = 30; clearInterval(this._countdownTimer); this._countdownTimer = setInterval(() => { this._countdown--; const el = document.getElementById('refresh-countdown'); if (el) el.textContent = this._countdown + 's'; if (this._countdown <= 0) { this._countdown = 30; this.refresh(true); // silent refresh } }, 1000); }, async refresh(silent=false) { this._countdown = 30; if (!silent) document.getElementById('content').innerHTML = loadingState(); const dot = document.getElementById('live-dot'); if (dot) { dot.className = 'status-dot bg-yellow-500'; } try { let data; if (this.page === 'overview') data = await this._fetch('/dashboard/api/overview'); if (this.page === '... ``` -------------------------------- ### MCP Code Mode Workflow Example Source: https://github.com/fast-editor/lynkr/blob/main/documentation/tools.md Demonstrates the sequential calls made in MCP Code Mode: first to discover tools, then to get specific tool information, and finally to execute a tool. ```json // Turn 1: Discover tools { "name": "mcp_list_tools", "input": { "server_id": "github" } } // → Returns: { total_tools: 47, servers: { github: [{ name: "create_issue", description: "..." }, ...] } } ``` ```json // Turn 2: Get schema for the tool you need { "name": "mcp_tool_info", "input": { "server_id": "github", "tool_name": "create_issue" } } // → Returns: { inputSchema: { title: { type: "string", ... }, body: { ... } } } ``` ```json // Turn 3: Execute { "name": "mcp_execute", "input": { "server_id": "github", "tool_name": "create_issue", "arguments": { "title": "Bug fix", "body": "..." } } } ``` -------------------------------- ### Start llama-server Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Starts the llama-server with a specified model and port. ```bash ./llama-server -m qwen2.5-coder-7b-instruct-q4_k_m.gguf --port 8080 ``` -------------------------------- ### Arrange-Act-Assert Pattern Example Source: https://github.com/fast-editor/lynkr/blob/main/documentation/testing.md Demonstrates the Arrange-Act-Assert pattern for structuring unit tests in JavaScript, showing setup, execution, and assertion steps. ```javascript it("should calculate total correctly", () => { // Arrange const items = [1, 2, 3]; // Act const total = calculateTotal(items); // Assert assert.strictEqual(total, 6); }); ``` -------------------------------- ### Install Lynkr from Source Source: https://github.com/fast-editor/lynkr/blob/main/documentation/claude-code-cli.md Clone the Lynkr repository from GitHub, navigate into the directory, and install dependencies using npm. ```bash git clone https://github.com/Fast-Editor/Lynkr.git cd Lynkr && npm install ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/fast-editor/lynkr/blob/main/DEPLOYMENT.md Copies the example environment file and opens it for editing. ```bash sudo cp .env.example .env sudo nano .env ``` -------------------------------- ### Deploy Lynkr with Docker Compose Source: https://github.com/fast-editor/lynkr/blob/main/documentation/faq.md Clone the Lynkr repository, copy the environment example file, configure your credentials in the .env file, and start the services in detached mode using Docker Compose. ```bash git clone https://github.com/Fast-Editor/Lynkr.git cd Lynkr cp .env.example .env # Edit .env with your credentials docker-compose up -d ``` -------------------------------- ### Install Node.js on Ubuntu/Debian Source: https://github.com/fast-editor/lynkr/blob/main/INSTALL.md Use the NodeSource script to set up Node.js 20.x and then install Node.js on Ubuntu/Debian. ```bash curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt-get install -y nodejs ``` -------------------------------- ### Install and Configure Lynkr with AWS Bedrock Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Install Lynkr globally, configure AWS Bedrock environment variables including API key, region, and model ID, then start the Lynkr service. Bedrock requires enabling in your AWS region and requesting model access. ```bash npm install -g lynkr export MODEL_PROVIDER=bedrock export AWS_BEDROCK_API_KEY=ABSK...your-bedrock-api-key export AWS_BEDROCK_REGION=us-east-1 export AWS_BEDROCK_MODEL_ID=us.anthropic.claude-3-5-sonnet-20241022-v2:0 lynkr start ``` -------------------------------- ### Install Lynkr via One-line Script Source: https://github.com/fast-editor/lynkr/blob/main/README.md Install Lynkr using a convenient one-line curl script. This method downloads and executes the installation script. ```bash curl -fsSL https://raw.githubusercontent.com/Fast-Editor/Lynkr/main/install.sh | bash ``` -------------------------------- ### Install Lynkr via Homebrew Source: https://github.com/fast-editor/lynkr/blob/main/INSTALL.md Tap the Lynkr repository and install it using Homebrew on macOS or Linux. ```bash brew tap fast-editor/lynkr brew install lynkr lynkr start ``` -------------------------------- ### Production OpenRouter Setup for Lynkr Source: https://github.com/fast-editor/lynkr/blob/main/README.md An example .env configuration for a production environment using OpenRouter, optimized for cost savings with smart tier routing. It includes essential provider and server settings. ```bash # .env - Production OpenRouter Setup # ============================================ # REQUIRED: Provider Configuration # ============================================ MODEL_PROVIDER=openrouter OPENROUTER_API_KEY=sk-or-v1-your-key-here FALLBACK_ENABLED=false # ============================================ # REQUIRED: Server Configuration # ============================================ PORT=8081 HOST=0.0.0.0 # ============================================ # TIER ROUTING: Smart Cost Optimization ``` -------------------------------- ### Mixed Local and Cloud Model Provider Setup Source: https://github.com/fast-editor/lynkr/blob/main/documentation/routing.md Configure environment variables to define default model providers and specific tiers for different complexity levels. This setup routes simple requests locally and complex ones to cloud providers. ```bash MODEL_PROVIDER=ollama # Startup checks + default provider TIER_SIMPLE=ollama:llama3.2 # Score 0-25 → Ollama (free, local) TIER_MEDIUM=openai:gpt-4o # Score 26-50 → OpenAI TIER_COMPLEX=databricks:claude-sonnet-4-5 # Score 51-75 → Databricks TIER_REASONING=databricks:claude-opus-4-6 # Score 76-100 → Databricks ``` -------------------------------- ### Lynkr .env File Configuration Example Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Example of a .env file for configuring Lynkr, including core settings, provider-specific credentials, tool execution, and memory system options. ```env # Core Configuration MODEL_PROVIDER=databricks PORT=8081 LOG_LEVEL=info WORKSPACE_ROOT=/path/to/your/projects # Databricks Configuration DATABRICKS_API_BASE=https://your-workspace.cloud.databricks.com DATABRICKS_API_KEY=dapi1234567890abcdef # Tool Execution TOOL_EXECUTION_MODE=server # Memory System (optional) MEMORY_ENABLED=true MEMORY_RETRIEVAL_LIMIT=5 ``` -------------------------------- ### Basic Test Structure with Setup and Teardown Source: https://github.com/fast-editor/lynkr/blob/main/documentation/testing.md Illustrates a more detailed test structure with setup (beforeEach) and teardown (afterEach) logic, including environment variable saving/restoring and module cache clearing for isolated testing. ```javascript const assert = require("assert"); const { describe, it, beforeEach, afterEach } = require("node:test"); describe("Module Name", () => { let originalEnv; beforeEach(() => { // Save original environment originalEnv = { ...process.env }; // Clear module cache to get fresh config delete require.cache[require.resolve("../src/config")]; }); afterEach(() => { // Restore original environment process.env = originalEnv; }); it("should handle valid input", () => { // Arrange const input = "test-input"; // Act const result = myFunction(input); // Assert assert.strictEqual(result, "expected-output"); }); it("should throw error for invalid input", () => { // Assert that function throws assert.throws( () => myFunction(null), /Expected error message/ ); }); }); ``` -------------------------------- ### Embeddings Configuration Examples Source: https://github.com/fast-editor/lynkr/blob/main/documentation/api.md Examples of environment variables for configuring embeddings providers, including Ollama (local) and OpenAI (cloud). ```bash # Ollama embeddings (local) EMBEDDINGS_PROVIDER=ollama OLLAMA_API_BASE=http://localhost:11434 OLLAMA_EMBEDDINGS_MODEL=nomic-embed-text # OpenAI embeddings (cloud) EMBEDDINGS_PROVIDER=openai OPENAI_API_KEY=sk-... OPENAI_EMBEDDINGS_MODEL=text-embedding-3-small ``` -------------------------------- ### Warm Up Ollama After Startup Source: https://github.com/fast-editor/lynkr/blob/main/documentation/troubleshooting.md Send a test request to a model after Lynkr starts to pre-load it into memory and reduce the chance of a cold start on the first user request. ```bash curl http://localhost:8081/v1/messages \ -H "Content-Type: application/json" \ -d '{"model":"claude-3-5-sonnet","max_tokens":10,"messages":[{"role":"user","content":"hi"}]}' ``` -------------------------------- ### Writing Unit Tests with Node.js Test Runner Source: https://github.com/fast-editor/lynkr/blob/main/documentation/contributing.md Example of how to write unit tests using Node.js's built-in test runner, including setup, execution, and assertion. ```javascript const assert = require("assert"); const { describe, it, beforeEach, afterEach } = require("node:test"); describe("Feature name", () => { beforeEach(() => { // Setup }); afterEach(() => { // Cleanup }); it("should do something specific", () => { // Arrange const input = "test"; // Act const result = myFunction(input); // Assert assert.strictEqual(result, "expected"); }); }); ``` -------------------------------- ### Start Ollama Server Source: https://github.com/fast-editor/lynkr/blob/main/README.md Start the Ollama server using the 'ollama serve' command. This is necessary to resolve the 'connect ECONNREFUSED' error when using Ollama with Lynkr. ```bash ollama serve ``` -------------------------------- ### Start Lynkr Source: https://github.com/fast-editor/lynkr/blob/main/documentation/headroom.md Run this command to start the Lynkr service, which will automatically manage the Headroom container. ```bash npm start ``` -------------------------------- ### Install Lynkr Globally Source: https://github.com/fast-editor/lynkr/wiki/Emulating-the-Claude-Code-Backend-for-LLM's-hosted-on-Databricks-&-Azure-Anthropic-(with-MCP,-Git-tools,-and-prompt-caching) Install the Lynkr CLI globally using npm for easy access. ```bash npm install -g lynkr lynkr start ``` -------------------------------- ### Set Credentials and Start Lynkr Source: https://github.com/fast-editor/lynkr/blob/main/documentation/troubleshooting.md If Lynkr fails to start due to missing credentials, ensure the MODEL_PROVIDER and the corresponding API key are set. If the port is in use, find and kill the existing process or specify a different port. ```bash # Check provider is configured echo $MODEL_PROVIDER echo $DATABRICKS_API_KEY # or other provider key # If empty, set them: export MODEL_PROVIDER=databricks export DATABRICKS_API_KEY=your-key ``` ```bash # Find process using port 8081 lsof -i :8081 # Kill the process kill -9 # Or use different port export PORT=8082 lynkr start ``` -------------------------------- ### Install and Build llama.cpp Source: https://github.com/fast-editor/lynkr/blob/main/documentation/embeddings.md Clone the llama.cpp repository and build it. Optional GPU support can be enabled during the build process. ```bash # 1. Clone and build llama.cpp git clone https://github.com/ggerganov/llama.cpp cd llama.cpp # Build with GPU support (optional): # For CUDA (NVIDIA): make LLAMA_CUDA=1 # For Metal (Apple Silicon): make LLAMA_METAL=1 # For CPU only: make make # 2. Download embedding model (GGUF format) # Example: nomic-embed-text GGUF wget https://huggingface.co/nomic-ai/nomic-embed-text-v1.5-GGUF/resolve/main/nomic-embed-text-v1.5.Q4_K_M.gguf # 3. Start llama-server with embedding model ./llama-server \ -m nomic-embed-text-v1.5.Q4_K_M.gguf \ --port 8080 \ --embedding # 4. Verify server is running curl http://localhost:8080/health # Should return: {"status":"ok"} ``` -------------------------------- ### Health Check Integration Example Source: https://github.com/fast-editor/lynkr/blob/main/documentation/headroom.md Example JSON response from the /health/ready endpoint, showing Headroom status within overall system health. ```json { "status": "ready", "checks": { "database": { "healthy": true }, "memory": { "healthy": true }, "headroom": { "healthy": true, "enabled": true, "service": "available", "docker": "running" } } } ``` -------------------------------- ### Install MLX OpenAI Server and Dependencies Source: https://github.com/fast-editor/lynkr/blob/main/documentation/providers.md Installs the MLX OpenAI Server using pip and optionally installs ffmpeg for audio transcription support via Homebrew. ```bash # Create virtual environment python3.11 -m venv .venv source .venv/bin/activate # Install pip install mlx-openai-server # Optional: for audio transcription brew install ffmpeg ``` -------------------------------- ### Click-to-Copy Install Command Source: https://github.com/fast-editor/lynkr/blob/main/docs/index.html JavaScript code for a click-to-copy functionality for the install command. It listens for clicks on an element with the ID 'install-cmd' and copies 'npm install -g lynkr' to the clipboard, providing visual feedback. ```javascript // Click-to-copy install command const installEl = document.getElementById('install-cmd'); const copyHint = document.getElementById('copy-hint'); if (installEl) { const copy = () => { navigator.clipboard.writeText('npm install -g lynkr').then(() => { copyHint.textContent = 'copied!'; copyHint.classList.add('copied'); setTimeout(() => { copyHint.textContent = 'click to copy'; copyHint.classList.remove('copied'); }, 2000); }); }; installEl.addEventListener('click', copy); installEl.addEventListener('keydown', e => { if (e.key === 'Enter' || e.key === ' ') copy(); }); } ``` -------------------------------- ### Minimal Ollama Setup for Lynkr Source: https://github.com/fast-editor/lynkr/blob/main/README.md A copy-paste ready .env configuration for a minimal working setup using Ollama. This includes required provider, Ollama, server, and compatibility settings, along with recommended performance options. ```bash # .env - Minimal Ollama Setup # ============================================ # REQUIRED: Provider Configuration # ============================================ MODEL_PROVIDER=ollama FALLBACK_ENABLED=false # ============================================ # REQUIRED: Ollama Settings # ============================================ OLLAMA_ENDPOINT=http://localhost:11434 OLLAMA_MODEL=qwen2.5-coder:latest # ============================================ # REQUIRED: Server Configuration # ============================================ PORT=8081 HOST=0.0.0.0 # ============================================ # REQUIRED: Claude Code/Cursor Compatibility # ============================================ POLICY_MAX_STEPS=50 POLICY_MAX_TOOL_CALLS=100 POLICY_SAFE_COMMANDS_ENABLED=false # ============================================ # OPTIONAL: Performance (Recommended) # ============================================ LOG_LEVEL=warn LOAD_SHEDDING_ENABLED=true LOAD_SHEDDING_HEAP_THRESHOLD=0.85 ``` -------------------------------- ### Azure OpenAI Full Endpoint URL Example Source: https://github.com/fast-editor/lynkr/blob/main/documentation/providers.md Provides an example of the required full endpoint URL format for Azure OpenAI, including resource name, deployment path, and API version. ```text https://your-resource.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2025-01-01-preview ``` -------------------------------- ### Multi-line Prompt Example Source: https://github.com/fast-editor/lynkr/blob/main/documentation/claude-code-cli.md Demonstrates how to use the Claude CLI for complex, multi-line prompts, such as generating a function with specific requirements. ```bash claude "Write a function that: - Takes an array of numbers - Filters out even numbers - Returns the sum of odd numbers" ``` -------------------------------- ### Example MCP Tool Usage Source: https://github.com/fast-editor/lynkr/blob/main/documentation/tools.md This JSON object shows how to invoke an MCP tool with its input parameters. ```json { "name": "my-custom-tool", "input": { "input": "test value" } } ``` -------------------------------- ### Install NVIDIA Container Toolkit Source: https://github.com/fast-editor/lynkr/blob/main/documentation/docker.md Installs the NVIDIA Container Toolkit on Ubuntu/Debian systems. This is a prerequisite for enabling GPU support in Docker containers. ```bash # Ubuntu/Debian distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \ sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get update sudo apt-get install -y nvidia-container-toolkit sudo systemctl restart docker ``` -------------------------------- ### Hybrid Setup: Ollama for Local Embeddings and Tiered Chat Source: https://github.com/fast-editor/lynkr/blob/main/documentation/cursor-integration.md Configure a hybrid setup using Ollama for local, private embeddings and tier-based routing for chat. This balances cost and performance by using local models for simple requests and cloud for complex ones. ```bash # Chat: Tier-based routing (set all 4 to enable) TIER_SIMPLE=ollama:llama3.2 TIER_MEDIUM=openrouter:openai/gpt-4o-mini TIER_COMPLEX=databricks:databricks-claude-sonnet-4-5 TIER_REASONING=databricks:databricks-claude-sonnet-4-5 FALLBACK_ENABLED=true FALLBACK_PROVIDER=databricks DATABRICKS_API_BASE=https://your-workspace.databricks.com DATABRICKS_API_KEY=your-key # Embeddings: Ollama (local, private) OLLAMA_EMBEDDINGS_MODEL=nomic-embed-text # Cost: Mostly FREE (Ollama handles 70-80% of simple requests) # Only complex/reasoning requests go to Databricks ``` -------------------------------- ### Start Lynkr Services with Docker Compose Source: https://github.com/fast-editor/lynkr/blob/main/documentation/docker.md Start all defined services in the docker-compose.yml file in detached mode. This is the recommended way to run Lynkr. ```bash docker-compose up -d ``` -------------------------------- ### Start Lynkr Proxy and Connect Claude Code CLI Source: https://github.com/fast-editor/lynkr/blob/main/docs/index.md Start the Lynkr proxy server and then configure the Claude Code CLI to use the local proxy. This allows your CLI tools to communicate through Lynkr. ```bash # Start the proxy server npm start # → Running at http://localhost:8081 # Connect Claude Code CLI export ANTHROPIC_BASE_URL=http://localhost:8081 export ANTHROPIC_API_KEY=dummy claude ``` -------------------------------- ### Installing Lynkr Dependencies Source: https://github.com/fast-editor/lynkr/blob/main/documentation/faq.md Install project dependencies using npm. The --force flag can be used if necessary, but it's generally recommended to resolve dependency conflicts directly. ```bash npm install # Or: npm install -g lynkr --force ``` -------------------------------- ### Create File with Claude CLI Source: https://github.com/fast-editor/lynkr/blob/main/documentation/claude-code-cli.md Instruct the Claude CLI to create a new file, such as a server setup. ```bash # Create file claude "Create a new Express server in server.js" ``` -------------------------------- ### Run Lynkr in Development Mode Source: https://github.com/fast-editor/lynkr/blob/main/documentation/contributing.md Commands to start Lynkr in development mode, with options for auto-restart or normal execution. ```bash # Auto-restart on file changes npm run dev # Or normal mode npm start ``` -------------------------------- ### Build and Run llama.cpp Server Source: https://github.com/fast-editor/lynkr/blob/main/documentation/providers.md Clones the llama.cpp repository, builds the server, downloads a GGUF model, and starts the local server. ```bash # Clone and build llama.cpp git clone https://github.com/ggerganov/llama.cpp cd llama.cpp && make # Download a GGUF model (example: Qwen2.5-Coder-7B-Instruct-GGUF) wget https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/main/qwen2.5-coder-7b-instruct-q4_k_m.gguf # Start llama-server ./llama-server -m qwen2.5-coder-7b-instruct-q4_k_m.gguf --port 8080 # Verify server is running curl http://localhost:8080/health ``` -------------------------------- ### Start MLX OpenAI Server with a General Purpose Model Source: https://github.com/fast-editor/lynkr/blob/main/documentation/providers.md Launches the MLX OpenAI Server using a general-purpose model. ```bash # General purpose mlx-openai-server launch --model-path mlx-community/Qwen2.5-3B-Instruct-4bit --model-type lm ``` -------------------------------- ### Test Lynkr with Claude Code Source: https://github.com/fast-editor/lynkr/blob/main/INSTALL.md Verify the installation by sending a simple prompt to Lynkr via the Claude CLI. ```bash export ANTHROPIC_BASE_URL=http://localhost:8081 export ANTHROPIC_API_KEY=dummy claude "say hello" ``` -------------------------------- ### Configure Provider Credentials Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Troubleshoot server startup issues by ensuring provider credentials are set. ```bash # Check your provider is configured echo $MODEL_PROVIDER echo $DATABRICKS_API_KEY # or other provider key # If empty, set them: export MODEL_PROVIDER=databricks export DATABRICKS_API_KEY=your-key ``` -------------------------------- ### Visual Setup Summary for Cursor Source: https://github.com/fast-editor/lynkr/blob/main/documentation/cursor-integration.md A visual representation of the required settings in Cursor IDE for OpenAI API integration with Lynkr. ```text ┌─────────────────────────────────────────────────────────┐ │ Cursor Settings → Models → OpenAI API │ ├─────────────────────────────────────────────────────────┤ │ │ │ API Key: sk-lynkr │ │ (or any non-empty value) │ │ │ │ Base URL: http://localhost:8081/v1 │ │ ⚠️ Must include /v1 │ │ │ │ Model: claude-3.5-sonnet │ │ (or your provider's model) │ │ │ └─────────────────────────────────────────────────────────┘ ``` -------------------------------- ### Basic Chat Example Source: https://github.com/fast-editor/lynkr/blob/main/documentation/claude-code-cli.md Send a simple text prompt to Claude Code CLI to get a response. This demonstrates basic conversational functionality. ```bash # Simple question claude "Explain async/await in JavaScript" ``` -------------------------------- ### Ollama Configuration for 100% Local Setup Source: https://github.com/fast-editor/lynkr/blob/main/documentation/cursor-integration.md Use this configuration for maximum privacy and cost savings, running all models and embeddings locally. Ensure Ollama and the specified models are installed. ```env MODEL_PROVIDER=ollama OLLAMA_MODEL=llama3.1:8b OLLAMA_EMBEDDINGS_MODEL=nomic-embed-text ``` -------------------------------- ### Route53 Latency-Based Routing Configuration Source: https://github.com/fast-editor/lynkr/blob/main/DEPLOYMENT.md Configure AWS Route53 for latency-based multi-region deployment. This example shows a basic A record setup pointing to regional ALBs with health checks enabled. ```yaml # Route53 configuration (AWS) Type: A Name: lynkr.example.com Value: - us-east-1-alb.example.com - eu-west-1-alb.example.com Routing Policy: Latency-based Health Check: Enabled ``` -------------------------------- ### Quick Start with Docker Compose Source: https://github.com/fast-editor/lynkr/blob/main/DEPLOYMENT.md The fastest way to deploy Lynkr in production using Docker Compose. Includes cloning, configuration, and verification steps. ```bash # 1. Clone and configure git clone https://github.com/Fast-Editor/Lynkr.git cd Lynkr cp .env.example .env # Edit .env with your credentials # 2. Deploy with Docker Compose (recommended for most users) docker compose up -d # 3. Verify health curl http://localhost:8080/health ``` -------------------------------- ### Verify Lynkr Installation Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Check if the Lynkr installation was successful by running the version command. This should be done after installing via NPM or Homebrew. ```bash lynkr --version ``` -------------------------------- ### Verify Graphify Installation Source: https://github.com/fast-editor/lynkr/blob/main/README.md Verify that the Graphify tool has been installed correctly by checking its version. ```bash graphify --version ``` -------------------------------- ### Install Node.js Dependencies Source: https://github.com/fast-editor/lynkr/blob/main/DEPLOYMENT.md Installs production dependencies for the Lynkr project using npm. ```bash npm ci --omit=dev ``` -------------------------------- ### Install Node.js on macOS Source: https://github.com/fast-editor/lynkr/blob/main/INSTALL.md Use Homebrew to install Node.js version 20 or higher on macOS. ```bash brew install node ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/fast-editor/lynkr/blob/main/documentation/docker.md Copy the example environment file and edit it with your provider credentials. This file is essential for configuring Lynkr's behavior. ```bash cp .env.example .env # Edit .env with your provider credentials ``` -------------------------------- ### Complete Kubernetes Deployment Example Source: https://github.com/fast-editor/lynkr/blob/main/PERFORMANCE-REPORT.md A comprehensive YAML definition for deploying the Lynkr application, including resource requests, limits, probes, and environment variables. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: lynkr namespace: lynkr labels: app: lynkr version: v1.0.0 spec: replicas: 3 strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 0 selector: matchLabels: app: lynkr template: metadata: labels: app: lynkr version: v1.0.0 annotations: prometheus.io/scrape: "true" prometheus.io/port: "8080" prometheus.io/path: "/metrics/prometheus" spec: containers: - name: lynkr image: your-registry.com/lynkr:v1.0.0 ports: - containerPort: 8080 name: http protocol: TCP env: - name: PORT value: "8080" - name: MODEL_PROVIDER value: "databricks" - name: DATABRICKS_API_BASE valueFrom: secretKeyRef: name: lynkr-secrets key: DATABRICKS_API_BASE - name: DATABRICKS_API_KEY valueFrom: secretKeyRef: name: lynkr-secrets key: DATABRICKS_API_KEY - name: PROMPT_CACHE_ENABLED value: "true" - name: METRICS_ENABLED value: "true" - name: HEALTH_CHECK_ENABLED value: "true" - name: GRACEFUL_SHUTDOWN_TIMEOUT value: "30000" - name: LOAD_SHEDDING_HEAP_THRESHOLD value: "0.90" - name: CIRCUIT_BREAKER_FAILURE_THRESHOLD value: "5" resources: requests: cpu: 500m memory: 512Mi limits: cpu: 2000m memory: 2Gi livenessProbe: httpGet: path: /health/live port: 8080 initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 3 readinessProbe: httpGet: path: /health/ready port: 8080 initialDelaySeconds: 5 periodSeconds: 5 timeoutSeconds: 3 failureThreshold: 2 lifecycle: preStop: exec: command: - /bin/sh - -c - sleep 15 terminationGracePeriodSeconds: 45 --- apiVersion: v1 kind: Service metadata: name: lynkr namespace: lynkr labels: app: lynkr spec: type: ClusterIP ports: - port: 8080 targetPort: 8080 protocol: TCP name: http selector: app: lynkr --- apiVersion: v1 kind: Service metadata: name: lynkr-metrics namespace: lynkr labels: app: lynkr spec: type: ClusterIP ports: - port: 8080 targetPort: 8080 protocol: TCP name: metrics selector: app: lynkr ``` -------------------------------- ### Install Ollama on macOS/Linux Source: https://github.com/fast-editor/lynkr/blob/main/INSTALL.md Install Ollama using the provided curl script for macOS and Linux systems. ```bash # macOS/Linux curl -fsSL https://ollama.com/install.sh | sh ``` -------------------------------- ### Configure Lynkr with Environment Variables Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Set up Lynkr by exporting environment variables for your chosen model provider. This is a quick way to configure before starting the server. ```bash export MODEL_PROVIDER=databricks export DATABRICKS_API_BASE=https://your-workspace.databricks.com export DATABRICKS_API_KEY=your-key lynkr start ``` -------------------------------- ### Start Docker Compose Services Source: https://github.com/fast-editor/lynkr/blob/main/documentation/docker.md Command to start all services defined in the docker-compose.yml file in detached mode. ```bash # Start services docker-compose up -d ``` -------------------------------- ### Example MCP Server Configuration Source: https://github.com/fast-editor/lynkr/blob/main/documentation/tools.md This JSON object defines a custom MCP tool, including its name, description, and input schema. ```json { "name": "my-custom-tool", "description": "Does something useful", "inputSchema": { "type": "object", "properties": { "input": { "type": "string", "description": "Input parameter" } }, "required": ["input"] } } ``` -------------------------------- ### Start Ollama and Pull Model Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Starts the Ollama service and pulls the specified model, preparing it for local use. ```bash ollama serve ollama pull llama3.2 ``` -------------------------------- ### Project Context Example Source: https://github.com/fast-editor/lynkr/blob/main/documentation/memory-system.md Demonstrates how project-specific facts, like API port numbers, are stored and injected into relevant conversations to provide context. ```text User: "This API uses port 3000" System: [Stores: fact, importance 0.75] Later... User: "How do I test the API?" System: [Injects: "API uses port 3000"] Assistant: "curl http://localhost:3000/endpoint" ``` -------------------------------- ### Code Explanation Example Source: https://github.com/fast-editor/lynkr/blob/main/documentation/claude-code-cli.md Provide a code file as input to Claude Code CLI for explanation. This utilizes the file reading capabilities. ```bash # Code explanation claude "Explain this function" < app.js ``` -------------------------------- ### Start Lynkr Gateway Source: https://github.com/fast-editor/lynkr/blob/main/docs/index.html Start the Lynkr gateway to enable connections from AI tools. The gateway listens on http://localhost:8081 by default. ```bash # Start the gateway $ npm start # → http://localhost:8081 ``` -------------------------------- ### Docker Compose High Availability: Load Balancer Example Source: https://github.com/fast-editor/lynkr/blob/main/documentation/docker.md Example of configuring an Nginx load balancer that depends on the Lynkr service. ```yaml services: nginx: image: nginx:alpine ports: - "80:80" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro depends_on: - lynkr ``` -------------------------------- ### MCP Code Mode Example Workflow Source: https://github.com/fast-editor/lynkr/blob/main/documentation/token-optimization.md Demonstrates a typical interaction flow using MCP Code Mode, involving listing tools, inspecting a specific tool's schema, and executing it. This workflow replaces sending all tool schemas with a few meta-tools. ```json Turn 1: mcp_list_tools({ server_id: "github" }) → Returns: ["create_issue", "list_prs", "merge_pr", ...] Turn 2: mcp_tool_info({ server_id: "github", tool_name: "create_issue" }) → Returns: { inputSchema: { title: string, body: string, ... } } Turn 3: mcp_execute({ server_id: "github", tool_name: "create_issue", arguments: { title: "Bug", body: "..." } }) ``` -------------------------------- ### Node.js SDK Example: Non-streaming and Streaming Source: https://github.com/fast-editor/lynkr/blob/main/documentation/api.md Examples using the Anthropic Node.js SDK to make non-streaming and streaming message requests. ```javascript import Anthropic from "@anthropic-ai/sdk"; const client = new Anthropic({ apiKey: "dummy", // Any value works baseURL: "http://localhost:8081" }); // Non-streaming const message = await client.messages.create({ model: "claude-3-5-sonnet-20241022", max_tokens: 1024, messages: [ { role: "user", content: "What is the capital of France?" } ] }); console.log(message.content[0].text); // Streaming const stream = await client.messages.create({ model: "claude-3-5-sonnet-20241022", max_tokens: 1024, messages: [ { role: "user", content: "Tell me a story" } ], stream: true }); for await (const event of stream) { if (event.type === "content_block_delta") { process.stdout.write(event.delta.text); } } ``` -------------------------------- ### Start MLX OpenAI Server with Advanced Options Source: https://github.com/fast-editor/lynkr/blob/main/documentation/providers.md Launches the MLX OpenAI Server with specific configurations for host, port, concurrency, and context length to allow remote connections and optimize performance. ```bash mlx-openai-server launch \ --model-path mlx-community/Qwen2.5-Coder-7B-Instruct-4bit \ --model-type lm \ --host 0.0.0.0 \ --port 8000 \ --max-concurrency 2 \ --context-length 4096 ``` -------------------------------- ### Clone Lynkr Repository and Install Dependencies Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Clone the Lynkr repository from GitHub for development purposes. Install project dependencies using npm. ```bash git clone https://github.com/Fast-Editor/Lynkr.git cd Lynkr npm install ``` -------------------------------- ### Build llama.cpp and Download GGUF Model Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Clone the llama.cpp repository, build the project, and download a GGUF model file. This setup is for maximum performance and control with custom models. ```bash # Install and build llama.cpp git clone https://github.com/ggerganov/llama.cpp cd llama.cpp && make # Download a GGUF model wget https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/main/qwen2.5-coder-7b-instruct-q4_k_m.gguf ``` -------------------------------- ### Python SDK Example: Non-streaming and Streaming Source: https://github.com/fast-editor/lynkr/blob/main/documentation/api.md Examples using the OpenAI Python SDK to make non-streaming and streaming chat completion requests. ```python from openai import OpenAI client = OpenAI( api_key="sk-lynkr", base_url="http://localhost:8081/v1" ) # Non-streaming response = client.chat.completions.create( model="claude-3.5-sonnet", messages=[ {"role": "user", "content": "What is the capital of France?"} ], max_tokens=1024 ) print(response.choices[0].message.content) # Streaming stream = client.chat.completions.create( model="claude-3.5-sonnet", messages=[ {"role": "user", "content": "Tell me a story"} ], max_tokens=1024, stream=True ) for chunk in stream: if chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="") ``` -------------------------------- ### Navigation and Initialization Source: https://github.com/fast-editor/lynkr/blob/main/public/dashboard.html Handles navigation based on URL hash changes and initializes the application. The application navigates to the route specified by the hash or defaults to 'overview'. ```javascript window.addEventListener('hashchange', () => App.navigate(location.hash.slice(1) || 'overview')); App.init(); ``` -------------------------------- ### Test Edge Cases Example Source: https://github.com/fast-editor/lynkr/blob/main/documentation/testing.md Provides examples of testing edge cases in JavaScript, including handling empty arrays, null input, and negative numbers. ```javascript it("should handle empty array", () => { assert.strictEqual(calculateTotal([]), 0); }); it("should handle null input", () => { assert.throws(() => calculateTotal(null)); }); it("should handle negative numbers", () => { assert.strictEqual(calculateTotal([-1, -2]), -3); }); ``` -------------------------------- ### Custom Directory Install Lynkr via Script Source: https://github.com/fast-editor/lynkr/blob/main/documentation/installation.md Install Lynkr using the curl script to a custom directory. Specify the desired path using the --dir flag. ```bash curl -fsSL https://raw.githubusercontent.com/Fast-Editor/Lynkr/main/install.sh | bash -s -- --dir /opt/lynkr ``` -------------------------------- ### Configure Tier Routing for Cost Optimization Source: https://github.com/fast-editor/lynkr/blob/main/README.md Set up environment variables in a .env file to define different AI model tiers for various task complexities. This allows Lynkr to use cheaper models for simple tasks and more powerful models for complex ones, saving costs. ```bash # .env file MODEL_PROVIDER=ollama FALLBACK_ENABLED=false # Use small/fast models for simple tasks TIER_SIMPLE=ollama:qwen2.5:3b # Use medium models for normal coding TIER_MEDIUM=ollama:qwen2.5:7b # Use powerful models for complex architecture TIER_COMPLEX=ollama:deepseek-r1:14b TIER_REASONING=ollama:deepseek-r1:14b # Optional: Limits (remove for unlimited) for long conversations POLICY_MAX_STEPS=50 POLICY_MAX_TOOL_CALLS=100 ``` -------------------------------- ### Local LLM Setup with Ollama Source: https://github.com/fast-editor/lynkr/blob/main/docs/index.md Configure Lynkr to use a local LLM provider like Ollama. Ensure Ollama is running and the specified model is available. ```bash export MODEL_PROVIDER=ollama export OLLAMA_MODEL=qwen2.5-coder:latest ```