lynkr 3.2.0 → 3.3.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/README.md CHANGED
@@ -1,21 +1,22 @@
1
- # Lynkr - Production-Ready Claude Code Proxy with Multi-Provider Support, MCP Integration & Token Optimization
1
+ # Lynkr - Claude Code Proxy with Multi-Provider Support, MCP Integration & Token Optimization
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/lynkr.svg)](https://www.npmjs.com/package/lynkr "Lynkr NPM Package - Claude Code Proxy Server")
4
4
  [![Homebrew Tap](https://img.shields.io/badge/homebrew-lynkr-brightgreen.svg)](https://github.com/vishalveerareddy123/homebrew-lynkr "Install Lynkr via Homebrew")
5
5
  [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE "Apache 2.0 License - Open Source Claude Code Alternative")
6
6
  [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/vishalveerareddy123/Lynkr "Lynkr Documentation on DeepWiki")
7
7
  [![Databricks Supported](https://img.shields.io/badge/Databricks-Supported-orange)](https://www.databricks.com/ "Databricks Claude Integration")
8
+ [![AWS Bedrock](https://img.shields.io/badge/AWS%20Bedrock-100%2B%20Models-FF9900)](https://aws.amazon.com/bedrock/ "AWS Bedrock - 100+ Models")
8
9
  [![OpenAI Compatible](https://img.shields.io/badge/OpenAI-Compatible-412991)](https://openai.com/ "OpenAI GPT Integration")
9
10
  [![Ollama Compatible](https://img.shields.io/badge/Ollama-Compatible-brightgreen)](https://ollama.ai/ "Local Ollama Model Support")
10
11
  [![llama.cpp Compatible](https://img.shields.io/badge/llama.cpp-Compatible-blue)](https://github.com/ggerganov/llama.cpp "llama.cpp GGUF Model Support")
11
12
  [![IndexNow Enabled](https://img.shields.io/badge/IndexNow-Enabled-success?style=flat-square)](https://www.indexnow.org/ "SEO Optimized with IndexNow")
12
13
  [![DevHunt](https://img.shields.io/badge/DevHunt-Lynkr-orange)](https://devhunt.org/tool/lynkr "Lynkr on DevHunt")
13
14
 
14
- > **Production-ready Claude Code proxy server supporting Databricks, OpenRouter, Ollama & Azure. Features MCP integration, prompt caching & 60-80% token optimization savings.**
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 local Ollama (free, offline)
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 B: Use Databricks (production)
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
- | **Tool Calling** | Excellent | Excellent | Excellent | Excellent | Good | Fair | Good |
250
- | **Context Length** | 200K | 128K | 128K | 200K | Varies | 32K-128K | Model-dependent |
251
- | **Streaming** | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
252
- | **Privacy** | Enterprise | Third-party | Enterprise | Enterprise | Third-party | Local | Local |
253
- | **Offline** | No | No | No | No | No | Yes | Yes |
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
 
@@ -0,0 +1,173 @@
1
+ # Comparison: claude-code-router vs Lynkr Proxy
2
+
3
+ ## Architecture Differences
4
+
5
+ **claude-code-router:**
6
+ - **CLI-first design** - `ccr` commands for interactive model switching
7
+ - **Request interceptor** - Sits between Claude Code CLI and LLM providers
8
+ - **Transformer pipeline** - Middleware system for request/response modification
9
+ - **Built with Fastify** (web framework)
10
+ - **TypeScript + esbuild** compilation
11
+ - **Web UI** for configuration
12
+
13
+ **Lynkr:**
14
+ - **HTTP proxy server** - Express-based API endpoint
15
+ - **Provider abstraction** - Unified interface for 7+ providers
16
+ - **Long-term memory system** (Titans-inspired)
17
+ - **Built with Express** (web framework)
18
+ - **Pure JavaScript** (no compilation)
19
+ - **Token optimization focus** (6 optimization phases)
20
+
21
+ ---
22
+
23
+ ## Key Feature Comparison
24
+
25
+ | Feature | claude-code-router | Lynkr | Winner |
26
+ |---------|-------------------|-------|--------|
27
+ | **Dynamic Model Switching** | ✅ Runtime `/model` command | ❌ Static .env config | 🏆 Router |
28
+ | **Routing Logic** | ✅ Context-aware (think/background/long-context) | ❌ Simple provider fallback only | 🏆 Router |
29
+ | **Custom Router Scripts** | ✅ JavaScript-based routing rules | ❌ No custom routing | 🏆 Router |
30
+ | **Web UI** | ✅ `ccr ui` browser interface | ❌ No UI | 🏆 Router |
31
+ | **Long-Term Memory** | ❌ None | ✅ Vector search + surprise scoring | 🏆 Lynkr |
32
+ | **Token Optimization** | ⚠️ Basic (long-context detection) | ✅ 6 phases (smart tools, compression, etc.) | 🏆 Lynkr |
33
+ | **Smart Tool Selection** | ❌ None | ✅ Heuristic-based (just implemented) | 🏆 Lynkr |
34
+ | **History Compression** | ❌ None | ✅ Automatic + token budget enforcement | 🏆 Lynkr |
35
+ | **Prompt Caching** | ✅ Via transformer | ✅ Built-in | 🟰 Tie |
36
+ | **Provider Count** | 6 (OpenRouter, DeepSeek, Ollama, Gemini, etc.) | 7 (Databricks, Azure, OpenAI, OpenRouter, Ollama, llama.cpp) | 🟰 Tie |
37
+ | **Tool Enhancement** | ✅ `enhancetool` transformer | ❌ Basic passthrough | 🏆 Router |
38
+ | **GitHub Actions** | ✅ CI/CD integration | ❌ None | 🏆 Router |
39
+ | **Logging** | ✅ Rotating file logs | ✅ Pino logger | 🟰 Tie |
40
+ | **TypeScript** | ✅ Full TypeScript | ❌ JavaScript only | 🏆 Router |
41
+
42
+ ---
43
+
44
+ ## Improvements for Lynkr (Ranked by Impact)
45
+
46
+ ### 🔴 **Critical - High Impact, High Value**
47
+
48
+ #### 1. Dynamic Model Switching via `/model` Command
49
+ - **What**: Allow users to switch models mid-conversation without restarting server
50
+ - **Why**: Router's killer feature - flexibility without configuration edits
51
+ - **Implementation**: Add chat command parser, session-level model overrides
52
+ - **Effort**: Medium (2-3 days)
53
+
54
+ #### 2. Context-Aware Routing (Background/Think/Long-Context)
55
+ - **What**: Automatically route requests based on context type
56
+ - **Why**: Cost optimization + performance (cheap models for background, reasoning models for planning)
57
+ - **Example**:
58
+ - Background tasks → `gpt-4o-mini` ($0.15/1M)
59
+ - Planning/thinking → `o1-preview` (reasoning model)
60
+ - Long context (>60k tokens) → `claude-sonnet-4` (200k context)
61
+ - **Effort**: Medium (3-4 days)
62
+
63
+ #### 3. Custom Router Scripts (JavaScript-based)
64
+ - **What**: Let users define routing logic in JavaScript
65
+ - **Why**: Ultimate flexibility - enterprise users need custom rules
66
+ - **Example**:
67
+ ```javascript
68
+ // router.js
69
+ module.exports = function(request) {
70
+ if (request.tools.length > 5) return 'gpt-4o'; // Complex task
71
+ if (request.content.includes('urgent')) return 'databricks'; // Fast provider
72
+ return 'openrouter/nova-lite'; // Default cheap
73
+ }
74
+ ```
75
+ - **Effort**: High (5-7 days)
76
+
77
+ #### 4. Web UI for Configuration
78
+ - **What**: Browser-based interface at `http://localhost:8081/ui`
79
+ - **Why**: Non-technical users can't edit .env files
80
+ - **Features**: Model selection, provider config, logs viewer, cost tracking
81
+ - **Effort**: High (7-10 days)
82
+
83
+ ### 🟡 **High Impact, Medium Complexity**
84
+
85
+ #### 5. Tool Enhancement Transformer
86
+ - **What**: Add error tolerance and response buffering to tool calls
87
+ - **Why**: Prevents cascade failures when tools return malformed JSON
88
+ - **Example**: Retry tool calls with exponential backoff, validate tool outputs
89
+ - **Effort**: Low (1-2 days)
90
+
91
+ #### 6. Request/Response Transformer Pipeline
92
+ - **What**: Middleware system to modify requests/responses per provider
93
+ - **Why**: Provider-specific quirks (Azure needs different format, Ollama strips thinking blocks)
94
+ - **Current**: Hardcoded in client adapters
95
+ - **Improved**: Pluggable transformer chain
96
+ - **Effort**: Medium (3-4 days)
97
+
98
+ #### 7. Token-Based Auto-Routing
99
+ - **What**: Switch to high-context models when input exceeds threshold
100
+ - **Why**: Prevent truncation errors, automatic upgrade
101
+ - **Example**: Request >100k tokens → auto-switch from `gpt-4o` (128k) to `claude-sonnet-4` (200k)
102
+ - **Effort**: Low (1-2 days) - you already have token counting
103
+
104
+ ### 🟢 **Nice to Have - Lower Priority**
105
+
106
+ #### 8. GitHub Actions Integration
107
+ - **What**: Trigger Claude Code workflows in CI/CD
108
+ - **Why**: Automated code reviews, documentation generation
109
+ - **Use Case**: PR opens → Claude reviews code → posts comments
110
+ - **Effort**: Medium (3-4 days)
111
+
112
+ #### 9. CLI Commands (`lynkr model`, `lynkr ui`)
113
+ - **What**: Interactive terminal commands for management
114
+ - **Why**: Better DX than editing .env and restarting
115
+ - **Effort**: Medium (2-3 days)
116
+
117
+ #### 10. Rotating File Logs
118
+ - **What**: Auto-rotate logs by size/date (keep last 7 days)
119
+ - **Why**: Prevent disk bloat in production
120
+ - **Current**: Pino logs to stdout only
121
+ - **Effort**: Low (1 day) - use `pino-rotating-file-stream`
122
+
123
+ #### 11. LRU Caching for Responses
124
+ - **What**: Cache identical requests for X minutes
125
+ - **Why**: Save money on repeated queries
126
+ - **Example**: User asks "what is 2+2?" 3 times → only 1 LLM call
127
+ - **Effort**: Low (1-2 days)
128
+
129
+ #### 12. TypeScript Migration
130
+ - **What**: Convert codebase to TypeScript
131
+ - **Why**: Type safety, better IDE support, fewer runtime errors
132
+ - **Effort**: Very High (15-20 days) - 87 files to convert
133
+
134
+ ---
135
+
136
+ ## Unique Strengths of Lynkr (Don't Lose These!)
137
+
138
+ 1. **Long-term memory system** - Router doesn't have this
139
+ 2. **Smart tool selection** - Just implemented, very valuable
140
+ 3. **6-phase token optimization** - Industry-leading
141
+ 4. **History compression** - Automatic context management
142
+ 5. **7 providers** - Broader support than Router
143
+ 6. **Hybrid routing** - Ollama + cloud fallback
144
+
145
+ ---
146
+
147
+ ## Recommended Implementation Order
148
+
149
+ ### Phase 1: Quick Wins (1-2 weeks)
150
+ 1. Token-based auto-routing
151
+ 2. Tool enhancement transformer
152
+ 3. Rotating file logs
153
+ 4. LRU caching
154
+
155
+ ### Phase 2: Game Changers (3-4 weeks)
156
+ 5. Dynamic model switching via `/model` command
157
+ 6. Context-aware routing (background/think/long-context)
158
+ 7. Request/Response transformer pipeline
159
+
160
+ ### Phase 3: Enterprise Features (4-6 weeks)
161
+ 8. Custom router scripts
162
+ 9. Web UI
163
+ 10. CLI commands
164
+ 11. GitHub Actions integration
165
+
166
+ ### Phase 4: Long-Term (Optional)
167
+ 12. TypeScript migration
168
+
169
+ ---
170
+
171
+ ## Bottom Line
172
+
173
+ Router excels at **flexibility and user experience** (dynamic switching, routing logic, Web UI). Lynkr excels at **optimization and intelligence** (memory, token optimization, smart tools). Merging the best of both would create the ultimate Claude Code proxy.