@gabrielsmartin/orbit-sdk 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 (2) hide show
  1. package/README.md +96 -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,145 @@ 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
+ // → Claude Sonnet | creative_claude | saved 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
+ // → Gemini 2.5 Flash | cost_gemini | saved 98%
44
40
 
45
- Then it routes to the right model. Invisibly.
41
+ const decision3 = orbit.route("I've been feeling really anxious")
42
+ // → Claude Sonnet | ethics_first | (never routes sensitive content to cheap models)
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
+ Then the SMM (Selective Model Matching) engine 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
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, 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'], // never route here
92
+ always_log: true,
72
93
  })
73
94
 
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'
95
+ // Raw fingerprint
96
+ const fp = fingerprint("write a poem about loss")
97
+ // Returns: { complexity, creativity, emotional_weight, recency, context_load, speed, domain, cost_tolerance }
80
98
  ```
81
99
 
82
- ### Full pipeline example (with Anthropic SDK)
100
+ ---
101
+
102
+ ## Results
83
103
 
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
104
  ```
105
+ $ node --input-type=module << 'EOF'
106
+ import orbit from '@gabrielsmartin/orbit-sdk'
125
107
 
126
- ### Session stats
108
+ orbit.route("write a haiku about recursion")
109
+ // [ORBIT] → Claude Sonnet | creative_claude | saved $0.00750 (50% reduction)
127
110
 
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
- ```
111
+ orbit.route("what is 2+2?")
112
+ // [ORBIT] Gemini 2.5 Flash | cost_gemini | saved $0.01475 (98% reduction)
133
113
 
134
- ### Fingerprint only (no routing)
114
+ orbit.route("architect a distributed cache for 10M users")
115
+ // [ORBIT] → Claude Sonnet | default | saved $0.00750 (50% reduction)
135
116
 
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
- // }
117
+ console.log(orbit.stats())
118
+ // { queries_routed: 3, total_savings_formatted: '$0.0298' }
119
+ EOF
149
120
  ```
150
121
 
151
- ---
122
+ Validated by **RouteLLM (UC Berkeley / ICLR 2025)**: intelligent routing achieves **85% cost reduction** while maintaining **95% of GPT-4o quality**.
152
123
 
153
- ## Model matrix
124
+ ---
154
125
 
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 |
126
+ ## Hosted API (coming soon)
163
127
 
164
- ---
128
+ The SDK routes decisions client-side (no API key needed, zero latency). A **hosted API with analytics dashboard** is coming for teams that want:
165
129
 
166
- ## The math
130
+ - Cross-session savings tracking
131
+ - Routing policy editor
132
+ - Team analytics
133
+ - A/B cost testing
134
+ - Custom model matrix
167
135
 
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.
136
+ **[Join the waitlist ](https://orbit-model-flow.base44.app/#waitlist)**
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
+ Free tier: 100 queries/day · Pro: $19/mo unlimited · Team: $99/mo
174
139
 
175
140
  ---
176
141
 
177
- ## Live demo
142
+ ## Research backing
178
143
 
179
- [orbit-model-flow.base44.app](https://orbit-model-flow.base44.app)route a real query, see the fingerprint radar, watch the savings counter.
144
+ - **RouteLLM** UC Berkeley / ICLR 2025: *"Routing between weak and strong LLMs reduces costs by 85% while maintaining 95% quality."*
145
+ - **OpenRouter** ($500M+ valuation) proves the market exists. ORBIT adds the intelligence layer they're missing.
146
+ - **Martian** (Accenture-backed) proves enterprises pay for routing. ORBIT is the frictionless version.
180
147
 
181
148
  ---
182
149
 
183
150
  ## Roadmap
184
151
 
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
152
+ - [x] v0.1.0 — 8-axis fingerprinting + 6-model routing matrix
153
+ - [ ] v0.2.0 Hosted API with API key auth + rate limiting
154
+ - [ ] v0.3.0 — Analytics dashboard
155
+ - [ ] v0.4.0 — Chrome extension
156
+ - [ ] v1.0.0 Enterprise API + savings-share pricing
193
157
 
194
158
  ---
195
159
 
196
160
  ## License
197
161
 
198
- MIT · Built by [Gabriel Martin](https://github.com/gabrielsmartin)
199
-
200
- *"Every model has a gravitational pull. ORBIT decides which one you need."*
162
+ MIT © [Gabriel Martin](https://www.linkedin.com/in/gabrielsmartin)
201
163
 
202
- 777 · 555 · 333
164
+ **[Live demo](https://orbit-model-flow.base44.app) · [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.1",
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",