lynkr 8.0.0 → 9.0.1
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/.lynkr/telemetry.db +0 -0
- package/.lynkr/telemetry.db-shm +0 -0
- package/.lynkr/telemetry.db-wal +0 -0
- package/README.md +196 -322
- package/lynkr-skill.tar.gz +0 -0
- package/package.json +4 -3
- package/src/api/openai-router.js +64 -13
- package/src/api/providers-handler.js +171 -3
- package/src/api/router.js +9 -2
- package/src/clients/circuit-breaker.js +10 -247
- package/src/clients/codex-process.js +342 -0
- package/src/clients/codex-utils.js +143 -0
- package/src/clients/databricks.js +210 -63
- package/src/clients/resilience.js +540 -0
- package/src/clients/retry.js +22 -167
- package/src/clients/standard-tools.js +23 -0
- package/src/config/index.js +77 -0
- package/src/context/compression.js +42 -9
- package/src/context/distill.js +492 -0
- package/src/orchestrator/index.js +48 -8
- package/src/routing/complexity-analyzer.js +258 -5
- package/src/routing/index.js +12 -2
- package/src/routing/latency-tracker.js +148 -0
- package/src/routing/model-tiers.js +2 -0
- package/src/routing/quality-scorer.js +113 -0
- package/src/routing/telemetry.js +464 -0
- package/src/server.js +13 -12
- package/src/tools/code-graph.js +538 -0
- package/src/tools/code-mode.js +304 -0
- package/src/tools/index.js +4 -0
- package/src/tools/lazy-loader.js +18 -0
- package/src/tools/mcp-remote.js +7 -0
- package/src/tools/smart-selection.js +11 -0
- package/src/tools/tinyfish.js +358 -0
- package/src/tools/truncate.js +1 -0
- package/src/utils/payload.js +206 -0
- package/src/utils/perf-timer.js +80 -0
- package/.github/FUNDING.yml +0 -15
- package/.github/workflows/README.md +0 -215
- package/.github/workflows/ci.yml +0 -69
- package/.github/workflows/index.yml +0 -62
- package/.github/workflows/web-tools-tests.yml +0 -56
- package/CITATIONS.bib +0 -6
- package/DEPLOYMENT.md +0 -1001
- package/LYNKR-TUI-PLAN.md +0 -984
- package/PERFORMANCE-REPORT.md +0 -866
- package/PLAN-per-client-model-routing.md +0 -252
- package/docs/42642f749da6234f41b6b425c3bb07c9.txt +0 -1
- package/docs/BingSiteAuth.xml +0 -4
- package/docs/docs-style.css +0 -478
- package/docs/docs.html +0 -198
- package/docs/google5be250e608e6da39.html +0 -1
- package/docs/index.html +0 -577
- package/docs/index.md +0 -584
- package/docs/robots.txt +0 -4
- package/docs/sitemap.xml +0 -44
- package/docs/style.css +0 -1223
- package/docs/toon-integration-spec.md +0 -130
- package/documentation/README.md +0 -101
- package/documentation/api.md +0 -806
- package/documentation/claude-code-cli.md +0 -679
- package/documentation/codex-cli.md +0 -397
- package/documentation/contributing.md +0 -571
- package/documentation/cursor-integration.md +0 -734
- package/documentation/docker.md +0 -874
- package/documentation/embeddings.md +0 -762
- package/documentation/faq.md +0 -713
- package/documentation/features.md +0 -403
- package/documentation/headroom.md +0 -519
- package/documentation/installation.md +0 -758
- package/documentation/memory-system.md +0 -476
- package/documentation/production.md +0 -636
- package/documentation/providers.md +0 -1009
- package/documentation/routing.md +0 -476
- package/documentation/testing.md +0 -629
- package/documentation/token-optimization.md +0 -325
- package/documentation/tools.md +0 -697
- package/documentation/troubleshooting.md +0 -969
- package/final-test.js +0 -33
- package/headroom-sidecar/config.py +0 -93
- package/headroom-sidecar/requirements.txt +0 -14
- package/headroom-sidecar/server.py +0 -451
- package/monitor-agents.sh +0 -31
- package/scripts/audit-log-reader.js +0 -399
- package/scripts/compact-dictionary.js +0 -204
- package/scripts/test-deduplication.js +0 -448
- package/src/db/database.sqlite +0 -0
- package/te +0 -11622
- package/test/README.md +0 -212
- package/test/azure-openai-config.test.js +0 -213
- package/test/azure-openai-error-resilience.test.js +0 -238
- package/test/azure-openai-format-conversion.test.js +0 -354
- package/test/azure-openai-integration.test.js +0 -287
- package/test/azure-openai-routing.test.js +0 -175
- package/test/azure-openai-streaming.test.js +0 -171
- package/test/bedrock-integration.test.js +0 -457
- package/test/comprehensive-test-suite.js +0 -928
- package/test/config-validation.test.js +0 -207
- package/test/cursor-integration.test.js +0 -484
- package/test/format-conversion.test.js +0 -578
- package/test/hybrid-routing-integration.test.js +0 -269
- package/test/hybrid-routing-performance.test.js +0 -428
- package/test/llamacpp-integration.test.js +0 -882
- package/test/lmstudio-integration.test.js +0 -347
- package/test/memory/extractor.test.js +0 -398
- package/test/memory/retriever.test.js +0 -613
- package/test/memory/retriever.test.js.bak +0 -585
- package/test/memory/search.test.js +0 -537
- package/test/memory/search.test.js.bak +0 -389
- package/test/memory/store.test.js +0 -344
- package/test/memory/store.test.js.bak +0 -312
- package/test/memory/surprise.test.js +0 -300
- package/test/memory-performance.test.js +0 -472
- package/test/openai-integration.test.js +0 -683
- package/test/openrouter-error-resilience.test.js +0 -418
- package/test/passthrough-mode.test.js +0 -385
- package/test/performance-benchmark.js +0 -351
- package/test/performance-tests.js +0 -528
- package/test/routing.test.js +0 -225
- package/test/toon-compression.test.js +0 -131
- package/test/web-tools.test.js +0 -329
- package/test-agents-simple.js +0 -43
- package/test-cli-connection.sh +0 -33
- package/test-learning-unit.js +0 -126
- package/test-learning.js +0 -112
- package/test-parallel-agents.sh +0 -124
- package/test-parallel-direct.js +0 -155
- package/test-subagents.sh +0 -117
|
@@ -1,679 +0,0 @@
|
|
|
1
|
-
# Claude Code CLI Setup Guide
|
|
2
|
-
|
|
3
|
-
Complete guide to using Claude Code CLI with Lynkr for provider flexibility, cost savings, and local model support.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
Lynkr acts as a drop-in replacement for Anthropic's backend, enabling Claude Code CLI to work with any LLM provider (Databricks, Bedrock, OpenRouter, Ollama, etc.) while maintaining full compatibility with all Claude Code features.
|
|
10
|
-
|
|
11
|
-
### Why Use Lynkr with Claude Code CLI?
|
|
12
|
-
|
|
13
|
-
- 💰 **60-80% cost savings** through token optimization
|
|
14
|
-
- 🔓 **Provider choice** - Use any of 12+ supported providers
|
|
15
|
-
- 🏠 **Self-hosted** - Full control over your AI infrastructure
|
|
16
|
-
- 🔒 **Local option** - Run 100% offline with Ollama or llama.cpp
|
|
17
|
-
- ✅ **Zero code changes** - Drop-in replacement for Anthropic backend
|
|
18
|
-
- 📊 **Full observability** - Logs, metrics, token tracking
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Quick Setup (3 Minutes)
|
|
23
|
-
|
|
24
|
-
### Step 1: Install Lynkr
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
# Option A: NPM (Recommended)
|
|
28
|
-
npm install -g lynkr
|
|
29
|
-
|
|
30
|
-
# Option B: Homebrew (macOS)
|
|
31
|
-
brew tap vishalveerareddy123/lynkr
|
|
32
|
-
brew install lynkr
|
|
33
|
-
|
|
34
|
-
# Option C: Git Clone
|
|
35
|
-
git clone https://github.com/vishalveerareddy123/Lynkr.git
|
|
36
|
-
cd Lynkr && npm install
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
### Step 2: Configure Provider
|
|
42
|
-
|
|
43
|
-
Choose your provider and configure credentials:
|
|
44
|
-
|
|
45
|
-
**Option A: AWS Bedrock (100+ models)**
|
|
46
|
-
```bash
|
|
47
|
-
export MODEL_PROVIDER=bedrock
|
|
48
|
-
export AWS_BEDROCK_API_KEY=your-bearer-token
|
|
49
|
-
export AWS_BEDROCK_REGION=us-east-1
|
|
50
|
-
export AWS_BEDROCK_MODEL_ID=anthropic.claude-3-5-sonnet-20241022-v2:0
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
**Option B: Ollama (100% Local, FREE)**
|
|
54
|
-
```bash
|
|
55
|
-
# Start Ollama first
|
|
56
|
-
ollama serve
|
|
57
|
-
ollama pull llama3.1:8b
|
|
58
|
-
|
|
59
|
-
export MODEL_PROVIDER=ollama
|
|
60
|
-
export OLLAMA_MODEL=llama3.1:8b
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
**Option C: OpenRouter (Simplest Cloud)**
|
|
64
|
-
```bash
|
|
65
|
-
export MODEL_PROVIDER=openrouter
|
|
66
|
-
export OPENROUTER_API_KEY=sk-or-v1-your-key
|
|
67
|
-
export OPENROUTER_MODEL=anthropic/claude-3.5-sonnet
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**Option D: Databricks (Enterprise)**
|
|
71
|
-
```bash
|
|
72
|
-
export MODEL_PROVIDER=databricks
|
|
73
|
-
export DATABRICKS_API_BASE=https://your-workspace.databricks.com
|
|
74
|
-
export DATABRICKS_API_KEY=dapi1234567890abcdef
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
See [Provider Configuration Guide](providers.md) for all 12+ providers.
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
### Step 3: Start Lynkr
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
lynkr start
|
|
85
|
-
# Or: npm start (if installed from source)
|
|
86
|
-
|
|
87
|
-
# Wait for: "Server listening at http://0.0.0.0:8081"
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
### Step 4: Configure Claude Code CLI
|
|
93
|
-
|
|
94
|
-
Point Claude Code CLI to Lynkr instead of Anthropic:
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
# Set Lynkr as backend
|
|
98
|
-
export ANTHROPIC_BASE_URL=http://localhost:8081
|
|
99
|
-
export ANTHROPIC_API_KEY=dummy # Required by CLI, but ignored by Lynkr
|
|
100
|
-
|
|
101
|
-
# Verify configuration
|
|
102
|
-
echo $ANTHROPIC_BASE_URL
|
|
103
|
-
# Should show: http://localhost:8081
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
### Step 5: Test It
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
# Simple test
|
|
112
|
-
claude "What is 2+2?"
|
|
113
|
-
|
|
114
|
-
# Should return response from your configured provider ✅
|
|
115
|
-
|
|
116
|
-
# File operation test
|
|
117
|
-
claude "List files in current directory"
|
|
118
|
-
|
|
119
|
-
# Should use Read/Bash tools ✅
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
## Configuration Options
|
|
125
|
-
|
|
126
|
-
### Environment Variables
|
|
127
|
-
|
|
128
|
-
**Core Variables:**
|
|
129
|
-
```bash
|
|
130
|
-
# Lynkr backend URL (required)
|
|
131
|
-
export ANTHROPIC_BASE_URL=http://localhost:8081
|
|
132
|
-
|
|
133
|
-
# API key (required by CLI, but ignored by Lynkr)
|
|
134
|
-
export ANTHROPIC_API_KEY=dummy
|
|
135
|
-
|
|
136
|
-
# Workspace directory (optional, defaults to current directory)
|
|
137
|
-
export WORKSPACE_ROOT=/path/to/your/projects
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
**Make Permanent (Optional):**
|
|
141
|
-
|
|
142
|
-
Add to `~/.bashrc`, `~/.zshrc`, or `~/.profile`:
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
# Add these lines to your shell config
|
|
146
|
-
export ANTHROPIC_BASE_URL=http://localhost:8081
|
|
147
|
-
export ANTHROPIC_API_KEY=dummy
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Then reload:
|
|
151
|
-
```bash
|
|
152
|
-
source ~/.bashrc # or ~/.zshrc
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
## Feature Compatibility
|
|
158
|
-
|
|
159
|
-
### Fully Supported Features
|
|
160
|
-
|
|
161
|
-
All Claude Code CLI features work through Lynkr:
|
|
162
|
-
|
|
163
|
-
| Feature | Status | Notes |
|
|
164
|
-
|---------|--------|-------|
|
|
165
|
-
| **Chat conversations** | ✅ Works | Full streaming support |
|
|
166
|
-
| **File operations** | ✅ Works | Read, Write, Edit tools |
|
|
167
|
-
| **Bash commands** | ✅ Works | Execute shell commands |
|
|
168
|
-
| **Git operations** | ✅ Works | Status, diff, commit, push |
|
|
169
|
-
| **Tool calling** | ✅ Works | All standard Claude Code tools |
|
|
170
|
-
| **Streaming responses** | ✅ Works | Real-time token streaming |
|
|
171
|
-
| **Multi-turn conversations** | ✅ Works | Full context retention |
|
|
172
|
-
| **Code generation** | ✅ Works | Works with all providers |
|
|
173
|
-
| **Error handling** | ✅ Works | Automatic retries, fallbacks |
|
|
174
|
-
| **Token counting** | ✅ Works | Accurate usage tracking |
|
|
175
|
-
|
|
176
|
-
### Tool Execution Modes
|
|
177
|
-
|
|
178
|
-
Lynkr supports two tool execution modes:
|
|
179
|
-
|
|
180
|
-
**Server Mode (Default)**
|
|
181
|
-
```bash
|
|
182
|
-
# Tools execute on Lynkr server
|
|
183
|
-
export TOOL_EXECUTION_MODE=server
|
|
184
|
-
```
|
|
185
|
-
- Tools run on the machine running Lynkr
|
|
186
|
-
- Good for: Standalone proxy, shared team server
|
|
187
|
-
- File operations access server filesystem
|
|
188
|
-
|
|
189
|
-
**Client Mode (Passthrough)**
|
|
190
|
-
```bash
|
|
191
|
-
# Tools execute on Claude Code CLI side
|
|
192
|
-
export TOOL_EXECUTION_MODE=client
|
|
193
|
-
```
|
|
194
|
-
- Tools run on your local machine (where you run `claude`)
|
|
195
|
-
- Good for: Local development, accessing local files
|
|
196
|
-
- Full integration with local environment
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
## Usage Examples
|
|
201
|
-
|
|
202
|
-
### Basic Chat
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
# Simple question
|
|
206
|
-
claude "Explain async/await in JavaScript"
|
|
207
|
-
|
|
208
|
-
# Code explanation
|
|
209
|
-
claude "Explain this function" < app.js
|
|
210
|
-
|
|
211
|
-
# Multi-line prompt
|
|
212
|
-
claude "Write a function that:
|
|
213
|
-
- Takes an array of numbers
|
|
214
|
-
- Filters out even numbers
|
|
215
|
-
- Returns the sum of odd numbers"
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
---
|
|
219
|
-
|
|
220
|
-
### File Operations
|
|
221
|
-
|
|
222
|
-
```bash
|
|
223
|
-
# Read file
|
|
224
|
-
claude "What does this file do?" < src/server.js
|
|
225
|
-
|
|
226
|
-
# Create file
|
|
227
|
-
claude "Create a new Express server in server.js"
|
|
228
|
-
|
|
229
|
-
# Edit file
|
|
230
|
-
claude "Add error handling to src/api/router.js"
|
|
231
|
-
|
|
232
|
-
# Multiple files
|
|
233
|
-
claude "Refactor authentication across src/auth/*.js files"
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
---
|
|
237
|
-
|
|
238
|
-
### Git Workflow
|
|
239
|
-
|
|
240
|
-
```bash
|
|
241
|
-
# Status check
|
|
242
|
-
claude "What files have changed?"
|
|
243
|
-
|
|
244
|
-
# Review diff
|
|
245
|
-
claude "Review my changes and suggest improvements"
|
|
246
|
-
|
|
247
|
-
# Commit changes
|
|
248
|
-
claude "Commit these changes with a descriptive message"
|
|
249
|
-
|
|
250
|
-
# Create PR (if gh CLI installed)
|
|
251
|
-
claude "Create a pull request for these changes"
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
---
|
|
255
|
-
|
|
256
|
-
### Code Generation
|
|
257
|
-
|
|
258
|
-
```bash
|
|
259
|
-
# Generate function
|
|
260
|
-
claude "Write a binary search function in Python"
|
|
261
|
-
|
|
262
|
-
# Generate tests
|
|
263
|
-
claude "Write unit tests for utils/validation.js"
|
|
264
|
-
|
|
265
|
-
# Generate documentation
|
|
266
|
-
claude "Add JSDoc comments to this file" < src/helpers.js
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
---
|
|
270
|
-
|
|
271
|
-
## Provider-Specific Considerations
|
|
272
|
-
|
|
273
|
-
### AWS Bedrock
|
|
274
|
-
|
|
275
|
-
**Best for:** AWS ecosystem, 100+ models
|
|
276
|
-
|
|
277
|
-
```bash
|
|
278
|
-
export MODEL_PROVIDER=bedrock
|
|
279
|
-
export AWS_BEDROCK_MODEL_ID=anthropic.claude-3-5-sonnet-20241022-v2:0
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
**Considerations:**
|
|
283
|
-
- ✅ Tool calling works (Claude models only)
|
|
284
|
-
- ✅ Streaming supported
|
|
285
|
-
- ⚠️ Non-Claude models don't support tools
|
|
286
|
-
|
|
287
|
-
---
|
|
288
|
-
|
|
289
|
-
### Ollama (Local)
|
|
290
|
-
|
|
291
|
-
**Best for:** Privacy, offline work, zero costs
|
|
292
|
-
|
|
293
|
-
```bash
|
|
294
|
-
export MODEL_PROVIDER=ollama
|
|
295
|
-
export OLLAMA_MODEL=llama3.1:8b
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
**Considerations:**
|
|
299
|
-
- ✅ 100% FREE, runs locally
|
|
300
|
-
- ✅ Tool calling supported (llama3.1, llama3.2, qwen2.5, mistral)
|
|
301
|
-
- ⚠️ Smaller models may struggle with complex tool usage
|
|
302
|
-
- 💡 Use `qwen2.5:14b` for better tool calling
|
|
303
|
-
|
|
304
|
-
**Recommended models:**
|
|
305
|
-
- `llama3.1:8b` - Good balance
|
|
306
|
-
- `qwen2.5:14b` - Better reasoning (7b struggles)
|
|
307
|
-
- `mistral:7b-instruct` - Fast and capable
|
|
308
|
-
|
|
309
|
-
---
|
|
310
|
-
|
|
311
|
-
### OpenRouter
|
|
312
|
-
|
|
313
|
-
**Best for:** Simplicity, flexibility, 100+ models
|
|
314
|
-
|
|
315
|
-
```bash
|
|
316
|
-
export MODEL_PROVIDER=openrouter
|
|
317
|
-
export OPENROUTER_MODEL=anthropic/claude-3.5-sonnet
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
**Considerations:**
|
|
321
|
-
- ✅ 100+ models available
|
|
322
|
-
- ✅ Excellent tool calling support
|
|
323
|
-
- ✅ Automatic fallbacks
|
|
324
|
-
- 💰 Competitive pricing
|
|
325
|
-
|
|
326
|
-
---
|
|
327
|
-
|
|
328
|
-
### Databricks
|
|
329
|
-
|
|
330
|
-
**Best for:** Enterprise production, Claude 4.5
|
|
331
|
-
|
|
332
|
-
```bash
|
|
333
|
-
export MODEL_PROVIDER=databricks
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
**Considerations:**
|
|
337
|
-
- ✅ Claude Sonnet 4.5, Opus 4.5
|
|
338
|
-
- ✅ Enterprise SLA
|
|
339
|
-
- ✅ Excellent tool calling
|
|
340
|
-
- 💰 Enterprise pricing
|
|
341
|
-
|
|
342
|
-
---
|
|
343
|
-
|
|
344
|
-
## Tier-Based Routing (Cost Optimization)
|
|
345
|
-
|
|
346
|
-
Use local Ollama for simple tasks, cloud for complex ones:
|
|
347
|
-
|
|
348
|
-
```bash
|
|
349
|
-
# Configure tier-based routing (set all 4 to enable)
|
|
350
|
-
export TIER_SIMPLE=ollama:llama3.2
|
|
351
|
-
export TIER_MEDIUM=openrouter:openai/gpt-4o-mini
|
|
352
|
-
export TIER_COMPLEX=databricks:databricks-claude-sonnet-4-5
|
|
353
|
-
export TIER_REASONING=databricks:databricks-claude-sonnet-4-5
|
|
354
|
-
export FALLBACK_ENABLED=true
|
|
355
|
-
export FALLBACK_PROVIDER=databricks
|
|
356
|
-
export DATABRICKS_API_BASE=https://your-workspace.databricks.com
|
|
357
|
-
export DATABRICKS_API_KEY=your-key
|
|
358
|
-
|
|
359
|
-
# Start Lynkr
|
|
360
|
-
lynkr start
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
**How it works:**
|
|
364
|
-
- Each request is scored for complexity (0-100) and mapped to a tier
|
|
365
|
-
- **SIMPLE (0-25)**: Ollama (free, local, fast)
|
|
366
|
-
- **MEDIUM (26-50)**: OpenRouter (affordable cloud)
|
|
367
|
-
- **COMPLEX (51-75)**: Databricks (most capable)
|
|
368
|
-
- **REASONING (76-100)**: Databricks (best available)
|
|
369
|
-
- **Provider failures**: Automatic transparent fallback to cloud
|
|
370
|
-
|
|
371
|
-
**Cost savings:**
|
|
372
|
-
- **65-100%** for requests routed to local models
|
|
373
|
-
- **40-87%** faster for simple requests
|
|
374
|
-
|
|
375
|
-
---
|
|
376
|
-
|
|
377
|
-
## Verification & Testing
|
|
378
|
-
|
|
379
|
-
### Check Lynkr Health
|
|
380
|
-
|
|
381
|
-
```bash
|
|
382
|
-
curl http://localhost:8081/health/live
|
|
383
|
-
|
|
384
|
-
# Expected response:
|
|
385
|
-
{
|
|
386
|
-
"status": "ok",
|
|
387
|
-
"provider": "bedrock",
|
|
388
|
-
"timestamp": "2026-01-12T00:00:00.000Z"
|
|
389
|
-
}
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
### Test API Endpoint
|
|
393
|
-
|
|
394
|
-
```bash
|
|
395
|
-
curl http://localhost:8081/v1/messages \
|
|
396
|
-
-H "Content-Type: application/json" \
|
|
397
|
-
-H "anthropic-version: 2023-06-01" \
|
|
398
|
-
-d '{
|
|
399
|
-
"model": "claude-3-5-sonnet-20241022",
|
|
400
|
-
"max_tokens": 1024,
|
|
401
|
-
"messages": [
|
|
402
|
-
{"role": "user", "content": "Hello!"}
|
|
403
|
-
]
|
|
404
|
-
}'
|
|
405
|
-
|
|
406
|
-
# Should return Claude-compatible response from your provider
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
### Test Claude CLI
|
|
410
|
-
|
|
411
|
-
```bash
|
|
412
|
-
# Simple test
|
|
413
|
-
claude "Hello, can you see this?"
|
|
414
|
-
|
|
415
|
-
# Tool calling test
|
|
416
|
-
claude "What files are in the current directory?"
|
|
417
|
-
|
|
418
|
-
# Should use Read/Bash tools and return results
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
---
|
|
422
|
-
|
|
423
|
-
## Troubleshooting
|
|
424
|
-
|
|
425
|
-
### Connection Refused
|
|
426
|
-
|
|
427
|
-
**Symptoms:** `Connection refused` or `ECONNREFUSED`
|
|
428
|
-
|
|
429
|
-
**Solutions:**
|
|
430
|
-
|
|
431
|
-
1. **Verify Lynkr is running:**
|
|
432
|
-
```bash
|
|
433
|
-
lsof -i :8081
|
|
434
|
-
# Should show node process
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
2. **Check URL configuration:**
|
|
438
|
-
```bash
|
|
439
|
-
echo $ANTHROPIC_BASE_URL
|
|
440
|
-
# Should be: http://localhost:8081
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
3. **Test health endpoint:**
|
|
444
|
-
```bash
|
|
445
|
-
curl http://localhost:8081/health/live
|
|
446
|
-
# Should return: {"status":"ok"}
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
---
|
|
450
|
-
|
|
451
|
-
### Provider Authentication Errors
|
|
452
|
-
|
|
453
|
-
**Symptoms:** `401 Unauthorized` or `403 Forbidden`
|
|
454
|
-
|
|
455
|
-
**Solutions:**
|
|
456
|
-
|
|
457
|
-
1. **Check provider credentials:**
|
|
458
|
-
```bash
|
|
459
|
-
# For Bedrock
|
|
460
|
-
echo $AWS_BEDROCK_API_KEY
|
|
461
|
-
|
|
462
|
-
# For Databricks
|
|
463
|
-
echo $DATABRICKS_API_KEY
|
|
464
|
-
|
|
465
|
-
# For OpenRouter
|
|
466
|
-
echo $OPENROUTER_API_KEY
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
2. **Verify credentials are valid:**
|
|
470
|
-
- Bedrock: Check AWS Console → Bedrock → API Keys
|
|
471
|
-
- Databricks: Check workspace → Settings → User Settings → Tokens
|
|
472
|
-
- OpenRouter: Check openrouter.ai/keys
|
|
473
|
-
|
|
474
|
-
3. **Check Lynkr logs:**
|
|
475
|
-
```bash
|
|
476
|
-
# In Lynkr terminal, look for authentication errors
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
---
|
|
480
|
-
|
|
481
|
-
### Tool Execution Errors
|
|
482
|
-
|
|
483
|
-
**Symptoms:** Tools fail to execute or return errors
|
|
484
|
-
|
|
485
|
-
**Solutions:**
|
|
486
|
-
|
|
487
|
-
1. **Check tool execution mode:**
|
|
488
|
-
```bash
|
|
489
|
-
echo $TOOL_EXECUTION_MODE
|
|
490
|
-
# Should be: server (default) or client
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
2. **Verify workspace root:**
|
|
494
|
-
```bash
|
|
495
|
-
echo $WORKSPACE_ROOT
|
|
496
|
-
# Should be valid directory path
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
3. **Check file permissions:**
|
|
500
|
-
```bash
|
|
501
|
-
# For server mode, Lynkr needs read/write access
|
|
502
|
-
ls -la $WORKSPACE_ROOT
|
|
503
|
-
```
|
|
504
|
-
|
|
505
|
-
---
|
|
506
|
-
|
|
507
|
-
### Model Not Found
|
|
508
|
-
|
|
509
|
-
**Symptoms:** `Model not found` or `Invalid model`
|
|
510
|
-
|
|
511
|
-
**Solutions:**
|
|
512
|
-
|
|
513
|
-
1. **Verify model is available:**
|
|
514
|
-
```bash
|
|
515
|
-
# For Ollama
|
|
516
|
-
ollama list
|
|
517
|
-
# Should show your configured model
|
|
518
|
-
|
|
519
|
-
# For Bedrock
|
|
520
|
-
# Check AWS Console → Bedrock → Model access
|
|
521
|
-
```
|
|
522
|
-
|
|
523
|
-
2. **Check model name matches provider:**
|
|
524
|
-
- Bedrock: Use full model ID (e.g., `anthropic.claude-3-5-sonnet-20241022-v2:0`)
|
|
525
|
-
- Ollama: Use exact model name (e.g., `llama3.1:8b`)
|
|
526
|
-
- OpenRouter: Use provider prefix (e.g., `anthropic/claude-3.5-sonnet`)
|
|
527
|
-
|
|
528
|
-
---
|
|
529
|
-
|
|
530
|
-
### Slow Responses
|
|
531
|
-
|
|
532
|
-
**Symptoms:** Responses take 5+ seconds
|
|
533
|
-
|
|
534
|
-
**Solutions:**
|
|
535
|
-
|
|
536
|
-
1. **Check provider latency:**
|
|
537
|
-
- Local (Ollama): Should be 100-500ms
|
|
538
|
-
- Cloud: Should be 500ms-2s
|
|
539
|
-
|
|
540
|
-
2. **Enable tier-based routing:**
|
|
541
|
-
```bash
|
|
542
|
-
# Set all 4 TIER_* env vars to enable tier-based routing
|
|
543
|
-
export TIER_SIMPLE=ollama:llama3.2
|
|
544
|
-
export TIER_MEDIUM=openrouter:openai/gpt-4o-mini
|
|
545
|
-
export TIER_COMPLEX=azure-openai:gpt-4o
|
|
546
|
-
export TIER_REASONING=azure-openai:gpt-4o
|
|
547
|
-
export FALLBACK_ENABLED=true
|
|
548
|
-
```
|
|
549
|
-
|
|
550
|
-
3. **Check Lynkr logs for actual response times**
|
|
551
|
-
|
|
552
|
-
---
|
|
553
|
-
|
|
554
|
-
### Enable Debug Logging
|
|
555
|
-
|
|
556
|
-
For detailed troubleshooting:
|
|
557
|
-
|
|
558
|
-
```bash
|
|
559
|
-
# In .env or export
|
|
560
|
-
export LOG_LEVEL=debug
|
|
561
|
-
|
|
562
|
-
# Restart Lynkr
|
|
563
|
-
lynkr start
|
|
564
|
-
|
|
565
|
-
# Check logs for detailed request/response info
|
|
566
|
-
```
|
|
567
|
-
|
|
568
|
-
---
|
|
569
|
-
|
|
570
|
-
## Advanced Configuration
|
|
571
|
-
|
|
572
|
-
### Custom Port
|
|
573
|
-
|
|
574
|
-
```bash
|
|
575
|
-
# Change Lynkr port
|
|
576
|
-
export PORT=8082
|
|
577
|
-
|
|
578
|
-
# Update Claude CLI configuration
|
|
579
|
-
export ANTHROPIC_BASE_URL=http://localhost:8082
|
|
580
|
-
```
|
|
581
|
-
|
|
582
|
-
---
|
|
583
|
-
|
|
584
|
-
### Custom Workspace Root
|
|
585
|
-
|
|
586
|
-
```bash
|
|
587
|
-
# Set specific workspace directory
|
|
588
|
-
export WORKSPACE_ROOT=/path/to/your/projects
|
|
589
|
-
|
|
590
|
-
# Claude CLI will use this as base directory for file operations
|
|
591
|
-
```
|
|
592
|
-
|
|
593
|
-
---
|
|
594
|
-
|
|
595
|
-
### Tool Execution Policies
|
|
596
|
-
|
|
597
|
-
```bash
|
|
598
|
-
# Allow git push (default: disabled)
|
|
599
|
-
export POLICY_GIT_ALLOW_PUSH=true
|
|
600
|
-
|
|
601
|
-
# Require tests before commit (default: disabled)
|
|
602
|
-
export POLICY_GIT_REQUIRE_TESTS=true
|
|
603
|
-
|
|
604
|
-
# Custom test command
|
|
605
|
-
export POLICY_GIT_TEST_COMMAND="npm test"
|
|
606
|
-
```
|
|
607
|
-
|
|
608
|
-
---
|
|
609
|
-
|
|
610
|
-
### Memory System
|
|
611
|
-
|
|
612
|
-
```bash
|
|
613
|
-
# Enable long-term memory (default: enabled)
|
|
614
|
-
export MEMORY_ENABLED=true
|
|
615
|
-
|
|
616
|
-
# Memories to inject per request
|
|
617
|
-
export MEMORY_RETRIEVAL_LIMIT=5
|
|
618
|
-
|
|
619
|
-
# Surprise threshold (0.0-1.0)
|
|
620
|
-
export MEMORY_SURPRISE_THRESHOLD=0.3
|
|
621
|
-
```
|
|
622
|
-
|
|
623
|
-
See [Memory System Guide](memory-system.md) for details.
|
|
624
|
-
|
|
625
|
-
---
|
|
626
|
-
|
|
627
|
-
## Cost Comparison
|
|
628
|
-
|
|
629
|
-
**Scenario:** 100,000 requests/month, average 50k input tokens, 2k output tokens
|
|
630
|
-
|
|
631
|
-
| Provider | Without Lynkr | With Lynkr (60% savings) | Monthly Savings |
|
|
632
|
-
|----------|---------------|-------------------------|-----------------|
|
|
633
|
-
| **Claude Sonnet 4.5** (via Databricks) | $16,000 | $6,400 | **$9,600** |
|
|
634
|
-
| **GPT-4o** (via OpenRouter) | $12,000 | $4,800 | **$7,200** |
|
|
635
|
-
| **Ollama (Local)** | API costs + compute | Local compute only | **$12,000+** |
|
|
636
|
-
|
|
637
|
-
**Token optimization includes:**
|
|
638
|
-
- Smart tool selection (50-70% reduction for simple queries)
|
|
639
|
-
- Prompt caching (30-45% reduction for repeated prompts)
|
|
640
|
-
- Memory deduplication (20-30% reduction for long conversations)
|
|
641
|
-
- Tool truncation (15-25% reduction for tool responses)
|
|
642
|
-
|
|
643
|
-
See [Token Optimization Guide](token-optimization.md) for details.
|
|
644
|
-
|
|
645
|
-
---
|
|
646
|
-
|
|
647
|
-
## Architecture
|
|
648
|
-
|
|
649
|
-
```
|
|
650
|
-
Claude Code CLI
|
|
651
|
-
↓ Anthropic API format
|
|
652
|
-
Lynkr Proxy (localhost:8081)
|
|
653
|
-
↓ Format conversion
|
|
654
|
-
Your Provider (Databricks/Bedrock/OpenRouter/Ollama/etc.)
|
|
655
|
-
↓ Returns response
|
|
656
|
-
Lynkr Proxy
|
|
657
|
-
↓ Format conversion back
|
|
658
|
-
Claude Code CLI (displays result)
|
|
659
|
-
```
|
|
660
|
-
|
|
661
|
-
---
|
|
662
|
-
|
|
663
|
-
## Next Steps
|
|
664
|
-
|
|
665
|
-
- **[Provider Configuration](providers.md)** - Configure all 12+ providers
|
|
666
|
-
- **[Installation Guide](installation.md)** - Detailed installation
|
|
667
|
-
- **[Features Guide](features.md)** - Learn about advanced features
|
|
668
|
-
- **[Token Optimization](token-optimization.md)** - Maximize cost savings
|
|
669
|
-
- **[Memory System](memory-system.md)** - Long-term memory
|
|
670
|
-
- **[Production Deployment](production.md)** - Deploy to production
|
|
671
|
-
|
|
672
|
-
---
|
|
673
|
-
|
|
674
|
-
## Getting Help
|
|
675
|
-
|
|
676
|
-
- **[Troubleshooting Guide](troubleshooting.md)** - Common issues and solutions
|
|
677
|
-
- **[FAQ](faq.md)** - Frequently asked questions
|
|
678
|
-
- **[GitHub Discussions](https://github.com/vishalveerareddy123/Lynkr/discussions)** - Community Q&A
|
|
679
|
-
- **[GitHub Issues](https://github.com/vishalveerareddy123/Lynkr/issues)** - Report bugs
|