@gabrielsmartin/orbit-sdk 0.1.0 → 0.1.2

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 (2) hide show
  1. package/README.md +98 -134
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,13 +1,15 @@
1
- # orbit-ai
1
+ # @gabrielsmartin/orbit-sdk
2
2
 
3
3
  > Stop blasting every query at GPT-4o. Route intelligently. Save 85%.
4
4
 
5
- `orbit-ai` is a drop-in routing layer that reads the fingerprint of every AI query and sends it to the optimal model — automatically, in under 1ms.
5
+ `@gabrielsmartin/orbit-sdk` is a drop-in routing layer that reads the fingerprint of every AI query and sends it to the optimal model — automatically, in under 1ms.
6
6
 
7
7
  ```bash
8
- npm install orbit-ai
8
+ npm install @gabrielsmartin/orbit-sdk
9
9
  ```
10
10
 
11
+ **Built by [Gabriel Martin](https://www.linkedin.com/in/gabrielsmartin) · [orbit-model-flow.base44.app](https://orbit-model-flow.base44.app)**
12
+
11
13
  ---
12
14
 
13
15
  ## The problem
@@ -18,185 +20,147 @@ You're probably doing this:
18
20
  const res = await openai.chat.completions.create({
19
21
  model: "gpt-4o", // $30/1M tokens — every single query
20
22
  messages
21
- })
23
+ });
22
24
  ```
23
25
 
24
- GPT-4o costs **30x more per token** than Gemini Flash. For "what's 2+2?" you're paying Ferrari prices to drive to the mailbox.
25
-
26
- ORBIT fixes this. One line.
26
+ You're overpaying by 85%. "Write a haiku" does not need GPT-4o. "What is 2+2?" does not need GPT-4o. Only ~15% of real queries actually require your most expensive model.
27
27
 
28
28
  ---
29
29
 
30
- ## How it works
30
+ ## The solution
31
31
 
32
- Every query gets fingerprinted across **8 axes** in under 1ms:
32
+ ```javascript
33
+ import orbit from '@gabrielsmartin/orbit-sdk'
34
+
35
+ const decision = orbit.route("write a haiku about recursion")
36
+ // → { model: "Claude Sonnet", reason: "High creativity — Claude Sonnet for nuanced generation", savings: { reductionPct: 50 } }
33
37
 
34
- | Axis | What it measures |
35
- |---|---|
36
- | **Complexity** | Depth of reasoning required |
37
- | **Creativity** | Open-ended vs deterministic |
38
- | **Emotional Weight** | Sensitivity — crisis queries always go to Claude |
39
- | **Recency** | Need for live/current data → Grok |
40
- | **Context Load** | Window size needed → Claude 200k |
41
- | **Speed** | Latency sensitivity |
42
- | **Domain** | Code · Creative · Medical · Legal · General |
43
- | **Cost Tolerance** | Budget tier (overridable) |
38
+ const decision2 = orbit.route("what is 2+2?")
39
+ // → { model: "Gemini 2.5 Flash", reason: "Low complexity — Gemini Flash at $0.50/1M tokens", savings: { reductionPct: 98 } }
44
40
 
45
- Then it routes to the right model. Invisibly.
41
+ const decision3 = orbit.route("I've been feeling really anxious")
42
+ // → { model: "Claude Sonnet", reason: "Emotional weight detected — ethics-first routing. Never a cheap model." }
43
+ ```
46
44
 
47
45
  ---
48
46
 
49
- ## Usage
47
+ ## How it works
50
48
 
51
- ### Zero-config routing decision
49
+ Every query is fingerprinted across **8 axes** in under 1ms:
50
+
51
+ | Axis | What it detects |
52
+ |------|----------------|
53
+ | `complexity` | Depth of reasoning required |
54
+ | `creativity` | Open-ended vs. factual generation |
55
+ | `emotional_weight` | Sensitive or crisis content |
56
+ | `recency` | Need for real-time / live web data |
57
+ | `context_load` | Long-document or multi-turn depth |
58
+ | `speed` | Latency sensitivity |
59
+ | `domain` | Code, legal, medical, creative, general |
60
+ | `cost_tolerance` | Budget flexibility signal |
61
+
62
+ The SMM (Selective Model Matching) engine then routes:
63
+
64
+ | Signal | → Model | Why |
65
+ |--------|---------|-----|
66
+ | Emotional weight > 6 | Claude Sonnet | Ethics-first. Always. |
67
+ | Domain = legal/medical | Claude Sonnet | Long-context + safety |
68
+ | Recency > 7 | Grok | Real-time web access |
69
+ | Creativity > 5 | Claude Sonnet | Best open-ended generation |
70
+ | Complexity < 5 | Gemini 2.5 Flash | 98% cheaper, 95% quality |
71
+ | Trivial query | GPT-4o Mini | 99% cheaper than GPT-4o |
52
72
 
53
- ```javascript
54
- import orbit from 'orbit-ai'
73
+ ---
55
74
 
56
- // Get the routing decision
57
- const decision = orbit.route("write a haiku about recursion")
75
+ ## API
58
76
 
59
- console.log(decision.model.name) // "Claude Sonnet"
60
- console.log(decision.reason) // "High creativity score (8/10)..."
61
- console.log(decision.savings) // { savings: 0.007245, reductionPct: 97 }
62
- ```
77
+ ```javascript
78
+ import orbit, { OrbitClient, fingerprint } from '@gabrielsmartin/orbit-sdk'
63
79
 
64
- ### With your own API keys
80
+ // Route a query returns routing decision instantly (<1ms)
81
+ const result = orbit.route(queryText)
82
+ // Returns: { model, reason, savings: { reductionPct, estimatedCost, premiumCost } }
65
83
 
66
- ```javascript
67
- import { OrbitClient } from 'orbit-ai'
84
+ // Get session stats
85
+ const stats = orbit.stats()
86
+ // Returns: { queries_routed, total_savings_formatted, breakdown }
68
87
 
69
- const orbit = new OrbitClient({
70
- cost_tolerance: 'low', // 'low' | 'medium' | 'high'
71
- log: true, // logs routing decisions to console
88
+ // Custom config
89
+ const client = new OrbitClient({
90
+ default_model: 'claude_sonnet',
91
+ blocked_models: ['gpt4o'],
72
92
  })
73
93
 
74
- // Route the query
75
- const { model, reason, savings } = orbit.route("explain blockchain simply")
76
- // [ORBIT] Gemini 2.5 Flash | cost_gemini | saved $0.01455 (97% reduction)
77
-
78
- // Now call the model yourself with your keys
79
- // model.id = 'gemini-2.5-flash', model.provider = 'google'
94
+ // Raw fingerprint only
95
+ const fp = fingerprint("write a poem about loss")
96
+ // Returns all 8 axes as numbers
80
97
  ```
81
98
 
82
- ### Full pipeline example (with Anthropic SDK)
83
-
84
- ```javascript
85
- import { OrbitClient } from 'orbit-ai'
86
- import Anthropic from '@anthropic-ai/sdk'
87
- import OpenAI from 'openai'
88
- import { GoogleGenerativeAI } from '@google/generative-ai'
89
-
90
- const orbit = new OrbitClient({ log: true })
91
-
92
- async function smartQuery(text) {
93
- const { model, reason } = orbit.route(text)
94
-
95
- if (model.provider === 'anthropic') {
96
- const client = new Anthropic()
97
- return client.messages.create({
98
- model: model.id,
99
- max_tokens: 1024,
100
- messages: [{ role: 'user', content: text }]
101
- })
102
- }
103
-
104
- if (model.provider === 'openai') {
105
- const client = new OpenAI()
106
- return client.chat.completions.create({
107
- model: model.id,
108
- messages: [{ role: 'user', content: text }]
109
- })
110
- }
111
-
112
- if (model.provider === 'google') {
113
- const client = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY)
114
- const genModel = client.getGenerativeModel({ model: model.id })
115
- return genModel.generateContent(text)
116
- }
117
- }
118
-
119
- // Routes each query to the optimal model
120
- await smartQuery("write a poem about the ocean") // → Claude Sonnet
121
- await smartQuery("what's the latest news on AI funding?") // → Grok
122
- await smartQuery("what is 2+2") // → Gemini Flash
123
- await smartQuery("I've been feeling really overwhelmed") // → Claude Sonnet (ethics-first)
124
- ```
99
+ ---
125
100
 
126
- ### Session stats
101
+ ## Results
127
102
 
128
- ```javascript
129
- const stats = orbit.stats()
130
- console.log(stats.total_savings_formatted) // "$0.2341"
131
- console.log(stats.model_usage) // { "Claude Sonnet": 4, "Gemini 2.5 Flash": 12, ... }
132
103
  ```
104
+ $ node test.js
133
105
 
134
- ### Fingerprint only (no routing)
106
+ [ORBIT] Claude Sonnet | creative_claude | saved $0.00750 (50% reduction)
107
+ [ORBIT] → Gemini 2.5 Flash | cost_gemini | saved $0.01475 (98% reduction)
108
+ [ORBIT] → Claude Sonnet | default | saved $0.00750 (50% reduction)
135
109
 
136
- ```javascript
137
- import { fingerprint } from 'orbit-ai'
138
-
139
- const scores = fingerprint("architect a distributed caching system for 10M users")
140
- // {
141
- // complexity: 9,
142
- // creativity: 0,
143
- // domain: 'code',
144
- // emotional_weight: 0,
145
- // recency: 0,
146
- // context_load: 3,
147
- // ...
148
- // }
110
+ Session stats: { queries_routed: 3, total_savings_formatted: '$0.0298' }
149
111
  ```
150
112
 
113
+ Validated by **RouteLLM (UC Berkeley / ICLR 2025)**: intelligent routing achieves **85% cost reduction** while maintaining **95% of GPT-4o quality**.
114
+
151
115
  ---
152
116
 
153
- ## Model matrix
117
+ ## Hosted API — coming soon
154
118
 
155
- | Model | Provider | Cost/1M | Best for |
156
- |---|---|---|---|
157
- | Claude Sonnet | Anthropic | $15 | Complex reasoning · Ethics · Long context |
158
- | Claude Haiku | Anthropic | $1 | Speed · Summaries · Medium tasks |
159
- | Gemini 2.5 Flash | Google | $0.50 | High volume · Simple queries · Cost |
160
- | GPT-4o | OpenAI | $30 | Structured output · Broad knowledge |
161
- | GPT-4o Mini | OpenAI | $0.30 | Classification · Filler tasks |
162
- | Grok | xAI | $10 | Trending · Real-time web |
119
+ The SDK routes decisions **client-side** no API key, zero latency, works today.
163
120
 
164
- ---
121
+ The **hosted API** is coming for teams that need:
165
122
 
166
- ## The math
123
+ - Cross-session savings tracking & audit logs
124
+ - Routing policy editor (block models, set cost caps)
125
+ - Team analytics dashboard
126
+ - A/B cost testing across routing strategies
127
+ - Custom model matrix + private model support
128
+ - Enterprise compliance mode + SLA guarantee
167
129
 
168
- Validated by [RouteLLM (UC Berkeley · ICLR 2025)](https://arxiv.org/abs/2406.18665): intelligent routing achieves **85% cost reduction** while maintaining 95% of quality.
130
+ **Pricing:**
131
+ | Tier | Price | Queries |
132
+ |------|-------|---------|
133
+ | Free | $0/mo | 100/day |
134
+ | Pro | $19/mo | Unlimited |
135
+ | Team | $99/mo | Unlimited · 5 seats |
136
+ | Enterprise | Custom | Custom + 15% savings-share |
169
137
 
170
- For a team running 100k queries/month at GPT-4o:
171
- - Without ORBIT: **$1,500/month**
172
- - With ORBIT: **~$225/month**
173
- - Savings: **$1,275/month · $15,300/year**
138
+ **[Join the waitlist →](https://orbit-model-flow.base44.app/#waitlist)**
139
+ Early access gets Pro pricing locked at $9/mo. Access code: **777**
174
140
 
175
141
  ---
176
142
 
177
- ## Live demo
143
+ ## Research backing
178
144
 
179
- [orbit-model-flow.base44.app](https://orbit-model-flow.base44.app)route a real query, see the fingerprint radar, watch the savings counter.
145
+ - **RouteLLM** UC Berkeley / ICLR 2025: *"Routing between weak and strong LLMs reduces costs by 85% while maintaining 95% quality."*
146
+ - **OpenRouter** ($500M+ valuation) proves the market. ORBIT adds the intelligence layer they're missing.
147
+ - **Martian** (Accenture-backed) proves enterprises pay for routing. ORBIT is the frictionless version for everyone else.
180
148
 
181
149
  ---
182
150
 
183
151
  ## Roadmap
184
152
 
185
- - [x] 8-axis fingerprinting engine
186
- - [x] 6-model routing matrix
187
- - [x] TypeScript types
188
- - [ ] Streaming support
189
- - [ ] Custom model matrix (bring your own models)
190
- - [ ] Automatic provider failover
191
- - [ ] Usage analytics dashboard integration
192
- - [ ] Browser extension
153
+ - [x] v0.1.0 — 8-axis fingerprinting + 6-model routing matrix
154
+ - [x] v0.1.1 Hosted API architecture, waitlist, admin dashboard
155
+ - [ ] v0.2.0 — Hosted API with API key auth + rate limiting (100/day free, unlimited Pro)
156
+ - [ ] v0.3.0 — Analytics dashboard + savings tracker
157
+ - [ ] v0.4.0 Chrome extension
158
+ - [ ] v1.0.0 Enterprise API + savings-share pricing model
193
159
 
194
160
  ---
195
161
 
196
162
  ## License
197
163
 
198
- MIT · Built by [Gabriel Martin](https://github.com/gabrielsmartin)
199
-
200
- *"Every model has a gravitational pull. ORBIT decides which one you need."*
164
+ MIT © [Gabriel Martin](https://www.linkedin.com/in/gabrielsmartin)
201
165
 
202
- 777 · 555 · 333
166
+ **[Live demo](https://orbit-model-flow.base44.app/demo) · [GitHub](https://github.com/gabrielsmartin/orbit) · [npm](https://www.npmjs.com/package/@gabrielsmartin/orbit-sdk) · [LinkedIn](https://www.linkedin.com/in/gabrielsmartin)**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gabrielsmartin/orbit-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Intelligent AI model routing. Drop-in replacement for OpenAI/Anthropic. Routes every query to the optimal model automatically.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",