lynkr 3.0.0 → 3.1.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.
@@ -0,0 +1,557 @@
1
+ # README.md SEO Optimization Plan for Lynkr
2
+
3
+ **Project:** Lynkr - Claude Code Proxy Server
4
+ **Goal:** Maximize search engine visibility and discoverability
5
+ **Target:** GitHub search, Google, DuckDuckGo, Bing, and developer search tools
6
+
7
+ ---
8
+
9
+ ## 📊 Current SEO Analysis
10
+
11
+ ### ✅ Current Strengths
12
+ 1. **Comprehensive content** (1770 lines) - Search engines love detailed documentation
13
+ 2. **Clear structure** with proper heading hierarchy (H1 → H2 → H3)
14
+ 3. **Good keyword presence**: Claude Code, Databricks, Ollama, OpenRouter, MCP
15
+ 4. **Multiple badges** showing project credibility
16
+ 5. **Internal navigation** via table of contents
17
+ 6. **External links** to authoritative sources
18
+
19
+ ### ❌ SEO Weaknesses & Opportunities
20
+ 1. **Generic title** - "Lynkr" doesn't describe what it does
21
+ 2. **Missing meta description** - First 160 chars not optimized
22
+ 3. **Keyword gaps** - Missing long-tail search terms
23
+ 4. **No alt text** on badges (GitHub doesn't render, but helps context)
24
+ 5. **Weak opening paragraph** - Doesn't match search intent
25
+ 6. **Missing schema hints** for FAQ section
26
+ 7. **No social media optimization** (Open Graph/Twitter cards)
27
+ 8. **Limited LSI keywords** (Latent Semantic Indexing)
28
+ 9. **No explicit call-to-action** for GitHub stars/forks
29
+ 10. **Missing "problem-solution" framework** at the top
30
+
31
+ ---
32
+
33
+ ## 🎯 Target Keywords & Search Intent
34
+
35
+ ### Primary Keywords (High Search Volume)
36
+ 1. **"Claude Code proxy"** - Direct match, low competition
37
+ 2. **"Claude Code alternative backend"** - Long-tail, high intent
38
+ 3. **"Databricks Claude integration"** - Enterprise search
39
+ 4. **"Self-hosted Claude Code"** - Privacy-focused devs
40
+ 5. **"Claude Code Ollama"** - Local AI developers
41
+ 6. **"MCP server integration"** - Model Context Protocol users
42
+
43
+ ### Secondary Keywords (Long-tail)
44
+ 7. "How to run Claude Code with Ollama"
45
+ 8. "Claude Code OpenRouter integration"
46
+ 9. "Azure Anthropic Claude proxy"
47
+ 10. "Local Claude Code server setup"
48
+ 11. "Claude Code workspace tools"
49
+ 12. "Git-aware AI coding assistant"
50
+ 13. "Prompt caching Claude implementation"
51
+ 14. "Multi-provider Claude Code backend"
52
+
53
+ ### LSI Keywords (Semantic Relevance)
54
+ - AI coding assistant
55
+ - LLM proxy server
56
+ - Code generation API
57
+ - Developer productivity tools
58
+ - CI/CD automation
59
+ - Git workflow automation
60
+ - Token optimization
61
+ - Cost reduction for AI APIs
62
+
63
+ ### Search Intent Categories
64
+ 1. **Informational**: "What is Lynkr", "How does Claude Code proxy work"
65
+ 2. **Navigational**: "Lynkr GitHub", "Lynkr documentation"
66
+ 3. **Transactional**: "Install Lynkr", "Setup Claude Code proxy"
67
+ 4. **Comparison**: "Lynkr vs native Claude Code", "Databricks vs OpenRouter"
68
+
69
+ ---
70
+
71
+ ## 🔧 Optimization Strategy
72
+
73
+ ### Phase 1: Title & Meta Description (Critical)
74
+
75
+ **Current Title:**
76
+ ```markdown
77
+ # Lynkr
78
+ ```
79
+
80
+ **Optimized Title (Option A - Descriptive):**
81
+ ```markdown
82
+ # Lynkr - Self-Hosted Claude Code Proxy Server | Databricks, Ollama, OpenRouter, Azure Support
83
+ ```
84
+
85
+ **Optimized Title (Option B - Feature-focused):**
86
+ ```markdown
87
+ # Lynkr - Production-Ready Claude Code Proxy with Multi-Provider Support, MCP Integration & Token Optimization
88
+ ```
89
+
90
+ **Optimized Title (Option C - Problem-Solution):**
91
+ ```markdown
92
+ # Lynkr - Run Claude Code CLI with Any LLM Provider | Databricks, OpenRouter, Ollama, Azure
93
+ ```
94
+
95
+ **Meta Description (First 160 characters - CRITICAL):**
96
+
97
+ **Current:**
98
+ > It is a Cli tool which acts like a HTTP proxy that lets Claude Code CLI talk to non-Anthropic backends, manage local tools, and compose Model Context Protocol (MCP) servers with prompt caching, repo intelligence, and Git-aware automation.
99
+
100
+ **Optimized (155 chars):**
101
+ > Production-ready Claude Code proxy server supporting Databricks, OpenRouter, Ollama & Azure. Features MCP integration, prompt caching & token optimization.
102
+
103
+ **Alternative (158 chars):**
104
+ > Self-hosted Claude Code backend with multi-provider support (Databricks, Ollama, OpenRouter). Open-source, enterprise-ready with 60-80% token savings.
105
+
106
+ ---
107
+
108
+ ### Phase 2: Opening Section Optimization
109
+
110
+ **Add a "Problem-Solution" Framework at the top:**
111
+
112
+ ```markdown
113
+ ## Why Lynkr?
114
+
115
+ **The Problem:** Claude Code CLI is locked to Anthropic's API, limiting your choice of LLM providers and increasing costs.
116
+
117
+ **The Solution:** Lynkr is a production-ready proxy server that lets you run Claude Code CLI with:
118
+ - ✅ **Any LLM provider** - Databricks, OpenRouter (100+ models), Ollama (local), Azure
119
+ - ✅ **60-80% cost reduction** - Built-in token optimization and prompt caching
120
+ - ✅ **Zero code changes** - Drop-in replacement for Anthropic backend
121
+ - ✅ **Enterprise features** - Load balancing, circuit breakers, metrics, K8s-ready
122
+
123
+ Perfect for developers who want flexibility, cost control, and privacy without sacrificing Claude Code's powerful workflow.
124
+ ```
125
+
126
+ ---
127
+
128
+ ### Phase 3: Keyword Optimization
129
+
130
+ #### 3.1 Add Keyword-Rich Subheadings
131
+
132
+ **Current:** Generic headings
133
+ **Optimized:** Keyword-rich headings
134
+
135
+ ```markdown
136
+ ## Supported AI Model Providers (Databricks, OpenRouter, Ollama, Azure)
137
+ ## Claude Code Integration & Setup Guide
138
+ ## Self-Hosted vs Cloud: Cost Comparison & Token Optimization
139
+ ## MCP (Model Context Protocol) Server Integration
140
+ ## Production-Ready Features for Enterprise Deployment
141
+ ```
142
+
143
+ #### 3.2 Add "Keywords" Section (GitHub-specific)
144
+
145
+ ```markdown
146
+ ## 🔖 Keywords
147
+
148
+ `claude-code` `claude-proxy` `anthropic-api` `databricks-llm` `openrouter-integration`
149
+ `ollama-local` `llama-cpp` `azure-openai` `azure-anthropic` `mcp-server`
150
+ `prompt-caching` `token-optimization` `ai-coding-assistant` `llm-proxy`
151
+ `self-hosted-ai` `git-automation` `code-generation` `developer-tools`
152
+ ```
153
+
154
+ #### 3.3 Add Keyword-Rich Alt Text
155
+
156
+ **Current:** No alt text on badges
157
+ **Optimized:** Add descriptive titles
158
+
159
+ ```markdown
160
+ [![npm version](https://img.shields.io/npm/v/lynkr.svg)](https://www.npmjs.com/package/lynkr "Lynkr NPM Package - Claude Code Proxy Server")
161
+ [![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")
162
+ ```
163
+
164
+ ---
165
+
166
+ ### Phase 4: Content Structure Optimization
167
+
168
+ #### 4.1 Add FAQ Schema Hints
169
+
170
+ **Optimize FAQ section with structured markup hints:**
171
+
172
+ ```markdown
173
+ ## Frequently Asked Questions (FAQ)
174
+
175
+ <details>
176
+ <summary><strong>Q: Can I use Lynkr with the official Claude Code CLI?</strong></summary>
177
+
178
+ **A:** Yes! Lynkr is a drop-in replacement for Anthropic's backend. Set `ANTHROPIC_BASE_URL` to your Lynkr server and it works seamlessly.
179
+
180
+ *Related searches: Claude Code proxy setup, Claude Code alternative backend*
181
+ </details>
182
+
183
+ <details>
184
+ <summary><strong>Q: How much does Lynkr save on token costs?</strong></summary>
185
+
186
+ **A:** With built-in optimizations (Phases 1-5), Lynkr achieves 60-80% token reduction. At 100k requests/month, this saves $6,400-9,600/month.
187
+
188
+ *Related searches: Claude Code cost reduction, token optimization strategies*
189
+ </details>
190
+ ```
191
+
192
+ #### 4.2 Add "Quick Start" Section Early
193
+
194
+ Move quick start BEFORE detailed documentation:
195
+
196
+ ```markdown
197
+ ## ⚡ Quick Start (3 minutes)
198
+
199
+ ### 1. Install
200
+ ```bash
201
+ npm install -g lynkr
202
+ # or
203
+ brew install lynkr
204
+ ```
205
+
206
+ ### 2. Configure
207
+ ```bash
208
+ export MODEL_PROVIDER=ollama # or databricks, openrouter, azure
209
+ lynkr-setup
210
+ ```
211
+
212
+ ### 3. Start
213
+ ```bash
214
+ lynkr start
215
+ ```
216
+
217
+ ### 4. Connect Claude Code CLI
218
+ ```bash
219
+ export ANTHROPIC_BASE_URL=http://localhost:8080
220
+ claude "Hello world"
221
+ ```
222
+
223
+ **Next steps:** [Configuration Guide](#configuration-reference) | [Production Setup](#production-hardening-features)
224
+ ```
225
+
226
+ #### 4.3 Add Comparison Tables
227
+
228
+ **Add "vs" sections for common searches:**
229
+
230
+ ```markdown
231
+ ## Lynkr vs Native Claude Code
232
+
233
+ | Feature | Native Claude Code | Lynkr |
234
+ |---------|-------------------|-------|
235
+ | **Provider Lock-in** | Anthropic only | 7+ providers |
236
+ | **Token Costs** | Full price | 60-80% savings |
237
+ | **Local Models** | ❌ | ✅ Ollama, llama.cpp |
238
+ | **Self-Hosted** | ❌ | ✅ Full control |
239
+ | **MCP Support** | Limited | Full orchestration |
240
+ | **Prompt Caching** | Limited | Advanced |
241
+ ```
242
+
243
+ ---
244
+
245
+ ### Phase 5: Internal Linking Strategy
246
+
247
+ **Add cross-references between sections:**
248
+
249
+ ```markdown
250
+ ## Token Optimization Features
251
+
252
+ Lynkr includes advanced [token optimization](#token-optimization-implementation) that reduces costs by 60-80%. See our [cost comparison](#cost-comparison) and [benchmarks](#performance-benchmarks) for details.
253
+
254
+ Related: [Prompt Caching](#working-with-prompt-caching) | [Memory Management](#memory-system)
255
+ ```
256
+
257
+ ---
258
+
259
+ ### Phase 6: External Link Optimization
260
+
261
+ #### 6.1 Add Authoritative Backlinks
262
+
263
+ ```markdown
264
+ ## References & Further Reading
265
+
266
+ **Official Documentation:**
267
+ - [Claude Code CLI Documentation](https://docs.anthropic.com/claude/docs/claude-code)
268
+ - [Model Context Protocol (MCP) Specification](https://spec.modelcontextprotocol.io/)
269
+ - [Databricks LLM Documentation](https://docs.databricks.com/machine-learning/foundation-models/)
270
+
271
+ **Related Projects:**
272
+ - [Ollama](https://ollama.ai/) - Local LLM runtime
273
+ - [OpenRouter](https://openrouter.ai/) - Multi-provider LLM API
274
+ - [llama.cpp](https://github.com/ggerganov/llama.cpp) - C++ LLM inference
275
+
276
+ **Academic & Technical Resources:**
277
+ - [Token Optimization Strategies](https://arxiv.org/abs/...) - Research paper
278
+ - [Prompt Caching Best Practices](https://www.anthropic.com/...)
279
+ ```
280
+
281
+ #### 6.2 Add Social Proof
282
+
283
+ ```markdown
284
+ ## Community & Adoption
285
+
286
+ - ⭐ **GitHub Stars:** Help us reach 1,000 stars! [Star this repo →](https://github.com/vishalveerareddy123/Lynkr)
287
+ - 🐛 **Issues & Support:** [GitHub Issues](https://github.com/vishalveerareddy123/Lynkr/issues)
288
+ - 💬 **Discussions:** [GitHub Discussions](https://github.com/vishalveerareddy123/Lynkr/discussions)
289
+ - 📚 **Documentation:** [DeepWiki](https://deepwiki.com/vishalveerareddy123/Lynkr)
290
+
291
+ **Used by developers at:** *(Add company logos/testimonials if available)*
292
+ ```
293
+
294
+ ---
295
+
296
+ ### Phase 7: Rich Media Optimization
297
+
298
+ #### 7.1 Add Screenshots/GIFs
299
+
300
+ ```markdown
301
+ ## Visual Guide
302
+
303
+ ### Architecture Overview
304
+ ![Lynkr Architecture](docs/images/architecture.png "Lynkr Multi-Provider Architecture Diagram")
305
+ *Lynkr's modular architecture supporting multiple LLM providers*
306
+
307
+ ### Quick Start Demo
308
+ ![Installation Demo](docs/images/quickstart.gif "3-minute Lynkr installation and setup")
309
+ *Install and configure Lynkr in under 3 minutes*
310
+ ```
311
+
312
+ #### 7.2 Add Mermaid Diagrams (GitHub renders these)
313
+
314
+ ```markdown
315
+ ## Request Flow
316
+
317
+ ```mermaid
318
+ graph LR
319
+ A[Claude Code CLI] -->|HTTP Request| B[Lynkr Proxy]
320
+ B -->|Route| C{Provider?}
321
+ C -->|Databricks| D[Databricks API]
322
+ C -->|Ollama| E[Local Ollama]
323
+ C -->|OpenRouter| F[OpenRouter API]
324
+ D --> G[Response]
325
+ E --> G
326
+ F --> G
327
+ G --> A
328
+ ```
329
+ ```
330
+
331
+ ---
332
+
333
+ ### Phase 8: Social Media Optimization
334
+
335
+ #### 8.1 Add Open Graph Meta Tags (GitHub Pages)
336
+
337
+ If you have a GitHub Pages site, add:
338
+
339
+ ```html
340
+ <!-- In docs/index.html or GitHub Pages config -->
341
+ <meta property="og:title" content="Lynkr - Self-Hosted Claude Code Proxy Server">
342
+ <meta property="og:description" content="Production-ready Claude Code proxy with multi-provider support. Save 60-80% on token costs.">
343
+ <meta property="og:image" content="https://raw.githubusercontent.com/vishalveerareddy123/Lynkr/main/docs/images/og-image.png">
344
+ <meta property="og:url" content="https://github.com/vishalveerareddy123/Lynkr">
345
+ <meta property="og:type" content="website">
346
+
347
+ <meta name="twitter:card" content="summary_large_image">
348
+ <meta name="twitter:title" content="Lynkr - Claude Code Proxy Server">
349
+ <meta name="twitter:description" content="Self-hosted Claude Code backend with 60-80% token savings">
350
+ <meta name="twitter:image" content="https://raw.githubusercontent.com/vishalveerareddy123/Lynkr/main/docs/images/twitter-card.png">
351
+ ```
352
+
353
+ #### 8.2 Add Repository Topics (GitHub Settings)
354
+
355
+ **Navigate to:** GitHub Repo → Settings → Topics
356
+
357
+ **Add these topics:**
358
+ ```
359
+ claude-code, anthropic-api, databricks, ollama, openrouter, azure-openai,
360
+ llama-cpp, mcp-server, prompt-caching, token-optimization, ai-proxy,
361
+ llm-gateway, self-hosted, developer-tools, code-generation, git-automation
362
+ ```
363
+
364
+ ---
365
+
366
+ ### Phase 9: Performance & Technical SEO
367
+
368
+ #### 9.1 Add sitemap.xml (for GitHub Pages)
369
+
370
+ ```xml
371
+ <?xml version="1.0" encoding="UTF-8"?>
372
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
373
+ <url>
374
+ <loc>https://github.com/vishalveerareddy123/Lynkr</loc>
375
+ <lastmod>2025-12-29</lastmod>
376
+ <changefreq>weekly</changefreq>
377
+ <priority>1.0</priority>
378
+ </url>
379
+ <url>
380
+ <loc>https://github.com/vishalveerareddy123/Lynkr/blob/main/README.md</loc>
381
+ <lastmod>2025-12-29</lastmod>
382
+ <changefreq>weekly</changefreq>
383
+ <priority>0.9</priority>
384
+ </url>
385
+ </urlset>
386
+ ```
387
+
388
+ #### 9.2 Optimize File Size
389
+
390
+ - README is 1770 lines - **Perfect length** for SEO (comprehensive but not overwhelming)
391
+ - Add anchor links for easy navigation
392
+ - Use details/summary for collapsible sections
393
+
394
+ #### 9.3 Add robots.txt (for GitHub Pages)
395
+
396
+ ```
397
+ User-agent: *
398
+ Allow: /
399
+
400
+ Sitemap: https://github.com/vishalveerareddy123/Lynkr/sitemap.xml
401
+ ```
402
+
403
+ ---
404
+
405
+ ### Phase 10: Call-to-Action Optimization
406
+
407
+ **Add prominent CTAs throughout:**
408
+
409
+ ```markdown
410
+ ## Get Started Now
411
+
412
+ **Ready to reduce your Claude Code costs by 60-80%?**
413
+
414
+ 1. ⭐ [Star this repo](https://github.com/vishalveerareddy123/Lynkr) to show support
415
+ 2. 📖 [Read the Quick Start Guide](#quick-start)
416
+ 3. 💬 [Join the Discussion](https://github.com/vishalveerareddy123/Lynkr/discussions)
417
+ 4. 🐛 [Report Issues](https://github.com/vishalveerareddy123/Lynkr/issues)
418
+
419
+ **Need enterprise support?** [Contact us](mailto:your-email@example.com)
420
+ ```
421
+
422
+ ---
423
+
424
+ ## 📈 Expected SEO Impact
425
+
426
+ ### Immediate Impact (Week 1-2)
427
+ - ✅ Improved GitHub search rankings for "Claude Code proxy"
428
+ - ✅ Better snippet display in search results (optimized meta description)
429
+ - ✅ Increased organic traffic from long-tail keywords
430
+
431
+ ### Short-term Impact (Month 1-2)
432
+ - ✅ Rank on first page for "Claude Code alternative backend"
433
+ - ✅ Increased GitHub stars and forks (social signals)
434
+ - ✅ Better visibility in "Awesome Lists" and developer directories
435
+
436
+ ### Long-term Impact (Month 3-6)
437
+ - ✅ Top 3 ranking for primary keywords
438
+ - ✅ Featured in AI/ML tool roundups
439
+ - ✅ Organic backlinks from developer blogs
440
+ - ✅ Increased npm downloads and community adoption
441
+
442
+ ### Measurable Metrics
443
+ | Metric | Baseline | Target (3 months) |
444
+ |--------|----------|-------------------|
445
+ | GitHub Stars | Current | +300% |
446
+ | Weekly README views | Current | +500% |
447
+ | npm weekly downloads | Current | +400% |
448
+ | Organic search traffic | 0 | 1000+/month |
449
+ | Backlinks | 0 | 20+ quality links |
450
+
451
+ ---
452
+
453
+ ## 🎯 Implementation Priority
454
+
455
+ ### High Priority (Implement First)
456
+ 1. ✅ **Title optimization** (10 minutes)
457
+ 2. ✅ **Meta description** (10 minutes)
458
+ 3. ✅ **Add "Why Lynkr?" section** (20 minutes)
459
+ 4. ✅ **Keyword-rich headings** (30 minutes)
460
+ 5. ✅ **Quick Start section early** (30 minutes)
461
+
462
+ ### Medium Priority (Week 2)
463
+ 6. ✅ **FAQ optimization** (1 hour)
464
+ 7. ✅ **Comparison tables** (1 hour)
465
+ 8. ✅ **Internal linking** (1 hour)
466
+ 9. ✅ **Repository topics** (5 minutes)
467
+
468
+ ### Low Priority (Month 1)
469
+ 10. ✅ **Visual media** (2-4 hours)
470
+ 11. ✅ **Mermaid diagrams** (1 hour)
471
+ 12. ✅ **Social media optimization** (1 hour)
472
+ 13. ✅ **External backlink building** (ongoing)
473
+
474
+ ---
475
+
476
+ ## 🔍 Ongoing SEO Maintenance
477
+
478
+ ### Weekly Tasks
479
+ - [ ] Monitor GitHub traffic analytics
480
+ - [ ] Check search rankings for target keywords
481
+ - [ ] Respond to issues and discussions (engagement signals)
482
+ - [ ] Update README with new features
483
+
484
+ ### Monthly Tasks
485
+ - [ ] Analyze top-performing keywords
486
+ - [ ] Update comparison tables with new data
487
+ - [ ] Refresh screenshots and benchmarks
488
+ - [ ] Build new backlinks (blog posts, social media)
489
+
490
+ ### Quarterly Tasks
491
+ - [ ] Comprehensive content audit
492
+ - [ ] Competitor analysis
493
+ - [ ] Update meta description based on performance
494
+ - [ ] Refresh visual assets
495
+
496
+ ---
497
+
498
+ ## 💡 Advanced SEO Tactics
499
+
500
+ ### 1. Create Supporting Content
501
+ - Blog post: "How We Reduced Claude Code Costs by 80%"
502
+ - Tutorial: "Setting Up Claude Code with Ollama in 5 Minutes"
503
+ - Video: "Lynkr Demo and Architecture Walkthrough"
504
+ - Case study: "Enterprise Deployment of Lynkr at [Company]"
505
+
506
+ ### 2. Build Backlinks
507
+ - Submit to: Awesome Lists, Product Hunt, Hacker News
508
+ - Guest posts on dev.to, Medium, Hashnode
509
+ - Contribute to related projects (natural backlinks)
510
+ - Answer Stack Overflow questions with Lynkr solutions
511
+
512
+ ### 3. Leverage GitHub Features
513
+ - Use GitHub Discussions for community building
514
+ - Enable GitHub Sponsors (social proof)
515
+ - Create GitHub Projects for roadmap visibility
516
+ - Use GitHub Actions badges (trust signals)
517
+
518
+ ---
519
+
520
+ ## ✅ Success Checklist
521
+
522
+ Before implementation, review this checklist:
523
+
524
+ - [ ] Primary keyword research complete
525
+ - [ ] Title optimized with target keywords
526
+ - [ ] Meta description under 160 characters
527
+ - [ ] "Problem-Solution" framework added
528
+ - [ ] Quick Start section prominent
529
+ - [ ] FAQ section with structured markup
530
+ - [ ] Comparison tables added
531
+ - [ ] Internal linking strategy implemented
532
+ - [ ] Repository topics configured
533
+ - [ ] CTAs throughout document
534
+ - [ ] Visual media planned/created
535
+ - [ ] Analytics tracking set up
536
+
537
+ ---
538
+
539
+ ## 📊 Tools for Monitoring
540
+
541
+ **GitHub Analytics:**
542
+ - Traffic → Views, Unique visitors, Referring sites
543
+ - Insights → Popular content, Clone statistics
544
+
545
+ **External SEO Tools:**
546
+ - [Google Search Console](https://search.google.com/search-console) - Track search performance
547
+ - [Ahrefs Webmaster Tools](https://ahrefs.com/webmaster-tools) - Backlink monitoring
548
+ - [Ubersuggest](https://neilpatel.com/ubersuggest/) - Keyword research
549
+
550
+ **GitHub-Specific:**
551
+ - [Star History](https://star-history.com/) - Track star growth
552
+ - [GitSpo](https://gitspo.com/) - Trending repositories
553
+ - [GitHub Trending](https://github.com/trending) - Monitor rankings
554
+
555
+ ---
556
+
557
+ **Next Step:** Review this plan and confirm your preferences for implementation!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lynkr",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Self-hosted Claude Code proxy with Databricks,Azure adapters, openrouter, Ollama,llamacpp, workspace tooling, and MCP integration.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -29,7 +29,7 @@
29
29
  "mcp"
30
30
  ],
31
31
  "author": "Vishal Veera Reddy",
32
- "license": "MIT",
32
+ "license": "Apache-2.0",
33
33
  "repository": {
34
34
  "type": "git",
35
35
  "url": "https://github.com/vishalveerareddy123/Lynkr.git"
package/src/api/router.js CHANGED
@@ -305,4 +305,82 @@ router.get("/v1/agents/:executionId", (req, res) => {
305
305
  }
306
306
  });
307
307
 
308
+ // Token usage statistics for a session
309
+ router.get("/api/sessions/:sessionId/tokens", (req, res) => {
310
+ try {
311
+ const tokens = require("../utils/tokens");
312
+ const { sessionId } = req.params;
313
+ const session = getSession(sessionId);
314
+
315
+ if (!session) {
316
+ return res.status(404).json({ error: "Session not found" });
317
+ }
318
+
319
+ const stats = tokens.getSessionTokenStats(session);
320
+
321
+ res.json({
322
+ sessionId,
323
+ stats: {
324
+ turns: stats.turns,
325
+ totalTokens: stats.totalTokens,
326
+ totalCost: parseFloat(stats.totalCost.toFixed(4)),
327
+ averageTokensPerTurn: stats.averageTokensPerTurn,
328
+ cacheHitRate: parseFloat(stats.cacheHitRate) + '%'
329
+ },
330
+ breakdown: stats.breakdown.map(turn => ({
331
+ turn: turn.turn,
332
+ timestamp: turn.timestamp,
333
+ model: turn.model,
334
+ estimated: turn.estimated.total,
335
+ actual: {
336
+ input: turn.actual.inputTokens,
337
+ output: turn.actual.outputTokens,
338
+ cached: turn.actual.cacheReadTokens,
339
+ total: turn.actual.totalTokens
340
+ },
341
+ cost: parseFloat(turn.cost.total.toFixed(6))
342
+ }))
343
+ });
344
+ } catch (error) {
345
+ res.status(500).json({ error: error.message });
346
+ }
347
+ });
348
+
349
+ // Global token usage statistics (all sessions)
350
+ router.get("/api/tokens/stats", (req, res) => {
351
+ try {
352
+ const tokens = require("../utils/tokens");
353
+ const { getAllSessions } = require("../sessions");
354
+ const allSessions = getAllSessions();
355
+
356
+ let totalTokens = 0;
357
+ let totalCost = 0;
358
+ let totalTurns = 0;
359
+ let totalSessions = 0;
360
+
361
+ for (const session of allSessions) {
362
+ const stats = tokens.getSessionTokenStats(session);
363
+ if (stats.turns > 0) {
364
+ totalTokens += stats.totalTokens;
365
+ totalCost += stats.totalCost;
366
+ totalTurns += stats.turns;
367
+ totalSessions++;
368
+ }
369
+ }
370
+
371
+ res.json({
372
+ global: {
373
+ sessions: totalSessions,
374
+ turns: totalTurns,
375
+ totalTokens,
376
+ totalCost: parseFloat(totalCost.toFixed(4)),
377
+ averageTokensPerTurn: totalTurns > 0 ? Math.round(totalTokens / totalTurns) : 0,
378
+ averageTokensPerSession: totalSessions > 0 ? Math.round(totalTokens / totalSessions) : 0
379
+ }
380
+ });
381
+ } catch (error) {
382
+ res.status(500).json({ error: error.message });
383
+ }
384
+ });
385
+
308
386
  module.exports = router;