Skip to content

Commit 71ba15a

Browse files
author
vishal veerareddy
committed
Added init
1 parent 4be83ba commit 71ba15a

4 files changed

Lines changed: 205 additions & 407 deletions

File tree

README.md

Lines changed: 11 additions & 323 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Lynkr
22

3-
### The AI coding proxy that compresses tokens before they hit the model.
3+
### An LLM Gateway which optimises your token usage.
44

55
**87.6% fewer tokens on JSON tool results. 53% fewer tokens on tool-heavy requests. 171ms semantic cache hits. Zero code changes.**
66

@@ -31,20 +31,11 @@
3131
```bash
3232
npm install -g lynkr
3333

34+
3435
# Claude Code Pro/Max
3536
lynkr wrap claude
3637

37-
# GitHub Copilot
38-
lynkr wrap copilot
39-
40-
# Aider
41-
lynkr wrap aider
4238

43-
# Cursor
44-
lynkr wrap cursor
45-
46-
# OpenAI Codex
47-
lynkr wrap codex
4839
```
4940

5041
**Wrapping gives you:**
@@ -68,102 +59,31 @@ npm install -g lynkr
6859

6960
### 2. Configure Lynkr
7061

71-
Run the interactive wizard — it walks you through choosing your usage mode (Claude Pro/Max subscription or direct API), picks a provider + model for each tier, collects credentials once, and writes a working `.env`:
62+
The fastest path is the interactive wizard:
7263

7364
```bash
7465
lynkr init
7566
```
7667

77-
The wizard covers all 12 supported providers. To re-run on top of an existing `.env`, use `lynkr init --force`. For the manual route, copy `.env.example` to `.env` and edit by hand:
68+
It asks four questions — usage mode (Claude Pro/Max via wrap, or direct API keys), tier picks for SIMPLE/MEDIUM/COMPLEX/REASONING across the 12 supported providers, credentials for what you chose, and a few routing-intelligence knobs — then writes a fully-populated `.env` with sensible production defaults for everything else (caching, compression, policy budgets, MCP sandbox, agents, rate limiting).
7869

79-
**Option A: Free & Local (Ollama) - Recommended for Testing**
70+
Useful flags:
8071

8172
```bash
82-
# Install Ollama first: https://ollama.com
83-
ollama pull qwen2.5-coder:latest
73+
lynkr init --force # overwrite an existing .env
8474
```
8575

86-
Create/edit `.env` in your project directory:
87-
```bash
88-
# Provider
89-
MODEL_PROVIDER=ollama
90-
FALLBACK_ENABLED=false
91-
92-
# Ollama Configuration
93-
OLLAMA_ENDPOINT=http://localhost:11434
94-
OLLAMA_MODEL=qwen2.5-coder:latest
95-
96-
# Server
97-
PORT=8081
98-
99-
# Optional: Limits (remove for unlimited)
100-
POLICY_MAX_STEPS=50
101-
POLICY_MAX_TOOL_CALLS=100
102-
103-
# Disable overly strict command filtering
104-
POLICY_SAFE_COMMANDS_ENABLED=false
105-
```
76+
See [`docs/init.md`](docs/init.md) for the full wizard reference.
10677

107-
**Option B: Cloud (OpenRouter) - Recommended for Production**
78+
If you'd rather configure by hand, the manual options below still work — copy `.env.example` to `.env` and edit it directly:
10879

109-
```bash
110-
# Get API key from https://openrouter.ai
111-
```
112-
113-
Create/edit `.env`:
114-
```bash
115-
# Provider
116-
MODEL_PROVIDER=openrouter
117-
OPENROUTER_API_KEY=sk-or-v1-your-key-here
118-
FALLBACK_ENABLED=false
119-
120-
# Server
121-
PORT=8081
122-
123-
# Optional: Limits (remove for unlimited)
124-
POLICY_MAX_STEPS=50
125-
POLICY_MAX_TOOL_CALLS=100
126-
127-
# Optional: Enable caching
128-
PROMPT_CACHE_ENABLED=true
129-
SEMANTIC_CACHE_ENABLED=true
130-
```
131-
132-
**Option C: Enterprise (AWS Bedrock)**
80+
**Option A: Free & Local (Ollama) - Recommended for Testing**
13381

134-
Create/edit `.env`:
13582
```bash
136-
# Provider
137-
MODEL_PROVIDER=bedrock
138-
AWS_BEDROCK_API_KEY=your-aws-key
139-
AWS_BEDROCK_MODEL_ID=anthropic.claude-3-5-sonnet-20241022-v2:0
140-
FALLBACK_ENABLED=false
141-
142-
# Server
143-
PORT=8081
144-
145-
# Optional: Limits (remove for unlimited)
146-
POLICY_MAX_STEPS=50
147-
POLICY_MAX_TOOL_CALLS=100
83+
# Install Ollama first: https://ollama.com
84+
ollama pull qwen2.5-coder:latest
14885
```
14986

150-
**Option D: Enterprise (Databricks)**
151-
152-
Create/edit `.env`:
153-
```bash
154-
# Provider
155-
MODEL_PROVIDER=databricks
156-
DATABRICKS_API_BASE=https://your-workspace.cloud.databricks.com
157-
DATABRICKS_API_KEY=your-token
158-
FALLBACK_ENABLED=false
159-
160-
# Server
161-
PORT=8081
162-
163-
# Optional: Limits (remove for unlimited)
164-
POLICY_MAX_STEPS=50
165-
POLICY_MAX_TOOL_CALLS=100
166-
```
16787

16888
Then start Lynkr:
16989

@@ -173,21 +93,6 @@ lynkr start
17393

17494
### 3. Connect Your Tool
17595

176-
**Claude Code**
177-
178-
**Windows (Command Prompt):**
179-
```cmd
180-
set ANTHROPIC_BASE_URL=http://localhost:8081
181-
set ANTHROPIC_API_KEY=dummy
182-
claude "write a hello world in python"
183-
```
184-
185-
**Linux/macOS:**
186-
```bash
187-
export ANTHROPIC_BASE_URL=http://localhost:8081
188-
export ANTHROPIC_API_KEY=dummy
189-
claude "write a hello world in python"
190-
```
19196

19297
**Cursor IDE**
19398
- Settings → Models → Override Base URL
@@ -344,223 +249,6 @@ Tier configuration is strictly authoritative — bandit exploration is constrain
344249

345250
---
346251

347-
## Complete .env Examples
348-
349-
### MVP: Minimal Working Setup (Ollama)
350-
351-
Copy-paste ready configuration for immediate use:
352-
353-
```bash
354-
# .env - Minimal Ollama Setup
355-
356-
# ============================================
357-
# REQUIRED: Provider Configuration
358-
# ============================================
359-
MODEL_PROVIDER=ollama
360-
FALLBACK_ENABLED=false
361-
362-
# ============================================
363-
# REQUIRED: Ollama Settings
364-
# ============================================
365-
OLLAMA_ENDPOINT=http://localhost:11434
366-
OLLAMA_MODEL=qwen2.5-coder:latest
367-
368-
# ============================================
369-
# REQUIRED: Server Configuration
370-
# ============================================
371-
PORT=8081
372-
HOST=0.0.0.0
373-
374-
# ============================================
375-
# REQUIRED: Claude Code/Cursor Compatibility
376-
# ============================================
377-
POLICY_MAX_STEPS=50
378-
POLICY_MAX_TOOL_CALLS=100
379-
POLICY_SAFE_COMMANDS_ENABLED=false
380-
381-
# ============================================
382-
# OPTIONAL: Performance (Recommended)
383-
# ============================================
384-
LOG_LEVEL=warn
385-
LOAD_SHEDDING_ENABLED=true
386-
LOAD_SHEDDING_HEAP_THRESHOLD=0.85
387-
```
388-
389-
**Steps:**
390-
1. Install Ollama: `curl -fsSL https://ollama.com/install.sh | sh`
391-
2. Pull model: `ollama pull qwen2.5-coder:latest`
392-
3. Copy above to `.env` in your project directory
393-
4. Run: `lynkr start`
394-
395-
---
396-
397-
### Production: Cloud with Tier Routing (OpenRouter)
398-
399-
Optimized for cost savings with smart routing:
400-
401-
```bash
402-
# .env - Production OpenRouter Setup
403-
404-
# ============================================
405-
# REQUIRED: Provider Configuration
406-
# ============================================
407-
MODEL_PROVIDER=openrouter
408-
OPENROUTER_API_KEY=sk-or-v1-your-key-here
409-
FALLBACK_ENABLED=false
410-
411-
# ============================================
412-
# REQUIRED: Server Configuration
413-
# ============================================
414-
PORT=8081
415-
HOST=0.0.0.0
416-
417-
# ============================================
418-
# TIER ROUTING: Smart Cost Optimization
419-
# ============================================
420-
# Simple queries → Cheap/fast model
421-
TIER_SIMPLE=openrouter:google/gemini-flash-1.5
422-
423-
# Normal coding → Balanced model
424-
TIER_MEDIUM=openrouter:anthropic/claude-3.5-sonnet
425-
426-
# Complex refactoring → Powerful model
427-
TIER_COMPLEX=openrouter:anthropic/claude-opus-4
428-
429-
# Deep reasoning → Most capable model
430-
TIER_REASONING=openrouter:anthropic/claude-opus-4
431-
432-
# ============================================
433-
# REQUIRED: Claude Code/Cursor Compatibility
434-
# ============================================
435-
POLICY_MAX_STEPS=50
436-
POLICY_MAX_TOOL_CALLS=100
437-
POLICY_SAFE_COMMANDS_ENABLED=false
438-
439-
# ============================================
440-
# OPTIONAL: Token Optimization (60-80% savings)
441-
# ============================================
442-
PROMPT_CACHE_ENABLED=true
443-
SEMANTIC_CACHE_ENABLED=true
444-
SEMANTIC_CACHE_THRESHOLD=0.95
445-
TOOL_INJECTION_ENABLED=false
446-
447-
# ============================================
448-
# OPTIONAL: Performance Tuning
449-
# ============================================
450-
LOG_LEVEL=warn
451-
LOAD_SHEDDING_ENABLED=true
452-
LOAD_SHEDDING_HEAP_THRESHOLD=0.85
453-
```
454-
455-
**Expected savings:** 70-90% of requests use Gemini Flash ($). Only 10-30% use Claude Opus ($$$).
456-
457-
---
458-
459-
### Enterprise: Databricks Foundation Models
460-
461-
For teams using Databricks Model Serving:
462-
463-
```bash
464-
# .env - Enterprise Databricks Setup
465-
466-
# ============================================
467-
# REQUIRED: Provider Configuration
468-
# ============================================
469-
MODEL_PROVIDER=databricks
470-
DATABRICKS_API_BASE=https://your-workspace.cloud.databricks.com
471-
DATABRICKS_API_KEY=dapi1234567890abcdef
472-
FALLBACK_ENABLED=false
473-
474-
# ============================================
475-
# REQUIRED: Model Configuration
476-
# ============================================
477-
# Option 1: Single model (no tier routing)
478-
DATABRICKS_MODEL=databricks-meta-llama-3-1-405b-instruct
479-
480-
# Option 2: Tier routing (comment out above, uncomment below)
481-
# TIER_SIMPLE=databricks:databricks-meta-llama-3-1-70b-instruct
482-
# TIER_MEDIUM=databricks:databricks-claude-sonnet-4-5
483-
# TIER_COMPLEX=databricks:databricks-claude-opus-4-6
484-
# TIER_REASONING=databricks:databricks-claude-opus-4-6
485-
486-
# ============================================
487-
# REQUIRED: Server Configuration
488-
# ============================================
489-
PORT=8081
490-
HOST=0.0.0.0
491-
492-
# ============================================
493-
# REQUIRED: Claude Code/Cursor Compatibility
494-
# ============================================
495-
POLICY_MAX_STEPS=50
496-
POLICY_MAX_TOOL_CALLS=100
497-
POLICY_SAFE_COMMANDS_ENABLED=false
498-
499-
# ============================================
500-
# OPTIONAL: Enterprise Features
501-
# ============================================
502-
LOG_LEVEL=info
503-
LOAD_SHEDDING_ENABLED=true
504-
LOAD_SHEDDING_HEAP_THRESHOLD=0.85
505-
506-
# Optional: Metrics for monitoring
507-
# PROMETHEUS_METRICS_ENABLED=true
508-
```
509-
510-
---
511-
512-
### Hybrid: Local + Cloud Fallback
513-
514-
Use free Ollama, fallback to cloud when needed:
515-
516-
```bash
517-
# .env - Hybrid Setup (Advanced)
518-
519-
# ============================================
520-
# PRIMARY: Local Ollama
521-
# ============================================
522-
MODEL_PROVIDER=ollama
523-
OLLAMA_ENDPOINT=http://localhost:11434
524-
OLLAMA_MODEL=qwen2.5-coder:latest
525-
526-
# ============================================
527-
# FALLBACK: Cloud Provider
528-
# ============================================
529-
FALLBACK_ENABLED=true
530-
FALLBACK_PROVIDER=openrouter
531-
OPENROUTER_API_KEY=sk-or-v1-your-key-here
532-
533-
# ============================================
534-
# TIER ROUTING: Mix Local + Cloud
535-
# ============================================
536-
TIER_SIMPLE=ollama:qwen2.5:3b
537-
TIER_MEDIUM=ollama:qwen2.5:7b
538-
TIER_COMPLEX=openrouter:anthropic/claude-3.5-sonnet
539-
TIER_REASONING=openrouter:anthropic/claude-opus-4
540-
541-
# ============================================
542-
# REQUIRED: Server Configuration
543-
# ============================================
544-
PORT=8081
545-
HOST=0.0.0.0
546-
547-
# ============================================
548-
# REQUIRED: Claude Code/Cursor Compatibility
549-
# ============================================
550-
POLICY_MAX_STEPS=50
551-
POLICY_MAX_TOOL_CALLS=100
552-
POLICY_SAFE_COMMANDS_ENABLED=false
553-
554-
# ============================================
555-
# OPTIONAL: Performance
556-
# ============================================
557-
LOG_LEVEL=warn
558-
LOAD_SHEDDING_ENABLED=true
559-
```
560-
561-
**Best of both worlds:** 80% of requests stay local (free). Complex tasks use cloud (paid).
562-
563-
---
564252

565253
## Common Issues & Fixes
566254

0 commit comments

Comments
 (0)