@nebutra/ai-providers 1.0.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.
- package/LICENSE +21 -0
- package/README.frontier.md +35 -0
- package/README.md +46 -0
- package/dist/catalog.d.ts +128 -0
- package/dist/catalog.js +312 -0
- package/dist/catalog.js.map +1 -0
- package/dist/frontier.d.ts +191 -0
- package/dist/frontier.js +183 -0
- package/dist/frontier.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +783 -0
- package/dist/index.js.map +1 -0
- package/dist/meta.d.ts +25 -0
- package/dist/meta.js +474 -0
- package/dist/meta.js.map +1 -0
- package/package.json +82 -0
- package/templates/.env.example.template +28 -0
- package/templates/registry.ts.template +52 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ═══════════════════════════════════════════════════════════════════════════
|
|
3
|
+
* FRONTIER MODEL REGISTRY — single source of truth (SSOT)
|
|
4
|
+
* ═══════════════════════════════════════════════════════════════════════════
|
|
5
|
+
*
|
|
6
|
+
* Update **this file only** when the industry catalog moves. Every product
|
|
7
|
+
* surface (Router defaults, agents presets, Forge price card, gateway sample
|
|
8
|
+
* models, docs examples that import from here) should derive ids from this
|
|
9
|
+
* module — do not hand-type bare model strings in apps.
|
|
10
|
+
*
|
|
11
|
+
* Audit: 2026-07-24 vs OpenRouter live `/api/v1/models`
|
|
12
|
+
* Prices: OpenRouter list rates USD / 1M tokens (prompt/completion × 1e6)
|
|
13
|
+
*
|
|
14
|
+
* Id shapes:
|
|
15
|
+
* - `bare` → Router public face (`/v1/models`, client `model` field)
|
|
16
|
+
* - `prefixed` → OpenRouter / agents (`provider/model`)
|
|
17
|
+
*/
|
|
18
|
+
type FrontierProvider = "openai" | "anthropic" | "google" | "deepseek";
|
|
19
|
+
interface FrontierModelDef {
|
|
20
|
+
/** Bare public id (Router / cost UI). */
|
|
21
|
+
readonly bare: string;
|
|
22
|
+
/** Prefixed id for OpenRouter / @nebutra/agents. */
|
|
23
|
+
readonly prefixed: string;
|
|
24
|
+
readonly provider: FrontierProvider;
|
|
25
|
+
readonly label: string;
|
|
26
|
+
/** List-price ballpark; not billing SSOT. */
|
|
27
|
+
readonly inputPerMTok: number;
|
|
28
|
+
readonly outputPerMTok: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Named slots — semantic roles, not version numbers.
|
|
32
|
+
* When a generation ships, change the *values* here; keep slot keys stable.
|
|
33
|
+
*/
|
|
34
|
+
declare const FRONTIER: {
|
|
35
|
+
/** Product default when the client omits `model`. */
|
|
36
|
+
readonly default: {
|
|
37
|
+
readonly bare: "gpt-5.6-luna";
|
|
38
|
+
readonly prefixed: "openai/gpt-5.6-luna";
|
|
39
|
+
readonly provider: "openai";
|
|
40
|
+
readonly label: "OpenAI GPT-5.6 Luna";
|
|
41
|
+
readonly inputPerMTok: 1;
|
|
42
|
+
readonly outputPerMTok: 6;
|
|
43
|
+
};
|
|
44
|
+
readonly openaiWorkhorse: {
|
|
45
|
+
readonly bare: "gpt-5.6-luna";
|
|
46
|
+
readonly prefixed: "openai/gpt-5.6-luna";
|
|
47
|
+
readonly provider: "openai";
|
|
48
|
+
readonly label: "OpenAI GPT-5.6 Luna";
|
|
49
|
+
readonly inputPerMTok: 1;
|
|
50
|
+
readonly outputPerMTok: 6;
|
|
51
|
+
};
|
|
52
|
+
readonly openaiMid: {
|
|
53
|
+
readonly bare: "gpt-5.6-terra";
|
|
54
|
+
readonly prefixed: "openai/gpt-5.6-terra";
|
|
55
|
+
readonly provider: "openai";
|
|
56
|
+
readonly label: "OpenAI GPT-5.6 Terra";
|
|
57
|
+
readonly inputPerMTok: 2.5;
|
|
58
|
+
readonly outputPerMTok: 15;
|
|
59
|
+
};
|
|
60
|
+
readonly openaiFlagship: {
|
|
61
|
+
readonly bare: "gpt-5.6-sol";
|
|
62
|
+
readonly prefixed: "openai/gpt-5.6-sol";
|
|
63
|
+
readonly provider: "openai";
|
|
64
|
+
readonly label: "OpenAI GPT-5.6 Sol";
|
|
65
|
+
readonly inputPerMTok: 5;
|
|
66
|
+
readonly outputPerMTok: 30;
|
|
67
|
+
};
|
|
68
|
+
readonly anthropicFlagship: {
|
|
69
|
+
readonly bare: "claude-sonnet-5";
|
|
70
|
+
readonly prefixed: "anthropic/claude-sonnet-5";
|
|
71
|
+
readonly provider: "anthropic";
|
|
72
|
+
readonly label: "Anthropic Claude Sonnet 5";
|
|
73
|
+
readonly inputPerMTok: 2;
|
|
74
|
+
readonly outputPerMTok: 10;
|
|
75
|
+
};
|
|
76
|
+
readonly anthropicReasoning: {
|
|
77
|
+
readonly bare: "claude-fable-5";
|
|
78
|
+
readonly prefixed: "anthropic/claude-fable-5";
|
|
79
|
+
readonly provider: "anthropic";
|
|
80
|
+
readonly label: "Anthropic Claude Fable 5";
|
|
81
|
+
readonly inputPerMTok: 10;
|
|
82
|
+
readonly outputPerMTok: 50;
|
|
83
|
+
};
|
|
84
|
+
readonly anthropicOpus: {
|
|
85
|
+
readonly bare: "claude-opus-4.8";
|
|
86
|
+
readonly prefixed: "anthropic/claude-opus-4.8";
|
|
87
|
+
readonly provider: "anthropic";
|
|
88
|
+
readonly label: "Anthropic Claude Opus 4.8";
|
|
89
|
+
readonly inputPerMTok: 5;
|
|
90
|
+
readonly outputPerMTok: 25;
|
|
91
|
+
};
|
|
92
|
+
readonly anthropicFast: {
|
|
93
|
+
readonly bare: "claude-haiku-4.5";
|
|
94
|
+
readonly prefixed: "anthropic/claude-haiku-4.5";
|
|
95
|
+
readonly provider: "anthropic";
|
|
96
|
+
readonly label: "Anthropic Claude Haiku 4.5";
|
|
97
|
+
readonly inputPerMTok: 1;
|
|
98
|
+
readonly outputPerMTok: 5;
|
|
99
|
+
};
|
|
100
|
+
readonly googleFlagship: {
|
|
101
|
+
readonly bare: "gemini-3.1-pro";
|
|
102
|
+
readonly prefixed: "google/gemini-3.1-pro-preview";
|
|
103
|
+
readonly provider: "google";
|
|
104
|
+
readonly label: "Google Gemini 3.1 Pro";
|
|
105
|
+
readonly inputPerMTok: 2;
|
|
106
|
+
readonly outputPerMTok: 12;
|
|
107
|
+
};
|
|
108
|
+
readonly googleFast: {
|
|
109
|
+
readonly bare: "gemini-3.6-flash";
|
|
110
|
+
readonly prefixed: "google/gemini-3.6-flash";
|
|
111
|
+
readonly provider: "google";
|
|
112
|
+
readonly label: "Google Gemini 3.6 Flash";
|
|
113
|
+
readonly inputPerMTok: 1.5;
|
|
114
|
+
readonly outputPerMTok: 7.5;
|
|
115
|
+
};
|
|
116
|
+
readonly deepseekFast: {
|
|
117
|
+
readonly bare: "deepseek-v4-flash";
|
|
118
|
+
readonly prefixed: "deepseek/deepseek-v4-flash";
|
|
119
|
+
readonly provider: "deepseek";
|
|
120
|
+
readonly label: "DeepSeek V4 Flash";
|
|
121
|
+
readonly inputPerMTok: 0.098;
|
|
122
|
+
readonly outputPerMTok: 0.196;
|
|
123
|
+
};
|
|
124
|
+
readonly deepseekPro: {
|
|
125
|
+
readonly bare: "deepseek-v4-pro";
|
|
126
|
+
readonly prefixed: "deepseek/deepseek-v4-pro";
|
|
127
|
+
readonly provider: "deepseek";
|
|
128
|
+
readonly label: "DeepSeek V4 Pro";
|
|
129
|
+
readonly inputPerMTok: 0.435;
|
|
130
|
+
readonly outputPerMTok: 0.87;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
type FrontierSlot = keyof typeof FRONTIER;
|
|
134
|
+
/** Bare id when client omits model (Router, gateway demo defaults). */
|
|
135
|
+
declare const DEFAULT_PUBLIC_MODEL: string;
|
|
136
|
+
/** Prefixed id for agents / OpenRouter when config omits model. */
|
|
137
|
+
declare const DEFAULT_PREFIXED_MODEL: string;
|
|
138
|
+
/**
|
|
139
|
+
* Offline fallbacks for `resolveFrontierModel(tier)` / ModelTier.
|
|
140
|
+
* Prefixed OpenRouter-style ids.
|
|
141
|
+
*/
|
|
142
|
+
declare const FRONTIER_TIER_FALLBACK: {
|
|
143
|
+
readonly reasoning: "anthropic/claude-fable-5";
|
|
144
|
+
readonly flagship: "anthropic/claude-sonnet-5";
|
|
145
|
+
readonly fast: "anthropic/claude-haiku-4.5";
|
|
146
|
+
readonly "openai-flagship": "openai/gpt-5.6-sol";
|
|
147
|
+
readonly "google-flagship": "google/gemini-3.1-pro-preview";
|
|
148
|
+
readonly "google-fast": "google/gemini-3.6-flash";
|
|
149
|
+
};
|
|
150
|
+
/** @deprecated Use FRONTIER_TIER_FALLBACK — kept as alias for existing imports. */
|
|
151
|
+
declare const FRONTIER_FALLBACK: {
|
|
152
|
+
readonly reasoning: "anthropic/claude-fable-5";
|
|
153
|
+
readonly flagship: "anthropic/claude-sonnet-5";
|
|
154
|
+
readonly fast: "anthropic/claude-haiku-4.5";
|
|
155
|
+
readonly "openai-flagship": "openai/gpt-5.6-sol";
|
|
156
|
+
readonly "google-flagship": "google/gemini-3.1-pro-preview";
|
|
157
|
+
readonly "google-fast": "google/gemini-3.6-flash";
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Ordered bare public catalog for Router alias table / Forge cost UI.
|
|
161
|
+
* Deduped (default and openaiWorkhorse share the same bare id).
|
|
162
|
+
*/
|
|
163
|
+
declare const ROUTER_PUBLIC_MODEL_IDS: readonly string[];
|
|
164
|
+
/** Agent SDK preset map (prefixed). Slot names match historical `models.*` keys. */
|
|
165
|
+
declare const AGENT_MODEL_PRESETS: {
|
|
166
|
+
readonly flagship: "anthropic/claude-sonnet-5";
|
|
167
|
+
readonly reasoning: "anthropic/claude-fable-5";
|
|
168
|
+
readonly fast: "anthropic/claude-haiku-4.5";
|
|
169
|
+
readonly "openai-flagship": "openai/gpt-5.6-sol";
|
|
170
|
+
readonly "google-flagship": "google/gemini-3.1-pro-preview";
|
|
171
|
+
readonly "google-fast": "google/gemini-3.6-flash";
|
|
172
|
+
};
|
|
173
|
+
/** Forge / docs select options derived from the registry. */
|
|
174
|
+
declare function frontierSelectOptions(): readonly {
|
|
175
|
+
value: string;
|
|
176
|
+
label: string;
|
|
177
|
+
}[];
|
|
178
|
+
declare function findByBare(bare: string): FrontierModelDef | undefined;
|
|
179
|
+
declare function findByPrefixed(prefixed: string): FrontierModelDef | undefined;
|
|
180
|
+
declare function getFrontier(slot: FrontierSlot): FrontierModelDef;
|
|
181
|
+
/** Strip `provider/` prefix if present. */
|
|
182
|
+
declare function toBareModelId(id: string): string;
|
|
183
|
+
/**
|
|
184
|
+
* Ensure OpenRouter-style prefix. If already prefixed, return as-is.
|
|
185
|
+
* Unknown bare ids get `openai/` only when they look like gpt-*; otherwise left bare.
|
|
186
|
+
*/
|
|
187
|
+
declare function toPrefixedModelId(id: string): string;
|
|
188
|
+
/** CLI / env fallback tokens like `openai:gpt-5.6-luna`. */
|
|
189
|
+
declare function toCliModelToken(bareOrPrefixed: string): string;
|
|
190
|
+
|
|
191
|
+
export { AGENT_MODEL_PRESETS, DEFAULT_PREFIXED_MODEL, DEFAULT_PUBLIC_MODEL, FRONTIER, FRONTIER_FALLBACK, FRONTIER_TIER_FALLBACK, type FrontierModelDef, type FrontierProvider, type FrontierSlot, ROUTER_PUBLIC_MODEL_IDS, findByBare, findByPrefixed, frontierSelectOptions, getFrontier, toBareModelId, toCliModelToken, toPrefixedModelId };
|
package/dist/frontier.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// src/frontier.ts
|
|
2
|
+
var FRONTIER = {
|
|
3
|
+
/** Product default when the client omits `model`. */
|
|
4
|
+
default: {
|
|
5
|
+
bare: "gpt-5.6-luna",
|
|
6
|
+
prefixed: "openai/gpt-5.6-luna",
|
|
7
|
+
provider: "openai",
|
|
8
|
+
label: "OpenAI GPT-5.6 Luna",
|
|
9
|
+
inputPerMTok: 1,
|
|
10
|
+
outputPerMTok: 6
|
|
11
|
+
},
|
|
12
|
+
openaiWorkhorse: {
|
|
13
|
+
bare: "gpt-5.6-luna",
|
|
14
|
+
prefixed: "openai/gpt-5.6-luna",
|
|
15
|
+
provider: "openai",
|
|
16
|
+
label: "OpenAI GPT-5.6 Luna",
|
|
17
|
+
inputPerMTok: 1,
|
|
18
|
+
outputPerMTok: 6
|
|
19
|
+
},
|
|
20
|
+
openaiMid: {
|
|
21
|
+
bare: "gpt-5.6-terra",
|
|
22
|
+
prefixed: "openai/gpt-5.6-terra",
|
|
23
|
+
provider: "openai",
|
|
24
|
+
label: "OpenAI GPT-5.6 Terra",
|
|
25
|
+
inputPerMTok: 2.5,
|
|
26
|
+
outputPerMTok: 15
|
|
27
|
+
},
|
|
28
|
+
openaiFlagship: {
|
|
29
|
+
bare: "gpt-5.6-sol",
|
|
30
|
+
prefixed: "openai/gpt-5.6-sol",
|
|
31
|
+
provider: "openai",
|
|
32
|
+
label: "OpenAI GPT-5.6 Sol",
|
|
33
|
+
inputPerMTok: 5,
|
|
34
|
+
outputPerMTok: 30
|
|
35
|
+
},
|
|
36
|
+
anthropicFlagship: {
|
|
37
|
+
bare: "claude-sonnet-5",
|
|
38
|
+
prefixed: "anthropic/claude-sonnet-5",
|
|
39
|
+
provider: "anthropic",
|
|
40
|
+
label: "Anthropic Claude Sonnet 5",
|
|
41
|
+
inputPerMTok: 2,
|
|
42
|
+
outputPerMTok: 10
|
|
43
|
+
},
|
|
44
|
+
anthropicReasoning: {
|
|
45
|
+
bare: "claude-fable-5",
|
|
46
|
+
prefixed: "anthropic/claude-fable-5",
|
|
47
|
+
provider: "anthropic",
|
|
48
|
+
label: "Anthropic Claude Fable 5",
|
|
49
|
+
inputPerMTok: 10,
|
|
50
|
+
outputPerMTok: 50
|
|
51
|
+
},
|
|
52
|
+
anthropicOpus: {
|
|
53
|
+
bare: "claude-opus-4.8",
|
|
54
|
+
prefixed: "anthropic/claude-opus-4.8",
|
|
55
|
+
provider: "anthropic",
|
|
56
|
+
label: "Anthropic Claude Opus 4.8",
|
|
57
|
+
inputPerMTok: 5,
|
|
58
|
+
outputPerMTok: 25
|
|
59
|
+
},
|
|
60
|
+
anthropicFast: {
|
|
61
|
+
bare: "claude-haiku-4.5",
|
|
62
|
+
prefixed: "anthropic/claude-haiku-4.5",
|
|
63
|
+
provider: "anthropic",
|
|
64
|
+
label: "Anthropic Claude Haiku 4.5",
|
|
65
|
+
inputPerMTok: 1,
|
|
66
|
+
outputPerMTok: 5
|
|
67
|
+
},
|
|
68
|
+
googleFlagship: {
|
|
69
|
+
bare: "gemini-3.1-pro",
|
|
70
|
+
prefixed: "google/gemini-3.1-pro-preview",
|
|
71
|
+
provider: "google",
|
|
72
|
+
label: "Google Gemini 3.1 Pro",
|
|
73
|
+
inputPerMTok: 2,
|
|
74
|
+
outputPerMTok: 12
|
|
75
|
+
},
|
|
76
|
+
googleFast: {
|
|
77
|
+
bare: "gemini-3.6-flash",
|
|
78
|
+
prefixed: "google/gemini-3.6-flash",
|
|
79
|
+
provider: "google",
|
|
80
|
+
label: "Google Gemini 3.6 Flash",
|
|
81
|
+
inputPerMTok: 1.5,
|
|
82
|
+
outputPerMTok: 7.5
|
|
83
|
+
},
|
|
84
|
+
deepseekFast: {
|
|
85
|
+
bare: "deepseek-v4-flash",
|
|
86
|
+
prefixed: "deepseek/deepseek-v4-flash",
|
|
87
|
+
provider: "deepseek",
|
|
88
|
+
label: "DeepSeek V4 Flash",
|
|
89
|
+
inputPerMTok: 0.098,
|
|
90
|
+
outputPerMTok: 0.196
|
|
91
|
+
},
|
|
92
|
+
deepseekPro: {
|
|
93
|
+
bare: "deepseek-v4-pro",
|
|
94
|
+
prefixed: "deepseek/deepseek-v4-pro",
|
|
95
|
+
provider: "deepseek",
|
|
96
|
+
label: "DeepSeek V4 Pro",
|
|
97
|
+
inputPerMTok: 0.435,
|
|
98
|
+
outputPerMTok: 0.87
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
var DEFAULT_PUBLIC_MODEL = FRONTIER.default.bare;
|
|
102
|
+
var DEFAULT_PREFIXED_MODEL = FRONTIER.default.prefixed;
|
|
103
|
+
var FRONTIER_TIER_FALLBACK = {
|
|
104
|
+
reasoning: FRONTIER.anthropicReasoning.prefixed,
|
|
105
|
+
flagship: FRONTIER.anthropicFlagship.prefixed,
|
|
106
|
+
fast: FRONTIER.anthropicFast.prefixed,
|
|
107
|
+
"openai-flagship": FRONTIER.openaiFlagship.prefixed,
|
|
108
|
+
"google-flagship": FRONTIER.googleFlagship.prefixed,
|
|
109
|
+
"google-fast": FRONTIER.googleFast.prefixed
|
|
110
|
+
};
|
|
111
|
+
var FRONTIER_FALLBACK = FRONTIER_TIER_FALLBACK;
|
|
112
|
+
var ROUTER_PUBLIC_MODEL_IDS = uniqueBare([
|
|
113
|
+
FRONTIER.default,
|
|
114
|
+
FRONTIER.openaiMid,
|
|
115
|
+
FRONTIER.openaiFlagship,
|
|
116
|
+
FRONTIER.anthropicFlagship,
|
|
117
|
+
FRONTIER.anthropicReasoning,
|
|
118
|
+
FRONTIER.anthropicOpus,
|
|
119
|
+
FRONTIER.anthropicFast,
|
|
120
|
+
FRONTIER.googleFast,
|
|
121
|
+
FRONTIER.googleFlagship,
|
|
122
|
+
FRONTIER.deepseekFast,
|
|
123
|
+
FRONTIER.deepseekPro
|
|
124
|
+
]);
|
|
125
|
+
var AGENT_MODEL_PRESETS = {
|
|
126
|
+
flagship: FRONTIER.anthropicFlagship.prefixed,
|
|
127
|
+
reasoning: FRONTIER.anthropicReasoning.prefixed,
|
|
128
|
+
fast: FRONTIER.anthropicFast.prefixed,
|
|
129
|
+
"openai-flagship": FRONTIER.openaiFlagship.prefixed,
|
|
130
|
+
"google-flagship": FRONTIER.googleFlagship.prefixed,
|
|
131
|
+
"google-fast": FRONTIER.googleFast.prefixed
|
|
132
|
+
};
|
|
133
|
+
function frontierSelectOptions() {
|
|
134
|
+
return ROUTER_PUBLIC_MODEL_IDS.map((bare) => {
|
|
135
|
+
const def = findByBare(bare);
|
|
136
|
+
return { value: bare, label: def?.label ?? bare };
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function findByBare(bare) {
|
|
140
|
+
return Object.values(FRONTIER).find((m) => m.bare === bare);
|
|
141
|
+
}
|
|
142
|
+
function findByPrefixed(prefixed) {
|
|
143
|
+
return Object.values(FRONTIER).find((m) => m.prefixed === prefixed);
|
|
144
|
+
}
|
|
145
|
+
function getFrontier(slot) {
|
|
146
|
+
return FRONTIER[slot];
|
|
147
|
+
}
|
|
148
|
+
function toBareModelId(id) {
|
|
149
|
+
const i = id.indexOf("/");
|
|
150
|
+
return i >= 0 ? id.slice(i + 1) : id;
|
|
151
|
+
}
|
|
152
|
+
function toPrefixedModelId(id) {
|
|
153
|
+
if (id.includes("/")) return id;
|
|
154
|
+
const hit = findByBare(id);
|
|
155
|
+
if (hit) return hit.prefixed;
|
|
156
|
+
if (id.startsWith("gpt-") || id.startsWith("o1") || id.startsWith("o3") || id.startsWith("o4")) {
|
|
157
|
+
return `openai/${id}`;
|
|
158
|
+
}
|
|
159
|
+
if (id.startsWith("claude-")) return `anthropic/${id}`;
|
|
160
|
+
if (id.startsWith("gemini-")) return `google/${id}`;
|
|
161
|
+
if (id.startsWith("deepseek-")) return `deepseek/${id}`;
|
|
162
|
+
return id;
|
|
163
|
+
}
|
|
164
|
+
function toCliModelToken(bareOrPrefixed) {
|
|
165
|
+
const bare = toBareModelId(bareOrPrefixed);
|
|
166
|
+
const def = findByBare(bare);
|
|
167
|
+
const provider = def?.provider ?? "openai";
|
|
168
|
+
return `${provider}:${bare}`;
|
|
169
|
+
}
|
|
170
|
+
function uniqueBare(defs) {
|
|
171
|
+
const seen = /* @__PURE__ */ new Set();
|
|
172
|
+
const out = [];
|
|
173
|
+
for (const d of defs) {
|
|
174
|
+
if (seen.has(d.bare)) continue;
|
|
175
|
+
seen.add(d.bare);
|
|
176
|
+
out.push(d.bare);
|
|
177
|
+
}
|
|
178
|
+
return out;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export { AGENT_MODEL_PRESETS, DEFAULT_PREFIXED_MODEL, DEFAULT_PUBLIC_MODEL, FRONTIER, FRONTIER_FALLBACK, FRONTIER_TIER_FALLBACK, ROUTER_PUBLIC_MODEL_IDS, findByBare, findByPrefixed, frontierSelectOptions, getFrontier, toBareModelId, toCliModelToken, toPrefixedModelId };
|
|
182
|
+
//# sourceMappingURL=frontier.js.map
|
|
183
|
+
//# sourceMappingURL=frontier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/frontier.ts"],"names":[],"mappings":";AAoCO,IAAM,QAAA,GAAW;AAAA;AAAA,EAEtB,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,cAAA;AAAA,IACN,QAAA,EAAU,qBAAA;AAAA,IACV,QAAA,EAAU,QAAA;AAAA,IACV,KAAA,EAAO,qBAAA;AAAA,IACP,YAAA,EAAc,CAAA;AAAA,IACd,aAAA,EAAe;AAAA,GACjB;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,IAAA,EAAM,cAAA;AAAA,IACN,QAAA,EAAU,qBAAA;AAAA,IACV,QAAA,EAAU,QAAA;AAAA,IACV,KAAA,EAAO,qBAAA;AAAA,IACP,YAAA,EAAc,CAAA;AAAA,IACd,aAAA,EAAe;AAAA,GACjB;AAAA,EACA,SAAA,EAAW;AAAA,IACT,IAAA,EAAM,eAAA;AAAA,IACN,QAAA,EAAU,sBAAA;AAAA,IACV,QAAA,EAAU,QAAA;AAAA,IACV,KAAA,EAAO,sBAAA;AAAA,IACP,YAAA,EAAc,GAAA;AAAA,IACd,aAAA,EAAe;AAAA,GACjB;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,IAAA,EAAM,aAAA;AAAA,IACN,QAAA,EAAU,oBAAA;AAAA,IACV,QAAA,EAAU,QAAA;AAAA,IACV,KAAA,EAAO,oBAAA;AAAA,IACP,YAAA,EAAc,CAAA;AAAA,IACd,aAAA,EAAe;AAAA,GACjB;AAAA,EACA,iBAAA,EAAmB;AAAA,IACjB,IAAA,EAAM,iBAAA;AAAA,IACN,QAAA,EAAU,2BAAA;AAAA,IACV,QAAA,EAAU,WAAA;AAAA,IACV,KAAA,EAAO,2BAAA;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pB,EAAA,IAAI,EAAA,CAAG,UAAA,CAAW,MAAM,CAAA,IAAK,GAAG,UAAA,CAAW,IAAI,CAAA,IAAK,EAAA,CAAG,WAAW,IAAI,CAAA,IAAK,EAAA,CAAG,UAAA,CAAW,IAAI,CAAA,EAAG;AAC9F,IAAA,OAAO,UAAU,EAAE,CAAA,CAAA;AAAA,EACrB;AACA,EAAA,IAAI,GAAG,UAAA,CAAW,SAAS,CAAA,EAAG,OAAO,aAAa,EAAE,CAAA,CAAA;AACpD,EAAA,IAAI,GAAG,UAAA,CAAW,SAAS,CAAA,EAAG,OAAO,UAAU,EAAE,CAAA,CAAA;AACjD,EAAA,IAAI,GAAG,UAAA,CAAW,WAAW,CAAA,EAAG,OAAO,YAAY,EAAE,CAAA,CAAA;AACrD,EAAA,OAAO,EAAA;AACT;AAGO,SAAS,gBAAgB,cAAA,EAAgC;AAC9D,EAAA,MAAM,IAAA,GAAO,cAAc,cAAc,CAAA;AACzC,EAAA,MAAM,GAAA,GAAM,WAAW,IAAI,CAAA;AAC3B,EAAA,MAAM,QAAA,GAAW,KAAK,QAAA,IAAY,QAAA;AAClC,EAAA,OAAO,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAC5B;AAEA,SAAS,WAAW,IAAA,EAA6C;AAC/D,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,MAAM,MAAgB,EAAC;AACvB,EAAA,KAAA,MAAW,KAAK,IAAA,EAAM;AACpB,IAAA,IAAI,IAAA,CAAK,GAAA,CAAI,CAAA,CAAE,IAAI,CAAA,EAAG;AACtB,IAAA,IAAA,CAAK,GAAA,CAAI,EAAE,IAAI,CAAA;AACf,IAAA,GAAA,CAAI,IAAA,CAAK,EAAE,IAAI,CAAA;AAAA,EACjB;AACA,EAAA,OAAO,GAAA;AACT","file":"frontier.js","sourcesContent":["/**\n * ═══════════════════════════════════════════════════════════════════════════\n * FRONTIER MODEL REGISTRY — single source of truth (SSOT)\n * ═══════════════════════════════════════════════════════════════════════════\n *\n * Update **this file only** when the industry catalog moves. Every product\n * surface (Router defaults, agents presets, Forge price card, gateway sample\n * models, docs examples that import from here) should derive ids from this\n * module — do not hand-type bare model strings in apps.\n *\n * Audit: 2026-07-24 vs OpenRouter live `/api/v1/models`\n * Prices: OpenRouter list rates USD / 1M tokens (prompt/completion × 1e6)\n *\n * Id shapes:\n * - `bare` → Router public face (`/v1/models`, client `model` field)\n * - `prefixed` → OpenRouter / agents (`provider/model`)\n */\n\nexport type FrontierProvider = \"openai\" | \"anthropic\" | \"google\" | \"deepseek\";\n\nexport interface FrontierModelDef {\n /** Bare public id (Router / cost UI). */\n readonly bare: string;\n /** Prefixed id for OpenRouter / @nebutra/agents. */\n readonly prefixed: string;\n readonly provider: FrontierProvider;\n readonly label: string;\n /** List-price ballpark; not billing SSOT. */\n readonly inputPerMTok: number;\n readonly outputPerMTok: number;\n}\n\n/**\n * Named slots — semantic roles, not version numbers.\n * When a generation ships, change the *values* here; keep slot keys stable.\n */\nexport const FRONTIER = {\n /** Product default when the client omits `model`. */\n default: {\n bare: \"gpt-5.6-luna\",\n prefixed: \"openai/gpt-5.6-luna\",\n provider: \"openai\",\n label: \"OpenAI GPT-5.6 Luna\",\n inputPerMTok: 1,\n outputPerMTok: 6,\n },\n openaiWorkhorse: {\n bare: \"gpt-5.6-luna\",\n prefixed: \"openai/gpt-5.6-luna\",\n provider: \"openai\",\n label: \"OpenAI GPT-5.6 Luna\",\n inputPerMTok: 1,\n outputPerMTok: 6,\n },\n openaiMid: {\n bare: \"gpt-5.6-terra\",\n prefixed: \"openai/gpt-5.6-terra\",\n provider: \"openai\",\n label: \"OpenAI GPT-5.6 Terra\",\n inputPerMTok: 2.5,\n outputPerMTok: 15,\n },\n openaiFlagship: {\n bare: \"gpt-5.6-sol\",\n prefixed: \"openai/gpt-5.6-sol\",\n provider: \"openai\",\n label: \"OpenAI GPT-5.6 Sol\",\n inputPerMTok: 5,\n outputPerMTok: 30,\n },\n anthropicFlagship: {\n bare: \"claude-sonnet-5\",\n prefixed: \"anthropic/claude-sonnet-5\",\n provider: \"anthropic\",\n label: \"Anthropic Claude Sonnet 5\",\n inputPerMTok: 2,\n outputPerMTok: 10,\n },\n anthropicReasoning: {\n bare: \"claude-fable-5\",\n prefixed: \"anthropic/claude-fable-5\",\n provider: \"anthropic\",\n label: \"Anthropic Claude Fable 5\",\n inputPerMTok: 10,\n outputPerMTok: 50,\n },\n anthropicOpus: {\n bare: \"claude-opus-4.8\",\n prefixed: \"anthropic/claude-opus-4.8\",\n provider: \"anthropic\",\n label: \"Anthropic Claude Opus 4.8\",\n inputPerMTok: 5,\n outputPerMTok: 25,\n },\n anthropicFast: {\n bare: \"claude-haiku-4.5\",\n prefixed: \"anthropic/claude-haiku-4.5\",\n provider: \"anthropic\",\n label: \"Anthropic Claude Haiku 4.5\",\n inputPerMTok: 1,\n outputPerMTok: 5,\n },\n googleFlagship: {\n bare: \"gemini-3.1-pro\",\n prefixed: \"google/gemini-3.1-pro-preview\",\n provider: \"google\",\n label: \"Google Gemini 3.1 Pro\",\n inputPerMTok: 2,\n outputPerMTok: 12,\n },\n googleFast: {\n bare: \"gemini-3.6-flash\",\n prefixed: \"google/gemini-3.6-flash\",\n provider: \"google\",\n label: \"Google Gemini 3.6 Flash\",\n inputPerMTok: 1.5,\n outputPerMTok: 7.5,\n },\n deepseekFast: {\n bare: \"deepseek-v4-flash\",\n prefixed: \"deepseek/deepseek-v4-flash\",\n provider: \"deepseek\",\n label: \"DeepSeek V4 Flash\",\n inputPerMTok: 0.098,\n outputPerMTok: 0.196,\n },\n deepseekPro: {\n bare: \"deepseek-v4-pro\",\n prefixed: \"deepseek/deepseek-v4-pro\",\n provider: \"deepseek\",\n label: \"DeepSeek V4 Pro\",\n inputPerMTok: 0.435,\n outputPerMTok: 0.87,\n },\n} as const satisfies Record<string, FrontierModelDef>;\n\nexport type FrontierSlot = keyof typeof FRONTIER;\n\n/** Bare id when client omits model (Router, gateway demo defaults). */\nexport const DEFAULT_PUBLIC_MODEL: string = FRONTIER.default.bare;\n\n/** Prefixed id for agents / OpenRouter when config omits model. */\nexport const DEFAULT_PREFIXED_MODEL: string = FRONTIER.default.prefixed;\n\n/**\n * Offline fallbacks for `resolveFrontierModel(tier)` / ModelTier.\n * Prefixed OpenRouter-style ids.\n */\nexport const FRONTIER_TIER_FALLBACK = {\n reasoning: FRONTIER.anthropicReasoning.prefixed,\n flagship: FRONTIER.anthropicFlagship.prefixed,\n fast: FRONTIER.anthropicFast.prefixed,\n \"openai-flagship\": FRONTIER.openaiFlagship.prefixed,\n \"google-flagship\": FRONTIER.googleFlagship.prefixed,\n \"google-fast\": FRONTIER.googleFast.prefixed,\n} as const;\n\n/** @deprecated Use FRONTIER_TIER_FALLBACK — kept as alias for existing imports. */\nexport const FRONTIER_FALLBACK = FRONTIER_TIER_FALLBACK;\n\n/**\n * Ordered bare public catalog for Router alias table / Forge cost UI.\n * Deduped (default and openaiWorkhorse share the same bare id).\n */\nexport const ROUTER_PUBLIC_MODEL_IDS: readonly string[] = uniqueBare([\n FRONTIER.default,\n FRONTIER.openaiMid,\n FRONTIER.openaiFlagship,\n FRONTIER.anthropicFlagship,\n FRONTIER.anthropicReasoning,\n FRONTIER.anthropicOpus,\n FRONTIER.anthropicFast,\n FRONTIER.googleFast,\n FRONTIER.googleFlagship,\n FRONTIER.deepseekFast,\n FRONTIER.deepseekPro,\n]);\n\n/** Agent SDK preset map (prefixed). Slot names match historical `models.*` keys. */\nexport const AGENT_MODEL_PRESETS = {\n flagship: FRONTIER.anthropicFlagship.prefixed,\n reasoning: FRONTIER.anthropicReasoning.prefixed,\n fast: FRONTIER.anthropicFast.prefixed,\n \"openai-flagship\": FRONTIER.openaiFlagship.prefixed,\n \"google-flagship\": FRONTIER.googleFlagship.prefixed,\n \"google-fast\": FRONTIER.googleFast.prefixed,\n} as const;\n\n/** Forge / docs select options derived from the registry. */\nexport function frontierSelectOptions(): readonly { value: string; label: string }[] {\n return ROUTER_PUBLIC_MODEL_IDS.map((bare) => {\n const def = findByBare(bare);\n return { value: bare, label: def?.label ?? bare };\n });\n}\n\nexport function findByBare(bare: string): FrontierModelDef | undefined {\n return Object.values(FRONTIER).find((m) => m.bare === bare);\n}\n\nexport function findByPrefixed(prefixed: string): FrontierModelDef | undefined {\n return Object.values(FRONTIER).find((m) => m.prefixed === prefixed);\n}\n\nexport function getFrontier(slot: FrontierSlot): FrontierModelDef {\n return FRONTIER[slot];\n}\n\n/** Strip `provider/` prefix if present. */\nexport function toBareModelId(id: string): string {\n const i = id.indexOf(\"/\");\n return i >= 0 ? id.slice(i + 1) : id;\n}\n\n/**\n * Ensure OpenRouter-style prefix. If already prefixed, return as-is.\n * Unknown bare ids get `openai/` only when they look like gpt-*; otherwise left bare.\n */\nexport function toPrefixedModelId(id: string): string {\n if (id.includes(\"/\")) return id;\n const hit = findByBare(id);\n if (hit) return hit.prefixed;\n if (id.startsWith(\"gpt-\") || id.startsWith(\"o1\") || id.startsWith(\"o3\") || id.startsWith(\"o4\")) {\n return `openai/${id}`;\n }\n if (id.startsWith(\"claude-\")) return `anthropic/${id}`;\n if (id.startsWith(\"gemini-\")) return `google/${id}`;\n if (id.startsWith(\"deepseek-\")) return `deepseek/${id}`;\n return id;\n}\n\n/** CLI / env fallback tokens like `openai:gpt-5.6-luna`. */\nexport function toCliModelToken(bareOrPrefixed: string): string {\n const bare = toBareModelId(bareOrPrefixed);\n const def = findByBare(bare);\n const provider = def?.provider ?? \"openai\";\n return `${provider}:${bare}`;\n}\n\nfunction uniqueBare(defs: readonly FrontierModelDef[]): string[] {\n const seen = new Set<string>();\n const out: string[] = [];\n for (const d of defs) {\n if (seen.has(d.bare)) continue;\n seen.add(d.bare);\n out.push(d.bare);\n }\n return out;\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { AIProviderId, CatalogModel, FRONTIER_FALLBACK, ModelInfo, ModelModality, ModelOffering, ModelSpecHints, ModelTier, PROVIDER_MAP, getModelInfo, listModalities, listModels, listModelsByModality, mapProvider, providerBaseUrl, providerForModel, providerFromIdHeuristic, resolveFrontierModel, resolveModelSpec } from './catalog.js';
|
|
2
|
+
export { PROVIDERS, PROVIDERS_BY_CATEGORY, ProviderCategory, ProviderMeta, ProviderStatus, getProvider, isCNCompatible } from './meta.js';
|