lynkr 3.2.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +770 -25
- package/ROUTER_COMPARISON.md +173 -0
- package/TIER_ROUTING_PLAN.md +771 -0
- package/docs/GSD_LEARNINGS.md +1116 -0
- package/docs/LOCAL_EMBEDDINGS_PLAN.md +1024 -0
- package/docs/index.md +49 -5
- package/final-test.js +33 -0
- package/package.json +2 -2
- package/src/api/openai-router.js +755 -0
- package/src/api/router.js +4 -0
- package/src/clients/bedrock-utils.js +298 -0
- package/src/clients/databricks.js +265 -0
- package/src/clients/databricks.js.backup +1036 -0
- package/src/clients/openai-format.js +393 -0
- package/src/clients/routing.js +12 -0
- package/src/config/index.js +55 -3
- package/src/orchestrator/index.js +8 -1
- package/src/tools/smart-selection.js +1 -1
- package/test/bedrock-integration.test.js +471 -0
- package/test/cursor-integration.test.js +484 -0
- package/test/llamacpp-integration.test.js +13 -34
- package/test/lmstudio-integration.test.js +335 -0
package/README.md
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
# Lynkr -
|
|
1
|
+
# Lynkr - Claude Code Proxy with Multi-Provider Support, MCP Integration & Token Optimization
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/lynkr "Lynkr NPM Package - Claude Code Proxy Server")
|
|
4
4
|
[](https://github.com/vishalveerareddy123/homebrew-lynkr "Install Lynkr via Homebrew")
|
|
5
5
|
[](LICENSE "Apache 2.0 License - Open Source Claude Code Alternative")
|
|
6
6
|
[](https://deepwiki.com/vishalveerareddy123/Lynkr "Lynkr Documentation on DeepWiki")
|
|
7
7
|
[](https://www.databricks.com/ "Databricks Claude Integration")
|
|
8
|
+
[](https://aws.amazon.com/bedrock/ "AWS Bedrock - 100+ Models")
|
|
8
9
|
[](https://openai.com/ "OpenAI GPT Integration")
|
|
9
10
|
[](https://ollama.ai/ "Local Ollama Model Support")
|
|
10
11
|
[](https://github.com/ggerganov/llama.cpp "llama.cpp GGUF Model Support")
|
|
11
12
|
[](https://www.indexnow.org/ "SEO Optimized with IndexNow")
|
|
12
13
|
[](https://devhunt.org/tool/lynkr "Lynkr on DevHunt")
|
|
13
14
|
|
|
14
|
-
> **
|
|
15
|
+
> ** Claude Code proxy server supporting Databricks, AWS Bedrock (100+ models), OpenRouter, Ollama & Azure. Features MCP integration, prompt caching & 60-80% token optimization savings.**
|
|
15
16
|
|
|
16
17
|
## 🔖 Keywords
|
|
17
18
|
|
|
18
|
-
`claude-code` `claude-proxy` `anthropic-api` `databricks-llm` `openrouter-integration` `ollama-local` `llama-cpp` `azure-openai` `azure-anthropic` `mcp-server` `prompt-caching` `token-optimization` `ai-coding-assistant` `llm-proxy` `self-hosted-ai` `git-automation` `code-generation` `developer-tools` `ci-cd-automation` `llm-gateway` `cost-reduction` `multi-provider-llm`
|
|
19
|
+
`claude-code` `claude-proxy` `anthropic-api` `databricks-llm` `aws-bedrock` `bedrock-models` `deepseek-r1` `qwen3-coder` `openrouter-integration` `ollama-local` `llama-cpp` `azure-openai` `azure-anthropic` `mcp-server` `prompt-caching` `token-optimization` `ai-coding-assistant` `llm-proxy` `self-hosted-ai` `git-automation` `code-generation` `developer-tools` `ci-cd-automation` `llm-gateway` `cost-reduction` `multi-provider-llm`
|
|
19
20
|
|
|
20
21
|
---
|
|
21
22
|
|
|
@@ -68,7 +69,7 @@ Claude Code CLI is locked to Anthropic's API, limiting your choice of LLM provid
|
|
|
68
69
|
### The Solution
|
|
69
70
|
Lynkr is a **production-ready proxy server** that unlocks Claude Code CLI's full potential:
|
|
70
71
|
|
|
71
|
-
- ✅ **Any LLM Provider** - [Databricks, OpenRouter (100+ models), Ollama (local), Azure, OpenAI, llama.cpp](#supported-ai-model-providers-databricks-openrouter-ollama-azure-llamacpp)
|
|
72
|
+
- ✅ **Any LLM Provider** - [Databricks, AWS Bedrock (100+ models), OpenRouter (100+ models), Ollama (local), Azure, OpenAI, llama.cpp](#supported-ai-model-providers-databricks-aws-bedrock-openrouter-ollama-azure-llamacpp)
|
|
72
73
|
- ✅ **60-80% Cost Reduction** - Built-in [token optimization](#token-optimization-implementation) (5 optimization phases implemented)
|
|
73
74
|
- ✅ **Zero Code Changes** - [Drop-in replacement](#connecting-claude-code-cli) for Anthropic backend
|
|
74
75
|
- ✅ **Local & Offline** - Run Claude Code with [Ollama](#using-ollama-models) or [llama.cpp](#using-llamacpp-with-lynkr) (no internet required)
|
|
@@ -94,11 +95,17 @@ npm install -g lynkr
|
|
|
94
95
|
|
|
95
96
|
### 2️⃣ Configure Your Provider
|
|
96
97
|
```bash
|
|
97
|
-
# Option A: Use
|
|
98
|
+
# Option A: Use AWS Bedrock (100+ models) 🆕
|
|
99
|
+
export MODEL_PROVIDER=bedrock
|
|
100
|
+
export AWS_BEDROCK_API_KEY=your-bearer-token
|
|
101
|
+
export AWS_BEDROCK_REGION=us-east-2
|
|
102
|
+
export AWS_BEDROCK_MODEL_ID=us.anthropic.claude-sonnet-4-5-20250929-v1:0
|
|
103
|
+
|
|
104
|
+
# Option B: Use local Ollama (free, offline)
|
|
98
105
|
export MODEL_PROVIDER=ollama
|
|
99
106
|
export OLLAMA_MODEL=llama3.1:8b
|
|
100
107
|
|
|
101
|
-
# Option
|
|
108
|
+
# Option C: Use Databricks (production)
|
|
102
109
|
export MODEL_PROVIDER=databricks
|
|
103
110
|
export DATABRICKS_API_BASE=https://your-workspace.databricks.net
|
|
104
111
|
export DATABRICKS_API_KEY=your-api-key
|
|
@@ -160,7 +167,7 @@ Further documentation and usage notes are available on [DeepWiki](https://deepwi
|
|
|
160
167
|
|
|
161
168
|
---
|
|
162
169
|
|
|
163
|
-
## Supported AI Model Providers (Databricks, OpenRouter, Ollama, Azure, llama.cpp)
|
|
170
|
+
## Supported AI Model Providers (Databricks, AWS Bedrock, OpenRouter, Ollama, Azure, llama.cpp)
|
|
164
171
|
|
|
165
172
|
Lynkr supports multiple AI model providers, giving you flexibility in choosing the right model for your needs:
|
|
166
173
|
|
|
@@ -169,6 +176,7 @@ Lynkr supports multiple AI model providers, giving you flexibility in choosing t
|
|
|
169
176
|
| Provider | Configuration | Models Available | Best For |
|
|
170
177
|
|----------|--------------|------------------|----------|
|
|
171
178
|
| **Databricks** (Default) | `MODEL_PROVIDER=databricks` | Claude Sonnet 4.5, Claude Opus 4.5 | Production use, enterprise deployment |
|
|
179
|
+
| **AWS Bedrock** 🆕 | `MODEL_PROVIDER=bedrock` | 100+ models (Claude, DeepSeek R1, Qwen3, Nova, Titan, Llama, Mistral, etc.) | AWS ecosystem, multi-model flexibility, Claude + alternatives |
|
|
172
180
|
| **OpenAI** | `MODEL_PROVIDER=openai` | GPT-5, GPT-5.2, GPT-4o, GPT-4o-mini, GPT-4-turbo, o1, o1-mini | Direct OpenAI API access |
|
|
173
181
|
| **Azure OpenAI** | `MODEL_PROVIDER=azure-openai` | GPT-5, GPT-5.2,GPT-4o, GPT-4o-mini, GPT-5, o1, o3, Kimi-K2 | Azure integration, Microsoft ecosystem |
|
|
174
182
|
| **Azure Anthropic** | `MODEL_PROVIDER=azure-anthropic` | Claude Sonnet 4.5, Claude Opus 4.5 | Azure-hosted Claude models |
|
|
@@ -204,6 +212,44 @@ When using `MODEL_PROVIDER=azure-openai`, you can deploy any of the models in az
|
|
|
204
212
|
|
|
205
213
|
**Note**: Azure OpenAI deployment names are configurable via `AZURE_OPENAI_DEPLOYMENT` environment variable.
|
|
206
214
|
|
|
215
|
+
### **AWS Bedrock Model Catalog (100+ Models)**
|
|
216
|
+
|
|
217
|
+
When using `MODEL_PROVIDER=bedrock`, you have access to **nearly 100 models** via AWS Bedrock's unified Converse API:
|
|
218
|
+
|
|
219
|
+
#### **🆕 NEW Models (2025-2026)**
|
|
220
|
+
- **DeepSeek R1** - `us.deepseek.r1-v1:0` - Reasoning model (o1-style)
|
|
221
|
+
- **Qwen3** - `qwen.qwen3-235b-*`, `qwen.qwen3-coder-480b-*` - Up to 480B parameters!
|
|
222
|
+
- **OpenAI GPT-OSS** - `openai.gpt-oss-120b-1:0` - Open-weight GPT models
|
|
223
|
+
- **Google Gemma 3** - `google.gemma-3-27b` - Open-weight from Google
|
|
224
|
+
- **MiniMax M2** - `minimax.m2-v1:0` - Chinese AI company
|
|
225
|
+
|
|
226
|
+
#### **Claude Models (Best for Tool Calling)**
|
|
227
|
+
- **Claude 4.5** - `us.anthropic.claude-sonnet-4-5-*` - Best for coding with tools
|
|
228
|
+
- **Claude 3.5** - `anthropic.claude-3-5-sonnet-*` - Excellent tool calling
|
|
229
|
+
- **Claude 3 Haiku** - `anthropic.claude-3-haiku-*` - Fast and cost-effective
|
|
230
|
+
|
|
231
|
+
#### **Amazon Models**
|
|
232
|
+
- **Nova** - `us.amazon.nova-pro-v1:0` - Multimodal, 300K context
|
|
233
|
+
- **Titan** - `amazon.titan-text-express-v1` - General purpose
|
|
234
|
+
|
|
235
|
+
#### **Other Major Models**
|
|
236
|
+
- **Meta Llama** - `meta.llama3-1-70b-*` - Open-source Llama 3.1
|
|
237
|
+
- **Mistral** - `mistral.mistral-large-*` - Coding, multilingual
|
|
238
|
+
- **Cohere** - `cohere.command-r-plus-v1:0` - RAG, search
|
|
239
|
+
- **AI21 Jamba** - `ai21.jamba-1-5-large-v1:0` - 256K context
|
|
240
|
+
|
|
241
|
+
#### **Quick Setup**
|
|
242
|
+
```bash
|
|
243
|
+
export MODEL_PROVIDER=bedrock
|
|
244
|
+
export AWS_BEDROCK_API_KEY=your-bearer-token # Get from AWS Console → Bedrock → API Keys
|
|
245
|
+
export AWS_BEDROCK_REGION=us-east-2
|
|
246
|
+
export AWS_BEDROCK_MODEL_ID=us.anthropic.claude-sonnet-4-5-20250929-v1:0
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
📖 **Full Documentation**: See [BEDROCK_MODELS.md](BEDROCK_MODELS.md) for complete model catalog, pricing, capabilities, and use cases.
|
|
250
|
+
|
|
251
|
+
⚠️ **Tool Calling Note**: Only **Claude models** support tool calling on Bedrock. Other models work via Converse API but won't use Read/Write/Bash tools.
|
|
252
|
+
|
|
207
253
|
### **Ollama Model Recommendations**
|
|
208
254
|
|
|
209
255
|
For tool calling support (required for Claude Code CLI functionality):
|
|
@@ -241,16 +287,19 @@ FALLBACK_PROVIDER=databricks # or azure-openai, openrouter, azure-anthropic
|
|
|
241
287
|
|
|
242
288
|
### **Provider Comparison**
|
|
243
289
|
|
|
244
|
-
| Feature | Databricks | OpenAI | Azure OpenAI | Azure Anthropic | OpenRouter | Ollama | llama.cpp |
|
|
245
|
-
|
|
246
|
-
| **Setup Complexity** | Medium | Easy | Medium | Medium | Easy | Easy | Medium |
|
|
247
|
-
| **Cost** | $$$ | $$ | $$ | $$$ | $ | Free | Free |
|
|
248
|
-
| **Latency** | Low | Low | Low | Low | Medium | Very Low | Very Low |
|
|
249
|
-
| **
|
|
250
|
-
| **
|
|
251
|
-
| **
|
|
252
|
-
| **
|
|
253
|
-
| **
|
|
290
|
+
| Feature | Databricks | AWS Bedrock | OpenAI | Azure OpenAI | Azure Anthropic | OpenRouter | Ollama | llama.cpp |
|
|
291
|
+
|---------|-----------|-------------|--------|--------------|-----------------|------------|--------|-----------|
|
|
292
|
+
| **Setup Complexity** | Medium | Easy | Easy | Medium | Medium | Easy | Easy | Medium |
|
|
293
|
+
| **Cost** | $$$ | $$ | $$ | $$ | $$$ | $ | Free | Free |
|
|
294
|
+
| **Latency** | Low | Low | Low | Low | Low | Medium | Very Low | Very Low |
|
|
295
|
+
| **Model Variety** | 2 | 100+ | 10+ | 10+ | 2 | 100+ | 50+ | Unlimited |
|
|
296
|
+
| **Tool Calling** | Excellent | Excellent* | Excellent | Excellent | Excellent | Good | Fair | Good |
|
|
297
|
+
| **Context Length** | 200K | Up to 300K | 128K | 128K | 200K | Varies | 32K-128K | Model-dependent |
|
|
298
|
+
| **Streaming** | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
|
|
299
|
+
| **Privacy** | Enterprise | Enterprise | Third-party | Enterprise | Enterprise | Third-party | Local | Local |
|
|
300
|
+
| **Offline** | No | No | No | No | No | No | Yes | Yes |
|
|
301
|
+
|
|
302
|
+
_* Tool calling only supported by Claude models on Bedrock_
|
|
254
303
|
|
|
255
304
|
---
|
|
256
305
|
|
|
@@ -1763,6 +1812,649 @@ If performance is degraded:
|
|
|
1763
1812
|
|
|
1764
1813
|
---
|
|
1765
1814
|
|
|
1815
|
+
## Cursor IDE Integration (OpenAI API Compatibility)
|
|
1816
|
+
|
|
1817
|
+
Lynkr provides **full Cursor IDE support** through OpenAI-compatible API endpoints, enabling you to use Cursor with any provider (Databricks, Bedrock, OpenRouter, Ollama, etc.) while maintaining all Cursor features.
|
|
1818
|
+
|
|
1819
|
+
### Why Use Lynkr with Cursor?
|
|
1820
|
+
|
|
1821
|
+
- 💰 **60-80% cost savings** vs Cursor's default GPT-4 pricing
|
|
1822
|
+
- 🔓 **Provider choice** - Use Claude, local models, or any supported provider
|
|
1823
|
+
- 🏠 **Self-hosted** - Full control over your AI infrastructure
|
|
1824
|
+
- ✅ **Full compatibility** - All Cursor features work (chat, autocomplete, @Codebase search)
|
|
1825
|
+
|
|
1826
|
+
### Quick Setup (5 Minutes)
|
|
1827
|
+
|
|
1828
|
+
#### Step 1: Start Lynkr Server
|
|
1829
|
+
|
|
1830
|
+
```bash
|
|
1831
|
+
# Navigate to Lynkr directory
|
|
1832
|
+
cd /path/to/claude-code
|
|
1833
|
+
|
|
1834
|
+
# Start with any provider (Databricks, Bedrock, OpenRouter, Ollama, etc.)
|
|
1835
|
+
npm start
|
|
1836
|
+
|
|
1837
|
+
# Wait for: "Server listening at http://0.0.0.0:8081" (or your configured PORT)
|
|
1838
|
+
```
|
|
1839
|
+
|
|
1840
|
+
**Note**: Lynkr runs on port **8081** by default (configured in `.env` as `PORT=8081`)
|
|
1841
|
+
|
|
1842
|
+
#### Step 2: Configure Cursor (Detailed Steps)
|
|
1843
|
+
|
|
1844
|
+
1. **Open Cursor Settings**
|
|
1845
|
+
- Mac: Click **Cursor** menu → **Settings** (or press `Cmd+,`)
|
|
1846
|
+
- Windows/Linux: Click **File** → **Settings** (or press `Ctrl+,`)
|
|
1847
|
+
|
|
1848
|
+
2. **Navigate to Models Section**
|
|
1849
|
+
- In the Settings sidebar, find **Features** section
|
|
1850
|
+
- Click on **Models**
|
|
1851
|
+
|
|
1852
|
+
3. **Configure OpenAI API Settings**
|
|
1853
|
+
|
|
1854
|
+
Fill in these three fields:
|
|
1855
|
+
|
|
1856
|
+
**API Key:**
|
|
1857
|
+
```
|
|
1858
|
+
sk-lynkr
|
|
1859
|
+
```
|
|
1860
|
+
*(Cursor requires a non-empty value, but Lynkr ignores it. You can use any text like "dummy" or "lynkr")*
|
|
1861
|
+
|
|
1862
|
+
**Base URL:**
|
|
1863
|
+
```
|
|
1864
|
+
http://localhost:8081/v1
|
|
1865
|
+
```
|
|
1866
|
+
⚠️ **Critical:**
|
|
1867
|
+
- Use port **8081** (or your configured PORT in .env)
|
|
1868
|
+
- Must end with `/v1`
|
|
1869
|
+
- Include `http://` prefix
|
|
1870
|
+
|
|
1871
|
+
**Model:**
|
|
1872
|
+
|
|
1873
|
+
Choose based on your `MODEL_PROVIDER` in `.env`:
|
|
1874
|
+
- **Bedrock**: `claude-3.5-sonnet` or `claude-sonnet-4.5`
|
|
1875
|
+
- **Databricks**: `claude-sonnet-4.5`
|
|
1876
|
+
- **OpenRouter**: `anthropic/claude-3.5-sonnet`
|
|
1877
|
+
- **Ollama**: `qwen2.5-coder:latest` (or your OLLAMA_MODEL)
|
|
1878
|
+
- **Azure OpenAI**: `gpt-4o` or your deployment name
|
|
1879
|
+
|
|
1880
|
+
4. **Save Settings** (auto-saves in Cursor)
|
|
1881
|
+
|
|
1882
|
+
#### Step 3: Test the Integration
|
|
1883
|
+
|
|
1884
|
+
**Test 1: Basic Chat** (`Cmd+L` / `Ctrl+L`)
|
|
1885
|
+
```
|
|
1886
|
+
You: "Hello, can you see this?"
|
|
1887
|
+
Expected: Response from Claude via Lynkr ✅
|
|
1888
|
+
```
|
|
1889
|
+
|
|
1890
|
+
**Test 2: Inline Edits** (`Cmd+K` / `Ctrl+K`)
|
|
1891
|
+
```
|
|
1892
|
+
1. Select some code
|
|
1893
|
+
2. Press Cmd+K (Mac) or Ctrl+K (Windows/Linux)
|
|
1894
|
+
3. Type: "add a comment explaining this code"
|
|
1895
|
+
Expected: Code suggestions appear inline ✅
|
|
1896
|
+
```
|
|
1897
|
+
|
|
1898
|
+
**Test 3: @Codebase Search** (requires embeddings)
|
|
1899
|
+
```
|
|
1900
|
+
You: "@Codebase where is the config file?"
|
|
1901
|
+
Expected:
|
|
1902
|
+
✅ If embeddings configured: Semantic search finds relevant files
|
|
1903
|
+
❌ If no embeddings: Error or "not available" message
|
|
1904
|
+
```
|
|
1905
|
+
|
|
1906
|
+
#### Step 4: Verify Lynkr Logs
|
|
1907
|
+
|
|
1908
|
+
Check your terminal where Lynkr is running. You should see:
|
|
1909
|
+
```
|
|
1910
|
+
[INFO] POST /v1/chat/completions
|
|
1911
|
+
[INFO] Routing to bedrock (or your provider)
|
|
1912
|
+
[INFO] Response sent: 200
|
|
1913
|
+
```
|
|
1914
|
+
|
|
1915
|
+
### Feature Compatibility Matrix
|
|
1916
|
+
|
|
1917
|
+
| Feature | Without Embeddings | With Embeddings |
|
|
1918
|
+
|---------|-------------------|-----------------|
|
|
1919
|
+
| **Chat in current file** | ✅ Works | ✅ Works |
|
|
1920
|
+
| **Inline autocomplete** | ✅ Works | ✅ Works |
|
|
1921
|
+
| **Cmd+K edits** | ✅ Works | ✅ Works |
|
|
1922
|
+
| **Manual @file references** | ✅ Works | ✅ Works |
|
|
1923
|
+
| **Terminal commands** | ✅ Works | ✅ Works |
|
|
1924
|
+
| **@Codebase semantic search** | ❌ Requires embeddings | ✅ Works |
|
|
1925
|
+
| **Automatic context** | ❌ Requires embeddings | ✅ Works |
|
|
1926
|
+
| **Find similar code** | ❌ Requires embeddings | ✅ Works |
|
|
1927
|
+
|
|
1928
|
+
### Enabling @Codebase Semantic Search (Optional)
|
|
1929
|
+
|
|
1930
|
+
For Cursor's @Codebase semantic search, you need embeddings support.
|
|
1931
|
+
|
|
1932
|
+
**⚡ Already using OpenRouter? You're all set!**
|
|
1933
|
+
|
|
1934
|
+
If you configured `MODEL_PROVIDER=openrouter`, embeddings **work automatically** with the same `OPENROUTER_API_KEY` - no additional setup needed. OpenRouter handles both chat completions AND embeddings with one key.
|
|
1935
|
+
|
|
1936
|
+
**🔧 Using a different provider? Add embeddings:**
|
|
1937
|
+
|
|
1938
|
+
If you're using Databricks, Bedrock, Ollama, or other providers for chat, add ONE of these for embeddings (ordered by privacy):
|
|
1939
|
+
|
|
1940
|
+
**Option A: Ollama (100% Local - Most Private) 🔒**
|
|
1941
|
+
```bash
|
|
1942
|
+
# Add to .env
|
|
1943
|
+
ollama pull nomic-embed-text
|
|
1944
|
+
OLLAMA_EMBEDDINGS_MODEL=nomic-embed-text
|
|
1945
|
+
|
|
1946
|
+
# Cost: FREE, Privacy: 100% local, Quality: Good
|
|
1947
|
+
# No cloud APIs, perfect for privacy-sensitive work
|
|
1948
|
+
```
|
|
1949
|
+
|
|
1950
|
+
**Option B: llama.cpp (100% Local - GGUF Models) 🔒**
|
|
1951
|
+
```bash
|
|
1952
|
+
# Download model and start server
|
|
1953
|
+
./llama-server -m nomic-embed-text-v1.5.Q4_K_M.gguf --port 8080 --embedding
|
|
1954
|
+
|
|
1955
|
+
# Add to .env
|
|
1956
|
+
LLAMACPP_EMBEDDINGS_ENDPOINT=http://localhost:8080/embeddings
|
|
1957
|
+
|
|
1958
|
+
# Cost: FREE, Privacy: 100% local, Quality: Good
|
|
1959
|
+
# Uses quantized GGUF models for efficiency
|
|
1960
|
+
```
|
|
1961
|
+
|
|
1962
|
+
**Option C: OpenRouter (Cloud - Cheapest Cloud Option)**
|
|
1963
|
+
```bash
|
|
1964
|
+
# Add to .env
|
|
1965
|
+
OPENROUTER_API_KEY=sk-or-v1-your-key-here
|
|
1966
|
+
|
|
1967
|
+
# Get key from: https://openrouter.ai/keys
|
|
1968
|
+
# Cost: ~$0.0001 per 1K tokens (~$0.01-0.10/month typical usage)
|
|
1969
|
+
# Privacy: Cloud, Quality: Excellent
|
|
1970
|
+
|
|
1971
|
+
# Advanced: Use separate models for chat vs embeddings (optional)
|
|
1972
|
+
OPENROUTER_MODEL=anthropic/claude-3.5-sonnet # Chat model
|
|
1973
|
+
OPENROUTER_EMBEDDINGS_MODEL=openai/text-embedding-3-small # Embeddings model
|
|
1974
|
+
# (Defaults to text-embedding-ada-002 if not specified)
|
|
1975
|
+
```
|
|
1976
|
+
|
|
1977
|
+
**Option D: OpenAI Direct (Cloud)**
|
|
1978
|
+
```bash
|
|
1979
|
+
# Add to .env
|
|
1980
|
+
OPENAI_API_KEY=sk-your-key-here
|
|
1981
|
+
|
|
1982
|
+
# Get key from: https://platform.openai.com/api-keys
|
|
1983
|
+
# Cost: ~$0.0001 per 1K tokens
|
|
1984
|
+
# Privacy: Cloud, Quality: Excellent
|
|
1985
|
+
```
|
|
1986
|
+
|
|
1987
|
+
**🎯 Advanced: Override Embeddings Provider Explicitly (Optional)**
|
|
1988
|
+
|
|
1989
|
+
By default, embeddings use the same provider as `MODEL_PROVIDER` (if supported) or automatically select the first available provider. To force a specific provider:
|
|
1990
|
+
|
|
1991
|
+
```bash
|
|
1992
|
+
# Add to .env to explicitly choose embeddings provider
|
|
1993
|
+
EMBEDDINGS_PROVIDER=ollama # Use Ollama embeddings
|
|
1994
|
+
# OR
|
|
1995
|
+
EMBEDDINGS_PROVIDER=llamacpp # Use llama.cpp embeddings
|
|
1996
|
+
# OR
|
|
1997
|
+
EMBEDDINGS_PROVIDER=openrouter # Use OpenRouter embeddings
|
|
1998
|
+
# OR
|
|
1999
|
+
EMBEDDINGS_PROVIDER=openai # Use OpenAI embeddings
|
|
2000
|
+
```
|
|
2001
|
+
|
|
2002
|
+
**Example use case**: Use Databricks for chat but force Ollama for embeddings (privacy)
|
|
2003
|
+
```bash
|
|
2004
|
+
MODEL_PROVIDER=databricks
|
|
2005
|
+
DATABRICKS_API_KEY=your-key
|
|
2006
|
+
EMBEDDINGS_PROVIDER=ollama # Force local embeddings
|
|
2007
|
+
OLLAMA_EMBEDDINGS_MODEL=nomic-embed-text
|
|
2008
|
+
```
|
|
2009
|
+
|
|
2010
|
+
#### Embedding Models Comparison
|
|
2011
|
+
|
|
2012
|
+
| Option | Privacy | Cost/Month | Setup Complexity | Quality | Speed |
|
|
2013
|
+
|--------|---------|------------|------------------|---------|-------|
|
|
2014
|
+
| **Ollama** | 🔒 100% Local | FREE | Easy (1 command) | Good | Fast |
|
|
2015
|
+
| **llama.cpp** | 🔒 100% Local | FREE | Medium (download GGUF) | Good | Fast |
|
|
2016
|
+
| **OpenRouter** | ☁️ Cloud | $0.01-0.10 | Easy (get API key) | Excellent | Very Fast |
|
|
2017
|
+
| **OpenAI** | ☁️ Cloud | $0.01-0.10 | Easy (get API key) | Excellent | Very Fast |
|
|
2018
|
+
|
|
2019
|
+
**Recommended setups:**
|
|
2020
|
+
- **100% Local/Private**: Ollama chat + Ollama embeddings (zero cloud dependencies)
|
|
2021
|
+
- **Hybrid**: Databricks/Bedrock chat + Ollama embeddings (private search, cloud chat)
|
|
2022
|
+
- **Simple Cloud**: OpenRouter chat + OpenRouter embeddings (one key for both)
|
|
2023
|
+
|
|
2024
|
+
**Restart Lynkr**, and @Codebase will work!
|
|
2025
|
+
|
|
2026
|
+
### Available Endpoints
|
|
2027
|
+
|
|
2028
|
+
Lynkr implements all 4 OpenAI API endpoints for full Cursor compatibility:
|
|
2029
|
+
|
|
2030
|
+
1. **POST /v1/chat/completions** - Chat with streaming support
|
|
2031
|
+
- Handles all chat/completion requests
|
|
2032
|
+
- Converts OpenAI format ↔ Anthropic format automatically
|
|
2033
|
+
- Full tool calling support
|
|
2034
|
+
|
|
2035
|
+
2. **GET /v1/models** - List available models
|
|
2036
|
+
- Returns models based on configured provider
|
|
2037
|
+
- Updates dynamically when you change providers
|
|
2038
|
+
|
|
2039
|
+
3. **POST /v1/embeddings** - Generate embeddings
|
|
2040
|
+
- Required for @Codebase semantic search
|
|
2041
|
+
- Supports: Ollama (local), llama.cpp (local), OpenRouter (cloud), OpenAI (cloud)
|
|
2042
|
+
- Smart provider detection: explicit → same as chat → first available
|
|
2043
|
+
- Falls back gracefully if not configured (returns 501)
|
|
2044
|
+
|
|
2045
|
+
4. **GET /v1/health** - Health check
|
|
2046
|
+
- Verify Lynkr is running
|
|
2047
|
+
- Check provider status
|
|
2048
|
+
|
|
2049
|
+
### Cost Comparison (100K requests/month)
|
|
2050
|
+
|
|
2051
|
+
| Setup | Monthly Cost | Embeddings Setup | Features | Privacy |
|
|
2052
|
+
|-------|--------------|------------------|----------|---------|
|
|
2053
|
+
| **Cursor native (GPT-4)** | $20-50 | Built-in | All features | Cloud |
|
|
2054
|
+
| **Lynkr + OpenRouter** | $5-10 | ⚡ **Same key for both** | All features, simplest setup | Cloud |
|
|
2055
|
+
| **Lynkr + Databricks** | $15-30 | +Ollama/OpenRouter | All features | Cloud chat, local/cloud search |
|
|
2056
|
+
| **Lynkr + Ollama + Ollama embeddings** | **100% FREE** 🔒 | Ollama (local) | All features, 100% local | 100% Local |
|
|
2057
|
+
| **Lynkr + Ollama + llama.cpp embeddings** | **100% FREE** 🔒 | llama.cpp (local) | All features, 100% local | 100% Local |
|
|
2058
|
+
| **Lynkr + Ollama + OpenRouter embeddings** | $0.01-0.10 | OpenRouter (cloud) | All features, hybrid | Local chat, cloud search |
|
|
2059
|
+
| **Lynkr + Ollama (no embeddings)** | **FREE** | None | Chat/Cmd+K only, no @Codebase | 100% Local |
|
|
2060
|
+
|
|
2061
|
+
### Provider Recommendations for Cursor
|
|
2062
|
+
|
|
2063
|
+
**Best for Privacy (100% Local) 🔒:**
|
|
2064
|
+
- **Ollama + Ollama embeddings** - Zero cloud dependencies, completely private
|
|
2065
|
+
- Cost: **100% FREE**
|
|
2066
|
+
- Privacy: All data stays on your machine
|
|
2067
|
+
- Full @Codebase support with local embeddings
|
|
2068
|
+
- Perfect for: Sensitive codebases, offline work, privacy requirements
|
|
2069
|
+
|
|
2070
|
+
**Best for Simplicity (Recommended for most users):**
|
|
2071
|
+
- **OpenRouter** - ONE key for chat + embeddings, no extra setup
|
|
2072
|
+
- Cost: ~$5-10/month (100K requests)
|
|
2073
|
+
- Full @Codebase support out of the box
|
|
2074
|
+
- Access to 100+ models (Claude, GPT, Llama, etc.)
|
|
2075
|
+
|
|
2076
|
+
**Best for Production:**
|
|
2077
|
+
- **Databricks** - Claude Sonnet 4.5, enterprise-grade
|
|
2078
|
+
- **Bedrock** - AWS infrastructure, 100+ models
|
|
2079
|
+
- Add Ollama embeddings (local) or OpenRouter (cloud) for @Codebase
|
|
2080
|
+
|
|
2081
|
+
**Best for Hybrid (Local Chat + Cloud Search):**
|
|
2082
|
+
- **Ollama** - FREE (local, offline) + $0.01-0.10/month for cloud embeddings
|
|
2083
|
+
- Privacy: 100% local chat, cloud @Codebase search
|
|
2084
|
+
- Add OpenRouter key only for @Codebase search
|
|
2085
|
+
|
|
2086
|
+
**Best for Speed:**
|
|
2087
|
+
- **Ollama** - Local inference, 100-500ms latency
|
|
2088
|
+
- **llama.cpp** - Optimized GGUF models, 50-300ms latency
|
|
2089
|
+
- **OpenRouter** - Fast cloud inference, global CDN
|
|
2090
|
+
|
|
2091
|
+
### Troubleshooting
|
|
2092
|
+
|
|
2093
|
+
#### Issue: "Connection refused" or "Network error"
|
|
2094
|
+
|
|
2095
|
+
**Symptoms:** Cursor shows connection errors, can't reach Lynkr
|
|
2096
|
+
|
|
2097
|
+
**Solutions:**
|
|
2098
|
+
1. **Verify Lynkr is running:**
|
|
2099
|
+
```bash
|
|
2100
|
+
# Check if Lynkr process is running on port 8081
|
|
2101
|
+
lsof -i :8081
|
|
2102
|
+
# Should show node process
|
|
2103
|
+
```
|
|
2104
|
+
|
|
2105
|
+
2. **Test health endpoint:**
|
|
2106
|
+
```bash
|
|
2107
|
+
curl http://localhost:8081/v1/health
|
|
2108
|
+
# Should return: {"status":"ok"}
|
|
2109
|
+
```
|
|
2110
|
+
|
|
2111
|
+
3. **Check port number:**
|
|
2112
|
+
- Verify Cursor Base URL uses correct port: `http://localhost:8081/v1`
|
|
2113
|
+
- Check `.env` file: `PORT=8081`
|
|
2114
|
+
- If you changed PORT, update Cursor settings to match
|
|
2115
|
+
|
|
2116
|
+
4. **Verify URL format:**
|
|
2117
|
+
- ✅ Correct: `http://localhost:8081/v1`
|
|
2118
|
+
- ❌ Wrong: `http://localhost:8081` (missing `/v1`)
|
|
2119
|
+
- ❌ Wrong: `localhost:8081/v1` (missing `http://`)
|
|
2120
|
+
|
|
2121
|
+
#### Issue: "Invalid API key" or "Unauthorized"
|
|
2122
|
+
|
|
2123
|
+
**Symptoms:** Cursor says API key is invalid
|
|
2124
|
+
|
|
2125
|
+
**Solutions:**
|
|
2126
|
+
- Lynkr doesn't validate API keys from Cursor
|
|
2127
|
+
- This error means Cursor isn't reaching Lynkr at all
|
|
2128
|
+
- Double-check Base URL in Cursor: `http://localhost:8081/v1`
|
|
2129
|
+
- Make sure you included `/v1` at the end
|
|
2130
|
+
- Try clearing and re-entering the Base URL
|
|
2131
|
+
|
|
2132
|
+
#### Issue: "Model not found" or "Invalid model"
|
|
2133
|
+
|
|
2134
|
+
**Symptoms:** Cursor can't find the model you specified
|
|
2135
|
+
|
|
2136
|
+
**Solutions:**
|
|
2137
|
+
1. **Match model name to your provider:**
|
|
2138
|
+
- **Bedrock**: Use `claude-3.5-sonnet` or `claude-sonnet-4.5`
|
|
2139
|
+
- **Databricks**: Use `claude-sonnet-4.5`
|
|
2140
|
+
- **OpenRouter**: Use `anthropic/claude-3.5-sonnet`
|
|
2141
|
+
- **Ollama**: Use your actual model name like `qwen2.5-coder:latest`
|
|
2142
|
+
|
|
2143
|
+
2. **Try generic names:**
|
|
2144
|
+
- Lynkr translates generic names, so try:
|
|
2145
|
+
- `claude-3.5-sonnet`
|
|
2146
|
+
- `gpt-4o`
|
|
2147
|
+
- `claude-sonnet-4.5`
|
|
2148
|
+
|
|
2149
|
+
3. **Check provider logs:**
|
|
2150
|
+
- Look at Lynkr terminal for actual error from provider
|
|
2151
|
+
- Provider might not support the model you requested
|
|
2152
|
+
|
|
2153
|
+
#### Issue: @Codebase doesn't work
|
|
2154
|
+
|
|
2155
|
+
**Symptoms:** @Codebase search shows "not available" or errors
|
|
2156
|
+
|
|
2157
|
+
**Solutions:**
|
|
2158
|
+
1. **Configure embeddings** (choose ONE):
|
|
2159
|
+
|
|
2160
|
+
**Option A: Ollama (Local, Free)**
|
|
2161
|
+
```bash
|
|
2162
|
+
# Pull embedding model
|
|
2163
|
+
ollama pull nomic-embed-text
|
|
2164
|
+
|
|
2165
|
+
# Add to .env
|
|
2166
|
+
OLLAMA_EMBEDDINGS_MODEL=nomic-embed-text
|
|
2167
|
+
|
|
2168
|
+
# Restart Lynkr
|
|
2169
|
+
npm start
|
|
2170
|
+
```
|
|
2171
|
+
|
|
2172
|
+
**Option B: llama.cpp (Local, Free)**
|
|
2173
|
+
```bash
|
|
2174
|
+
# Start llama.cpp server with embedding model
|
|
2175
|
+
./llama-server -m nomic-embed-text-v1.5.Q4_K_M.gguf --port 8080 --embedding
|
|
2176
|
+
|
|
2177
|
+
# Add to .env
|
|
2178
|
+
LLAMACPP_EMBEDDINGS_ENDPOINT=http://localhost:8080/embeddings
|
|
2179
|
+
|
|
2180
|
+
# Restart Lynkr
|
|
2181
|
+
npm start
|
|
2182
|
+
```
|
|
2183
|
+
|
|
2184
|
+
**Option C: OpenRouter (Cloud, ~$0.01-0.10/month)**
|
|
2185
|
+
```bash
|
|
2186
|
+
# Add to .env
|
|
2187
|
+
OPENROUTER_API_KEY=sk-or-v1-your-key-here
|
|
2188
|
+
|
|
2189
|
+
# Restart Lynkr
|
|
2190
|
+
npm start
|
|
2191
|
+
```
|
|
2192
|
+
|
|
2193
|
+
2. **Test embeddings endpoint:**
|
|
2194
|
+
```bash
|
|
2195
|
+
curl http://localhost:8081/v1/embeddings \
|
|
2196
|
+
-H "Content-Type: application/json" \
|
|
2197
|
+
-d '{"input": "test"}'
|
|
2198
|
+
|
|
2199
|
+
# Should return JSON with embeddings array
|
|
2200
|
+
# If 501 error: Embeddings not configured
|
|
2201
|
+
```
|
|
2202
|
+
|
|
2203
|
+
3. **Check Lynkr logs:**
|
|
2204
|
+
- Look for: `Embeddings not configured` warning
|
|
2205
|
+
- Or: `Generating embeddings with ollama/openrouter/etc.`
|
|
2206
|
+
|
|
2207
|
+
#### Issue: Chat works but responses are slow
|
|
2208
|
+
|
|
2209
|
+
**Symptoms:** Long wait times for responses
|
|
2210
|
+
|
|
2211
|
+
**Solutions:**
|
|
2212
|
+
1. **Check provider latency:**
|
|
2213
|
+
- **Ollama/llama.cpp**: Local models may be slow on weak hardware
|
|
2214
|
+
- **Cloud providers**: Check your internet connection
|
|
2215
|
+
- **Bedrock/Databricks**: Check region latency
|
|
2216
|
+
|
|
2217
|
+
2. **Optimize Ollama:**
|
|
2218
|
+
```bash
|
|
2219
|
+
# Use smaller/faster models
|
|
2220
|
+
ollama pull qwen2.5-coder:1.5b # Smaller = faster
|
|
2221
|
+
```
|
|
2222
|
+
|
|
2223
|
+
3. **Check Lynkr logs:**
|
|
2224
|
+
- Look for actual response times
|
|
2225
|
+
- Example: `Response time: 2500ms`
|
|
2226
|
+
|
|
2227
|
+
#### Issue: Autocomplete doesn't work with Lynkr
|
|
2228
|
+
|
|
2229
|
+
**Symptoms:** Code autocomplete suggestions don't appear
|
|
2230
|
+
|
|
2231
|
+
**This is expected behavior:**
|
|
2232
|
+
- Cursor's inline autocomplete uses Cursor's built-in models (fast, local)
|
|
2233
|
+
- Autocomplete does NOT go through Lynkr
|
|
2234
|
+
- Only these features use Lynkr:
|
|
2235
|
+
- ✅ Chat (`Cmd+L` / `Ctrl+L`)
|
|
2236
|
+
- ✅ Cmd+K inline edits
|
|
2237
|
+
- ✅ @Codebase search
|
|
2238
|
+
- ❌ Autocomplete (uses Cursor's models)
|
|
2239
|
+
|
|
2240
|
+
#### Issue: Embeddings work but search results are poor
|
|
2241
|
+
|
|
2242
|
+
**Symptoms:** @Codebase returns irrelevant files
|
|
2243
|
+
|
|
2244
|
+
**Solutions:**
|
|
2245
|
+
1. **Try better embedding models:**
|
|
2246
|
+
```bash
|
|
2247
|
+
# For Ollama - upgrade to larger model
|
|
2248
|
+
ollama pull mxbai-embed-large # Better quality than nomic-embed-text
|
|
2249
|
+
OLLAMA_EMBEDDINGS_MODEL=mxbai-embed-large
|
|
2250
|
+
```
|
|
2251
|
+
|
|
2252
|
+
2. **Use cloud embeddings for better quality:**
|
|
2253
|
+
```bash
|
|
2254
|
+
# OpenRouter has excellent embeddings
|
|
2255
|
+
OPENROUTER_API_KEY=sk-or-v1-your-key
|
|
2256
|
+
```
|
|
2257
|
+
|
|
2258
|
+
3. **This is a Cursor indexing issue, not Lynkr:**
|
|
2259
|
+
- Cursor needs to re-index your codebase
|
|
2260
|
+
- Try closing and reopening the workspace
|
|
2261
|
+
|
|
2262
|
+
#### Issue: "Too many requests" or rate limiting
|
|
2263
|
+
|
|
2264
|
+
**Symptoms:** Provider returns 429 errors
|
|
2265
|
+
|
|
2266
|
+
**Solutions:**
|
|
2267
|
+
1. **Enable fallback provider:**
|
|
2268
|
+
```bash
|
|
2269
|
+
# In .env
|
|
2270
|
+
FALLBACK_ENABLED=true
|
|
2271
|
+
FALLBACK_PROVIDER=openrouter # Or another provider
|
|
2272
|
+
```
|
|
2273
|
+
|
|
2274
|
+
2. **Use different provider:**
|
|
2275
|
+
- Some providers have higher rate limits
|
|
2276
|
+
- OpenRouter aggregates multiple providers
|
|
2277
|
+
|
|
2278
|
+
3. **Check provider dashboard:**
|
|
2279
|
+
- Verify you haven't exceeded quota
|
|
2280
|
+
- Some providers have free tier limits
|
|
2281
|
+
|
|
2282
|
+
#### Getting More Help
|
|
2283
|
+
|
|
2284
|
+
**Check Lynkr logs in terminal:**
|
|
2285
|
+
```bash
|
|
2286
|
+
# Look for error messages in the terminal where Lynkr is running
|
|
2287
|
+
# Logs show:
|
|
2288
|
+
# - Which provider was used
|
|
2289
|
+
# - Request/response details
|
|
2290
|
+
# - Error messages from providers
|
|
2291
|
+
```
|
|
2292
|
+
|
|
2293
|
+
**Test individual endpoints:**
|
|
2294
|
+
```bash
|
|
2295
|
+
# Test health
|
|
2296
|
+
curl http://localhost:8081/v1/health
|
|
2297
|
+
|
|
2298
|
+
# Test chat
|
|
2299
|
+
curl http://localhost:8081/v1/chat/completions \
|
|
2300
|
+
-H "Content-Type: application/json" \
|
|
2301
|
+
-d '{"model":"claude-3.5-sonnet","messages":[{"role":"user","content":"hi"}]}'
|
|
2302
|
+
|
|
2303
|
+
# Test embeddings
|
|
2304
|
+
curl http://localhost:8081/v1/embeddings \
|
|
2305
|
+
-H "Content-Type: application/json" \
|
|
2306
|
+
-d '{"input":"test"}'
|
|
2307
|
+
```
|
|
2308
|
+
|
|
2309
|
+
**Enable debug logging:**
|
|
2310
|
+
```bash
|
|
2311
|
+
# In .env
|
|
2312
|
+
LOG_LEVEL=debug
|
|
2313
|
+
|
|
2314
|
+
# Restart Lynkr
|
|
2315
|
+
npm start
|
|
2316
|
+
```
|
|
2317
|
+
|
|
2318
|
+
### Architecture
|
|
2319
|
+
|
|
2320
|
+
```
|
|
2321
|
+
Cursor IDE
|
|
2322
|
+
↓ OpenAI API format
|
|
2323
|
+
Lynkr Proxy
|
|
2324
|
+
↓ Converts to Anthropic format
|
|
2325
|
+
Your Provider (Databricks/Bedrock/OpenRouter/Ollama/etc.)
|
|
2326
|
+
↓ Returns response
|
|
2327
|
+
Lynkr Proxy
|
|
2328
|
+
↓ Converts back to OpenAI format
|
|
2329
|
+
Cursor IDE (displays result)
|
|
2330
|
+
```
|
|
2331
|
+
|
|
2332
|
+
### Advanced Configuration
|
|
2333
|
+
|
|
2334
|
+
#### Setup 1: Simplest (One key for everything - OpenRouter)
|
|
2335
|
+
```bash
|
|
2336
|
+
# Chat + Embeddings: OpenRouter handles both with ONE key
|
|
2337
|
+
MODEL_PROVIDER=openrouter
|
|
2338
|
+
OPENROUTER_API_KEY=sk-or-v1-your-key-here
|
|
2339
|
+
|
|
2340
|
+
# Optional: Use different models for chat vs embeddings
|
|
2341
|
+
OPENROUTER_MODEL=anthropic/claude-3.5-sonnet # Chat
|
|
2342
|
+
OPENROUTER_EMBEDDINGS_MODEL=openai/text-embedding-3-small # Embeddings
|
|
2343
|
+
|
|
2344
|
+
# That's it! Both chat and @Codebase search work.
|
|
2345
|
+
# Cost: ~$5-10/month for 100K requests
|
|
2346
|
+
```
|
|
2347
|
+
|
|
2348
|
+
#### Setup 2: Most Private (100% Local - Ollama + Ollama)
|
|
2349
|
+
```bash
|
|
2350
|
+
# Chat: Ollama local model (FREE)
|
|
2351
|
+
MODEL_PROVIDER=ollama
|
|
2352
|
+
OLLAMA_MODEL=qwen2.5-coder:latest
|
|
2353
|
+
OLLAMA_ENDPOINT=http://localhost:11434
|
|
2354
|
+
|
|
2355
|
+
# Embeddings: Ollama local embeddings (FREE)
|
|
2356
|
+
OLLAMA_EMBEDDINGS_MODEL=nomic-embed-text
|
|
2357
|
+
OLLAMA_EMBEDDINGS_ENDPOINT=http://localhost:11434/api/embeddings
|
|
2358
|
+
|
|
2359
|
+
# Zero cloud dependencies, 100% private
|
|
2360
|
+
# Cost: FREE
|
|
2361
|
+
# Privacy: All data stays on your machine
|
|
2362
|
+
```
|
|
2363
|
+
|
|
2364
|
+
#### Setup 3: Most Private (100% Local - Ollama + llama.cpp)
|
|
2365
|
+
```bash
|
|
2366
|
+
# Chat: Ollama local model (FREE)
|
|
2367
|
+
MODEL_PROVIDER=ollama
|
|
2368
|
+
OLLAMA_MODEL=qwen2.5-coder:latest
|
|
2369
|
+
|
|
2370
|
+
# Embeddings: llama.cpp with GGUF model (FREE)
|
|
2371
|
+
LLAMACPP_EMBEDDINGS_ENDPOINT=http://localhost:8080/embeddings
|
|
2372
|
+
|
|
2373
|
+
# Start llama.cpp separately:
|
|
2374
|
+
# ./llama-server -m nomic-embed-text-v1.5.Q4_K_M.gguf --port 8080 --embedding
|
|
2375
|
+
|
|
2376
|
+
# Cost: FREE
|
|
2377
|
+
# Privacy: All data stays on your machine
|
|
2378
|
+
```
|
|
2379
|
+
|
|
2380
|
+
#### Setup 4: Hybrid (Premium Chat + Local Search)
|
|
2381
|
+
```bash
|
|
2382
|
+
# Chat: Databricks Claude Sonnet 4.5 (best quality)
|
|
2383
|
+
MODEL_PROVIDER=databricks
|
|
2384
|
+
DATABRICKS_API_KEY=your-key
|
|
2385
|
+
DATABRICKS_API_BASE=https://your-workspace.databricks.com
|
|
2386
|
+
|
|
2387
|
+
# Embeddings: Ollama local (private @Codebase search)
|
|
2388
|
+
EMBEDDINGS_PROVIDER=ollama # Force Ollama for embeddings
|
|
2389
|
+
OLLAMA_EMBEDDINGS_MODEL=nomic-embed-text
|
|
2390
|
+
|
|
2391
|
+
# Cost: ~$15-30/month for chat, FREE for embeddings
|
|
2392
|
+
# Privacy: Cloud chat, local @Codebase search
|
|
2393
|
+
```
|
|
2394
|
+
|
|
2395
|
+
#### Setup 5: Hybrid (Premium Chat + Cloud Search)
|
|
2396
|
+
```bash
|
|
2397
|
+
# Chat: Bedrock with Claude (AWS infrastructure)
|
|
2398
|
+
MODEL_PROVIDER=bedrock
|
|
2399
|
+
AWS_BEDROCK_API_KEY=your-key
|
|
2400
|
+
AWS_BEDROCK_REGION=us-east-2
|
|
2401
|
+
AWS_BEDROCK_MODEL_ID=anthropic.claude-3-5-sonnet-20241022-v2:0
|
|
2402
|
+
|
|
2403
|
+
# Embeddings: OpenRouter (cheaper than Bedrock embeddings)
|
|
2404
|
+
OPENROUTER_API_KEY=sk-or-v1-your-key-here
|
|
2405
|
+
|
|
2406
|
+
# Cost: ~$15-30/month for chat + $0.01-0.10/month for embeddings
|
|
2407
|
+
```
|
|
2408
|
+
|
|
2409
|
+
#### Setup 6: Cost Optimized (Hybrid Routing)
|
|
2410
|
+
```bash
|
|
2411
|
+
# Simple queries → Ollama (FREE, local)
|
|
2412
|
+
# Complex queries → Databricks (premium, cloud)
|
|
2413
|
+
MODEL_PROVIDER=ollama
|
|
2414
|
+
PREFER_OLLAMA=true
|
|
2415
|
+
FALLBACK_ENABLED=true
|
|
2416
|
+
FALLBACK_PROVIDER=databricks
|
|
2417
|
+
|
|
2418
|
+
# Embeddings: Local for privacy
|
|
2419
|
+
OLLAMA_EMBEDDINGS_MODEL=nomic-embed-text
|
|
2420
|
+
|
|
2421
|
+
# Cost: Mostly FREE (Ollama handles 70-80% of requests)
|
|
2422
|
+
# Only complex tool-heavy requests go to Databricks
|
|
2423
|
+
```
|
|
2424
|
+
|
|
2425
|
+
### Visual Setup Summary
|
|
2426
|
+
|
|
2427
|
+
```
|
|
2428
|
+
┌─────────────────────────────────────────────────────────┐
|
|
2429
|
+
│ Cursor Settings → Models → OpenAI API │
|
|
2430
|
+
├─────────────────────────────────────────────────────────┤
|
|
2431
|
+
│ │
|
|
2432
|
+
│ API Key: sk-lynkr │
|
|
2433
|
+
│ (or any non-empty value) │
|
|
2434
|
+
│ │
|
|
2435
|
+
│ Base URL: http://localhost:8081/v1 │
|
|
2436
|
+
│ ⚠️ Must include /v1 │
|
|
2437
|
+
│ │
|
|
2438
|
+
│ Model: claude-3.5-sonnet │
|
|
2439
|
+
│ (or your provider's model) │
|
|
2440
|
+
│ │
|
|
2441
|
+
└─────────────────────────────────────────────────────────┘
|
|
2442
|
+
```
|
|
2443
|
+
|
|
2444
|
+
### What Makes This Different from Cursor Native?
|
|
2445
|
+
|
|
2446
|
+
| Aspect | Cursor Native | Lynkr + Cursor |
|
|
2447
|
+
|--------|---------------|----------------|
|
|
2448
|
+
| **Providers** | OpenAI only | 9+ providers (Bedrock, Databricks, OpenRouter, Ollama, llama.cpp, etc.) |
|
|
2449
|
+
| **Costs** | OpenAI pricing | 60-80% cheaper (or 100% FREE with Ollama) |
|
|
2450
|
+
| **Privacy** | Cloud-only | Can run 100% locally (Ollama + local embeddings) |
|
|
2451
|
+
| **Embeddings** | Built-in (cloud) | 4 options: Ollama (local), llama.cpp (local), OpenRouter (cloud), OpenAI (cloud) |
|
|
2452
|
+
| **Control** | Black box | Full observability, logs, metrics |
|
|
2453
|
+
| **Features** | All Cursor features | All Cursor features (chat, Cmd+K, @Codebase) |
|
|
2454
|
+
| **Flexibility** | Fixed setup | Mix providers (e.g., Bedrock chat + Ollama embeddings) |
|
|
2455
|
+
|
|
2456
|
+
---
|
|
2457
|
+
|
|
1766
2458
|
## Frequently Asked Questions (FAQ)
|
|
1767
2459
|
|
|
1768
2460
|
<details>
|
|
@@ -1771,11 +2463,13 @@ If performance is degraded:
|
|
|
1771
2463
|
**A:** Yes! Lynkr is designed as a drop-in replacement for Anthropic's backend. Simply set `ANTHROPIC_BASE_URL` to point to your Lynkr server:
|
|
1772
2464
|
|
|
1773
2465
|
```bash
|
|
1774
|
-
export ANTHROPIC_BASE_URL=http://localhost:
|
|
2466
|
+
export ANTHROPIC_BASE_URL=http://localhost:8081
|
|
1775
2467
|
export ANTHROPIC_API_KEY=dummy # Required by CLI, but ignored by Lynkr
|
|
1776
2468
|
claude "Your prompt here"
|
|
1777
2469
|
```
|
|
1778
2470
|
|
|
2471
|
+
**Note:** Default port is 8081 (configured in `.env` as `PORT=8081`)
|
|
2472
|
+
|
|
1779
2473
|
*Related searches: Claude Code proxy setup, Claude Code alternative backend, self-hosted Claude Code*
|
|
1780
2474
|
</details>
|
|
1781
2475
|
|
|
@@ -1795,22 +2489,73 @@ At 100k requests/month, this translates to **$6,400-9,600/month savings** ($77k-
|
|
|
1795
2489
|
</details>
|
|
1796
2490
|
|
|
1797
2491
|
<details>
|
|
1798
|
-
<summary><strong>Q: Can I use Ollama models with Lynkr?</strong></summary>
|
|
2492
|
+
<summary><strong>Q: Can I use Ollama models with Lynkr and Cursor?</strong></summary>
|
|
1799
2493
|
|
|
1800
|
-
**A:** Yes!
|
|
2494
|
+
**A:** Yes! Ollama works for both chat AND embeddings (100% local, FREE):
|
|
1801
2495
|
|
|
2496
|
+
**Chat setup:**
|
|
1802
2497
|
```bash
|
|
1803
2498
|
export MODEL_PROVIDER=ollama
|
|
1804
|
-
export OLLAMA_MODEL=
|
|
2499
|
+
export OLLAMA_MODEL=qwen2.5-coder:latest # or llama3.1, mistral, etc.
|
|
1805
2500
|
lynkr start
|
|
1806
2501
|
```
|
|
1807
2502
|
|
|
2503
|
+
**Embeddings setup (for @Codebase search):**
|
|
2504
|
+
```bash
|
|
2505
|
+
# Pull embedding model
|
|
2506
|
+
ollama pull nomic-embed-text
|
|
2507
|
+
|
|
2508
|
+
# Add to .env
|
|
2509
|
+
OLLAMA_EMBEDDINGS_MODEL=nomic-embed-text
|
|
2510
|
+
```
|
|
2511
|
+
|
|
1808
2512
|
**Best Ollama models for coding:**
|
|
1809
|
-
- `qwen2.5-coder:latest` (7B) - Optimized for code generation
|
|
1810
|
-
- `llama3.1:8b` - General-purpose, good balance
|
|
1811
|
-
- `codellama:13b` - Higher quality, needs more RAM
|
|
2513
|
+
- **Chat**: `qwen2.5-coder:latest` (7B) - Optimized for code generation
|
|
2514
|
+
- **Chat**: `llama3.1:8b` - General-purpose, good balance
|
|
2515
|
+
- **Chat**: `codellama:13b` - Higher quality, needs more RAM
|
|
2516
|
+
- **Embeddings**: `nomic-embed-text` (137M) - Best all-around
|
|
2517
|
+
- **Embeddings**: `mxbai-embed-large` (335M) - Higher quality
|
|
2518
|
+
|
|
2519
|
+
**100% local, 100% private, 100% FREE!** 🔒
|
|
2520
|
+
|
|
2521
|
+
*Related searches: Ollama Claude Code integration, local LLM for coding, offline AI assistant, private embeddings*
|
|
2522
|
+
</details>
|
|
2523
|
+
|
|
2524
|
+
<details>
|
|
2525
|
+
<summary><strong>Q: How do I enable @Codebase search in Cursor with Lynkr?</strong></summary>
|
|
2526
|
+
|
|
2527
|
+
**A:** @Codebase semantic search requires embeddings. Choose ONE option:
|
|
2528
|
+
|
|
2529
|
+
**Option 1: Ollama (100% Local, FREE)** 🔒
|
|
2530
|
+
```bash
|
|
2531
|
+
ollama pull nomic-embed-text
|
|
2532
|
+
# Add to .env: OLLAMA_EMBEDDINGS_MODEL=nomic-embed-text
|
|
2533
|
+
```
|
|
2534
|
+
|
|
2535
|
+
**Option 2: llama.cpp (100% Local, FREE)** 🔒
|
|
2536
|
+
```bash
|
|
2537
|
+
./llama-server -m nomic-embed-text-v1.5.Q4_K_M.gguf --port 8080 --embedding
|
|
2538
|
+
# Add to .env: LLAMACPP_EMBEDDINGS_ENDPOINT=http://localhost:8080/embeddings
|
|
2539
|
+
```
|
|
2540
|
+
|
|
2541
|
+
**Option 3: OpenRouter (Cloud, ~$0.01-0.10/month)**
|
|
2542
|
+
```bash
|
|
2543
|
+
# Add to .env: OPENROUTER_API_KEY=sk-or-v1-your-key
|
|
2544
|
+
```
|
|
2545
|
+
|
|
2546
|
+
**Option 4: OpenAI (Cloud, ~$0.01-0.10/month)**
|
|
2547
|
+
```bash
|
|
2548
|
+
# Add to .env: OPENAI_API_KEY=sk-your-key
|
|
2549
|
+
```
|
|
2550
|
+
|
|
2551
|
+
**After configuring, restart Lynkr.** @Codebase will then work in Cursor!
|
|
2552
|
+
|
|
2553
|
+
**Smart provider detection:**
|
|
2554
|
+
- Uses same provider as chat (if supported)
|
|
2555
|
+
- Or automatically selects first available
|
|
2556
|
+
- Or use `EMBEDDINGS_PROVIDER=ollama` to force a specific provider
|
|
1812
2557
|
|
|
1813
|
-
*Related searches:
|
|
2558
|
+
*Related searches: Cursor @Codebase setup, semantic code search, local embeddings, private codebase search*
|
|
1814
2559
|
</details>
|
|
1815
2560
|
|
|
1816
2561
|
<details>
|