tokoscope 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +153 -0
  3. package/package.json +2 -2
package/LICENSE ADDED
File without changes
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # Tokoscope SDK
2
+
3
+ > Audit, compress, and monitor your LLM token usage in 2 lines of code.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/tokoscope?color=00E5A0&style=flat-square)](https://www.npmjs.com/package/tokoscope)
6
+ [![npm downloads](https://img.shields.io/npm/dm/tokoscope?color=00E5A0&style=flat-square)](https://www.npmjs.com/package/tokoscope)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-00E5A0.svg?style=flat-square)](https://opensource.org/licenses/MIT)
8
+
9
+ Tokoscope sits between your app and any LLM API. It tracks every call, scores your prompts for waste, compresses bloated inputs automatically, and shows you exactly where your token budget is going.
10
+
11
+ **Works with OpenAI and Anthropic out of the box.**
12
+
13
+ ---
14
+
15
+ ## The problem
16
+
17
+ Most teams building on LLMs have zero visibility into token usage. No breakdown by feature. No waste detection. No alerts before costs spike. Just a monthly invoice that keeps growing.
18
+
19
+ 40–70% of tokens in the average production prompt are pure waste — redundant instructions, stuffed context windows, repeated phrases the model ignores.
20
+
21
+ Tokoscope fixes that.
22
+
23
+ ---
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ npm install tokoscope
29
+ ```
30
+
31
+ ---
32
+
33
+ ## Quick start
34
+
35
+ ### OpenAI
36
+
37
+ ```javascript
38
+ import OpenAI from 'openai'
39
+ import { wrap } from 'tokoscope'
40
+
41
+ const client = wrap(new OpenAI(), {
42
+ apiKey: 'ts_live_...' // get your key at app.tokoscope.com
43
+ })
44
+
45
+ // All your existing calls work unchanged
46
+ const res = await client.chat.completions.create({
47
+ model: 'gpt-4o',
48
+ messages: [{ role: 'user', content: 'Hello' }]
49
+ })
50
+ ```
51
+
52
+ ### Anthropic
53
+
54
+ ```javascript
55
+ import Anthropic from '@anthropic-ai/sdk'
56
+ import { wrap } from 'tokoscope'
57
+
58
+ const client = wrap(new Anthropic(), {
59
+ apiKey: 'ts_live_...'
60
+ })
61
+
62
+ const res = await client.messages.create({
63
+ model: 'claude-sonnet-4-6',
64
+ max_tokens: 1024,
65
+ messages: [{ role: 'user', content: 'Hello' }]
66
+ })
67
+ ```
68
+
69
+ That's it. Every API call is now tracked automatically.
70
+
71
+ ---
72
+
73
+ ## What you get
74
+
75
+ Once integrated, your [Tokoscope dashboard](https://app.tokoscope.com) shows:
76
+
77
+ - **Token usage** broken down by model, endpoint, and provider
78
+ - **Cost per request** calculated automatically using current pricing
79
+ - **Waste score** for every prompt — flags redundant instructions, bloated context, and repeated phrases
80
+ - **Auto-compression** — prompts with high waste scores are automatically rewritten to their minimum effective form
81
+ - **Budget alerts** — get notified before costs spike, not after the invoice lands
82
+
83
+ ---
84
+
85
+ ## Real example
86
+
87
+ **Original prompt:** 113 tokens
88
+
89
+ ```
90
+ Please note that it is very important that you make sure to respond
91
+ to my question. As an AI, I want you to please make sure that you
92
+ understand that I need you to help me. Make sure to note that what
93
+ I am asking you is the following question which is important:
94
+ What is the capital of France?
95
+ ```
96
+
97
+ **Tokoscope compressed:** 8 tokens
98
+
99
+ ```
100
+ What is the capital of France? Answer concisely.
101
+ ```
102
+
103
+ **Result:** 90% token reduction. Same answer.
104
+
105
+ ---
106
+
107
+ ## Pricing
108
+
109
+ | Plan | Price | Tokens monitored |
110
+ |---|---|---|
111
+ | Free | $0/month | 500K tokens |
112
+ | Pro | $49/month | Unlimited |
113
+ | Team | $99/month | Unlimited + per-user attribution |
114
+
115
+ [Get started free →](https://tokoscope.com)
116
+
117
+ ---
118
+
119
+ ## Dashboard
120
+
121
+ Sign in at [app.tokoscope.com](https://app.tokoscope.com) to:
122
+ - Get your API key
123
+ - View live token usage and costs
124
+ - Review prompt waste scores
125
+ - See compressed vs original prompts
126
+ - Set budget alerts
127
+
128
+ ---
129
+
130
+ ## Supported providers
131
+
132
+ | Provider | Status |
133
+ |---|---|
134
+ | OpenAI | ✅ Supported |
135
+ | Anthropic | ✅ Supported |
136
+ | Gemini | 🔜 Coming soon |
137
+ | Mistral | 🔜 Coming soon |
138
+ | Ollama | 🔜 Coming soon |
139
+
140
+ ---
141
+
142
+ ## License
143
+
144
+ MIT — see [LICENSE](LICENSE)
145
+
146
+ ---
147
+
148
+ ## Links
149
+
150
+ - [Website](https://tokoscope.com)
151
+ - [Dashboard](https://app.tokoscope.com)
152
+ - [npm package](https://www.npmjs.com/package/tokoscope)
153
+ - [Contact](mailto:hello@tokoscope.com)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokoscope",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Audit, compress and monitor your LLM token usage in 2 lines of code",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -23,4 +23,4 @@
23
23
  "type": "git",
24
24
  "url": "https://github.com/tokoscope/tokoscope-sdk"
25
25
  }
26
- }
26
+ }