@tyvm/knowhow 0.0.105 → 0.0.107

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 (219) hide show
  1. package/CONFIG.md +8 -5
  2. package/package.json +3 -2
  3. package/scripts/check-model-pricing.ts +509 -0
  4. package/scripts/compare-openrouter-coverage.ts +576 -0
  5. package/src/agents/base/base.ts +169 -5
  6. package/src/agents/tools/execCommand.ts +4 -0
  7. package/src/agents/tools/executeScript/definition.ts +1 -1
  8. package/src/agents/tools/index.ts +0 -1
  9. package/src/agents/tools/list.ts +3 -43
  10. package/src/agents/tools/writeFile.ts +1 -1
  11. package/src/auth/browserLogin.ts +9 -4
  12. package/src/chat/modules/RemoteSyncModule.ts +3 -0
  13. package/src/cli.ts +31 -1
  14. package/src/clients/anthropic.ts +8 -2
  15. package/src/clients/cerebras.ts +10 -0
  16. package/src/clients/contextLimits.ts +7 -2
  17. package/src/clients/copilot.ts +23 -0
  18. package/src/clients/deepseek.ts +16 -0
  19. package/src/clients/fireworks.ts +15 -0
  20. package/src/clients/gemini.ts +59 -4
  21. package/src/clients/github.ts +16 -0
  22. package/src/clients/groq.ts +15 -0
  23. package/src/clients/http.ts +194 -6
  24. package/src/clients/index.ts +116 -4
  25. package/src/clients/llama.ts +16 -0
  26. package/src/clients/mistral.ts +16 -0
  27. package/src/clients/nvidia.ts +16 -0
  28. package/src/clients/openai.ts +53 -12
  29. package/src/clients/openrouter.ts +17 -0
  30. package/src/clients/pricing/anthropic.ts +105 -78
  31. package/src/clients/pricing/cerebras.ts +11 -0
  32. package/src/clients/pricing/copilot.ts +60 -0
  33. package/src/clients/pricing/deepseek.ts +15 -0
  34. package/src/clients/pricing/fireworks.ts +32 -0
  35. package/src/clients/pricing/github.ts +69 -0
  36. package/src/clients/pricing/google.ts +245 -206
  37. package/src/clients/pricing/groq.ts +56 -0
  38. package/src/clients/pricing/index.ts +42 -5
  39. package/src/clients/pricing/llama.ts +18 -0
  40. package/src/clients/pricing/mistral.ts +34 -0
  41. package/src/clients/pricing/models.ts +7 -236
  42. package/src/clients/pricing/nvidia.ts +102 -0
  43. package/src/clients/pricing/openai.ts +348 -171
  44. package/src/clients/pricing/openrouter.ts +36 -0
  45. package/src/clients/pricing/types.ts +83 -2
  46. package/src/clients/pricing/xai.ts +121 -65
  47. package/src/clients/types.ts +28 -1
  48. package/src/clients/xai.ts +161 -1
  49. package/src/fileSync.ts +8 -2
  50. package/src/login.ts +11 -3
  51. package/src/services/AgentSyncFs.ts +36 -12
  52. package/src/services/KnowhowClient.ts +11 -0
  53. package/src/services/LazyToolsService.ts +6 -0
  54. package/src/services/S3.ts +0 -7
  55. package/src/services/modules/index.ts +11 -2
  56. package/src/types.ts +56 -279
  57. package/src/worker.ts +174 -0
  58. package/tests/clients/AIClient.test.ts +1 -1
  59. package/tests/clients/anthropic.test.ts +202 -0
  60. package/tests/clients/pricing.test.ts +37 -0
  61. package/tests/manual/clients/completions.json +838 -226
  62. package/tests/manual/clients/completions.test.ts +46 -31
  63. package/ts_build/package.json +3 -2
  64. package/ts_build/src/agents/base/base.d.ts +18 -1
  65. package/ts_build/src/agents/base/base.js +111 -4
  66. package/ts_build/src/agents/base/base.js.map +1 -1
  67. package/ts_build/src/agents/tools/execCommand.js +3 -0
  68. package/ts_build/src/agents/tools/execCommand.js.map +1 -1
  69. package/ts_build/src/agents/tools/executeScript/definition.js +1 -1
  70. package/ts_build/src/agents/tools/executeScript/definition.js.map +1 -1
  71. package/ts_build/src/agents/tools/index.d.ts +0 -1
  72. package/ts_build/src/agents/tools/index.js +0 -1
  73. package/ts_build/src/agents/tools/index.js.map +1 -1
  74. package/ts_build/src/agents/tools/list.js +3 -38
  75. package/ts_build/src/agents/tools/list.js.map +1 -1
  76. package/ts_build/src/agents/tools/visionTool.d.ts +1 -1
  77. package/ts_build/src/agents/tools/writeFile.js +1 -1
  78. package/ts_build/src/agents/tools/writeFile.js.map +1 -1
  79. package/ts_build/src/ai.d.ts +1 -1
  80. package/ts_build/src/auth/browserLogin.d.ts +2 -1
  81. package/ts_build/src/auth/browserLogin.js +10 -3
  82. package/ts_build/src/auth/browserLogin.js.map +1 -1
  83. package/ts_build/src/chat/modules/RemoteSyncModule.js +1 -0
  84. package/ts_build/src/chat/modules/RemoteSyncModule.js.map +1 -1
  85. package/ts_build/src/cli.js +19 -0
  86. package/ts_build/src/cli.js.map +1 -1
  87. package/ts_build/src/clients/anthropic.d.ts +1 -82
  88. package/ts_build/src/clients/anthropic.js +8 -2
  89. package/ts_build/src/clients/anthropic.js.map +1 -1
  90. package/ts_build/src/clients/cerebras.d.ts +4 -0
  91. package/ts_build/src/clients/cerebras.js +14 -0
  92. package/ts_build/src/clients/cerebras.js.map +1 -0
  93. package/ts_build/src/clients/contextLimits.js +7 -2
  94. package/ts_build/src/clients/contextLimits.js.map +1 -1
  95. package/ts_build/src/clients/copilot.d.ts +4 -0
  96. package/ts_build/src/clients/copilot.js +15 -0
  97. package/ts_build/src/clients/copilot.js.map +1 -0
  98. package/ts_build/src/clients/deepseek.d.ts +4 -0
  99. package/ts_build/src/clients/deepseek.js +15 -0
  100. package/ts_build/src/clients/deepseek.js.map +1 -0
  101. package/ts_build/src/clients/fireworks.d.ts +4 -0
  102. package/ts_build/src/clients/fireworks.js +15 -0
  103. package/ts_build/src/clients/fireworks.js.map +1 -0
  104. package/ts_build/src/clients/gemini.d.ts +1 -0
  105. package/ts_build/src/clients/gemini.js +38 -2
  106. package/ts_build/src/clients/gemini.js.map +1 -1
  107. package/ts_build/src/clients/github.d.ts +4 -0
  108. package/ts_build/src/clients/github.js +15 -0
  109. package/ts_build/src/clients/github.js.map +1 -0
  110. package/ts_build/src/clients/groq.d.ts +4 -0
  111. package/ts_build/src/clients/groq.js +15 -0
  112. package/ts_build/src/clients/groq.js.map +1 -0
  113. package/ts_build/src/clients/http.d.ts +22 -1
  114. package/ts_build/src/clients/http.js +135 -7
  115. package/ts_build/src/clients/http.js.map +1 -1
  116. package/ts_build/src/clients/index.d.ts +14 -0
  117. package/ts_build/src/clients/index.js +94 -4
  118. package/ts_build/src/clients/index.js.map +1 -1
  119. package/ts_build/src/clients/llama.d.ts +4 -0
  120. package/ts_build/src/clients/llama.js +15 -0
  121. package/ts_build/src/clients/llama.js.map +1 -0
  122. package/ts_build/src/clients/mistral.d.ts +4 -0
  123. package/ts_build/src/clients/mistral.js +15 -0
  124. package/ts_build/src/clients/mistral.js.map +1 -0
  125. package/ts_build/src/clients/nvidia.d.ts +4 -0
  126. package/ts_build/src/clients/nvidia.js +15 -0
  127. package/ts_build/src/clients/nvidia.js.map +1 -0
  128. package/ts_build/src/clients/openai.d.ts +4 -206
  129. package/ts_build/src/clients/openai.js +38 -10
  130. package/ts_build/src/clients/openai.js.map +1 -1
  131. package/ts_build/src/clients/openrouter.d.ts +4 -0
  132. package/ts_build/src/clients/openrouter.js +15 -0
  133. package/ts_build/src/clients/openrouter.js.map +1 -0
  134. package/ts_build/src/clients/pricing/anthropic.d.ts +26 -78
  135. package/ts_build/src/clients/pricing/anthropic.js +75 -78
  136. package/ts_build/src/clients/pricing/anthropic.js.map +1 -1
  137. package/ts_build/src/clients/pricing/cerebras.d.ts +4 -0
  138. package/ts_build/src/clients/pricing/cerebras.js +11 -0
  139. package/ts_build/src/clients/pricing/cerebras.js.map +1 -0
  140. package/ts_build/src/clients/pricing/copilot.d.ts +5 -0
  141. package/ts_build/src/clients/pricing/copilot.js +35 -0
  142. package/ts_build/src/clients/pricing/copilot.js.map +1 -0
  143. package/ts_build/src/clients/pricing/deepseek.d.ts +5 -0
  144. package/ts_build/src/clients/pricing/deepseek.js +10 -0
  145. package/ts_build/src/clients/pricing/deepseek.js.map +1 -0
  146. package/ts_build/src/clients/pricing/fireworks.d.ts +5 -0
  147. package/ts_build/src/clients/pricing/fireworks.js +21 -0
  148. package/ts_build/src/clients/pricing/fireworks.js.map +1 -0
  149. package/ts_build/src/clients/pricing/github.d.ts +4 -0
  150. package/ts_build/src/clients/pricing/github.js +58 -0
  151. package/ts_build/src/clients/pricing/github.js.map +1 -0
  152. package/ts_build/src/clients/pricing/google.d.ts +59 -6
  153. package/ts_build/src/clients/pricing/google.js +214 -167
  154. package/ts_build/src/clients/pricing/google.js.map +1 -1
  155. package/ts_build/src/clients/pricing/groq.d.ts +5 -0
  156. package/ts_build/src/clients/pricing/groq.js +41 -0
  157. package/ts_build/src/clients/pricing/groq.js.map +1 -0
  158. package/ts_build/src/clients/pricing/index.d.ts +16 -5
  159. package/ts_build/src/clients/pricing/index.js +62 -7
  160. package/ts_build/src/clients/pricing/index.js.map +1 -1
  161. package/ts_build/src/clients/pricing/llama.d.ts +4 -0
  162. package/ts_build/src/clients/pricing/llama.js +14 -0
  163. package/ts_build/src/clients/pricing/llama.js.map +1 -0
  164. package/ts_build/src/clients/pricing/mistral.d.ts +5 -0
  165. package/ts_build/src/clients/pricing/mistral.js +23 -0
  166. package/ts_build/src/clients/pricing/mistral.js.map +1 -0
  167. package/ts_build/src/clients/pricing/models.d.ts +5 -4
  168. package/ts_build/src/clients/pricing/models.js +8 -162
  169. package/ts_build/src/clients/pricing/models.js.map +1 -1
  170. package/ts_build/src/clients/pricing/nvidia.d.ts +8 -0
  171. package/ts_build/src/clients/pricing/nvidia.js +96 -0
  172. package/ts_build/src/clients/pricing/nvidia.js.map +1 -0
  173. package/ts_build/src/clients/pricing/openai.d.ts +86 -197
  174. package/ts_build/src/clients/pricing/openai.js +295 -168
  175. package/ts_build/src/clients/pricing/openai.js.map +1 -1
  176. package/ts_build/src/clients/pricing/openrouter.d.ts +4 -0
  177. package/ts_build/src/clients/pricing/openrouter.js +29 -0
  178. package/ts_build/src/clients/pricing/openrouter.js.map +1 -0
  179. package/ts_build/src/clients/pricing/types.d.ts +27 -2
  180. package/ts_build/src/clients/pricing/types.js +46 -0
  181. package/ts_build/src/clients/pricing/types.js.map +1 -1
  182. package/ts_build/src/clients/pricing/xai.d.ts +37 -57
  183. package/ts_build/src/clients/pricing/xai.js +92 -59
  184. package/ts_build/src/clients/pricing/xai.js.map +1 -1
  185. package/ts_build/src/clients/types.d.ts +12 -1
  186. package/ts_build/src/clients/xai.d.ts +2 -62
  187. package/ts_build/src/clients/xai.js +132 -1
  188. package/ts_build/src/clients/xai.js.map +1 -1
  189. package/ts_build/src/fileSync.js +7 -2
  190. package/ts_build/src/fileSync.js.map +1 -1
  191. package/ts_build/src/login.js +8 -2
  192. package/ts_build/src/login.js.map +1 -1
  193. package/ts_build/src/services/AgentSyncFs.js +1 -0
  194. package/ts_build/src/services/AgentSyncFs.js.map +1 -1
  195. package/ts_build/src/services/KnowhowClient.d.ts +1 -0
  196. package/ts_build/src/services/KnowhowClient.js +7 -0
  197. package/ts_build/src/services/KnowhowClient.js.map +1 -1
  198. package/ts_build/src/services/LazyToolsService.d.ts +1 -0
  199. package/ts_build/src/services/LazyToolsService.js +3 -0
  200. package/ts_build/src/services/LazyToolsService.js.map +1 -1
  201. package/ts_build/src/services/S3.js +0 -7
  202. package/ts_build/src/services/S3.js.map +1 -1
  203. package/ts_build/src/services/modules/index.js +41 -1
  204. package/ts_build/src/services/modules/index.js.map +1 -1
  205. package/ts_build/src/types.d.ts +163 -124
  206. package/ts_build/src/types.js +33 -213
  207. package/ts_build/src/types.js.map +1 -1
  208. package/ts_build/src/worker.d.ts +4 -0
  209. package/ts_build/src/worker.js +140 -0
  210. package/ts_build/src/worker.js.map +1 -1
  211. package/ts_build/tests/clients/AIClient.test.js +1 -1
  212. package/ts_build/tests/clients/AIClient.test.js.map +1 -1
  213. package/ts_build/tests/clients/anthropic.test.d.ts +1 -0
  214. package/ts_build/tests/clients/anthropic.test.js +159 -0
  215. package/ts_build/tests/clients/anthropic.test.js.map +1 -0
  216. package/ts_build/tests/clients/pricing.test.js +21 -0
  217. package/ts_build/tests/clients/pricing.test.js.map +1 -1
  218. package/ts_build/tests/manual/clients/completions.test.js +27 -24
  219. package/ts_build/tests/manual/clients/completions.test.js.map +1 -1
@@ -1,248 +1,19 @@
1
1
  /**
2
- * Model catalog: a single source of truth for all supported AI models,
3
- * their providers, types, display names, and pricing.
4
- *
5
- * Pricing is in USD per 1M tokens (or per-image / per-second for media models).
6
- * This is exported so the Knowhow backend (and other consumers) can import
7
- * model/pricing data without duplicating it.
2
+ * Assembles ALL_MODEL_CATALOG from per-provider catalogs.
3
+ * Each provider file is the single source of truth for its models.
8
4
  */
9
-
10
- import { Models, EmbeddingModels } from "../../types";
11
- import { OpenAiTextPricing } from "./openai";
12
- import { AnthropicTextPricing } from "./anthropic";
13
- import { GeminiPricing } from "./google";
14
- import { XaiTextPricing, XaiImagePricing, XaiVideoPricing } from "./xai";
15
5
  import { ModelPricing, ModelType, ModelCatalogEntry } from "./types";
6
+ import { OPENAI_MODEL_CATALOG } from "./openai";
7
+ import { ANTHROPIC_MODEL_CATALOG } from "./anthropic";
8
+ import { GOOGLE_MODEL_CATALOG } from "./google";
9
+ import { XAI_MODEL_CATALOG } from "./xai";
16
10
 
17
11
  export { ModelPricing, ModelType, ModelCatalogEntry };
18
12
 
19
- // ─── Platform markup ──────────────────────────────────────────────────────────
20
-
21
13
  /** 2.5% platform markup applied on top of all provider base rates */
22
14
  export const USAGE_MARKUP_PERCENT = 2.5 / 100;
23
15
 
24
- // ─── Helpers ──────────────────────────────────────────────────────────────────
25
-
26
- function completion(
27
- id: string,
28
- provider: string,
29
- displayName: string,
30
- pricingOverride?: Partial<ModelPricing>
31
- ): ModelCatalogEntry {
32
- const base =
33
- (OpenAiTextPricing as Record<string, Partial<ModelPricing>>)[id] ||
34
- (AnthropicTextPricing as Record<string, Partial<ModelPricing>>)[id] ||
35
- (GeminiPricing as Record<string, Partial<ModelPricing>>)[id] ||
36
- (XaiTextPricing as Record<string, Partial<ModelPricing>>)[id] ||
37
- {};
38
- return {
39
- id,
40
- provider,
41
- type: "completion",
42
- displayName,
43
- pricing: {
44
- input: 0,
45
- output: 0,
46
- ...base,
47
- ...pricingOverride,
48
- },
49
- };
50
- }
51
-
52
- function embedding(
53
- id: string,
54
- provider: string,
55
- displayName: string,
56
- input: number
57
- ): ModelCatalogEntry {
58
- return {
59
- id,
60
- provider,
61
- type: "embedding",
62
- displayName,
63
- pricing: { input, output: 0 },
64
- };
65
- }
66
-
67
- function image(
68
- id: string,
69
- provider: string,
70
- displayName: string,
71
- pricing: Partial<ModelPricing>
72
- ): ModelCatalogEntry {
73
- return {
74
- id,
75
- provider,
76
- type: "image",
77
- displayName,
78
- pricing: { input: 0, output: 0, ...pricing },
79
- };
80
- }
81
-
82
- function video(
83
- id: string,
84
- provider: string,
85
- displayName: string,
86
- video_generation: number
87
- ): ModelCatalogEntry {
88
- return {
89
- id,
90
- provider,
91
- type: "video",
92
- displayName,
93
- pricing: { input: 0, output: 0, video_generation },
94
- };
95
- }
96
-
97
- function audio(
98
- id: string,
99
- provider: string,
100
- displayName: string,
101
- pricing: Partial<ModelPricing>
102
- ): ModelCatalogEntry {
103
- return {
104
- id,
105
- provider,
106
- type: "audio",
107
- displayName,
108
- pricing: { input: 0, output: 0, ...pricing },
109
- };
110
- }
111
-
112
- function transaction(
113
- id: string,
114
- provider: string,
115
- displayName: string,
116
- pricing: Partial<ModelPricing>
117
- ): ModelCatalogEntry {
118
- return {
119
- id,
120
- provider,
121
- type: "transaction",
122
- displayName,
123
- pricing: { input: 0, output: 0, ...pricing },
124
- };
125
- }
126
-
127
- // ─── OpenAI ───────────────────────────────────────────────────────────────────
128
-
129
- export const OPENAI_MODEL_CATALOG: ModelCatalogEntry[] = [
130
- // Completion
131
- completion(Models.openai.GPT_4o, "openai", "GPT-4o"),
132
- completion(Models.openai.GPT_4o_Mini, "openai", "GPT-4o Mini"),
133
- completion(Models.openai.GPT_41, "openai", "GPT-4.1"),
134
- completion(Models.openai.GPT_41_Mini, "openai", "GPT-4.1 Mini"),
135
- completion(Models.openai.GPT_41_Nano, "openai", "GPT-4.1 Nano"),
136
- completion(Models.openai.GPT_45, "openai", "GPT-4.5 Preview"),
137
- completion(Models.openai.o1, "openai", "o1"),
138
- completion(Models.openai.o1_Mini, "openai", "o1 Mini"),
139
- completion(Models.openai.o3, "openai", "o3"),
140
- completion(Models.openai.o3_Mini, "openai", "o3 Mini"),
141
- completion(Models.openai.o4_Mini, "openai", "o4 Mini"),
142
- // Embedding
143
- embedding(EmbeddingModels.openai.EmbeddingAda2, "openai", "Embedding Ada 002", OpenAiTextPricing[EmbeddingModels.openai.EmbeddingAda2]?.input ?? 0.1),
144
- embedding(EmbeddingModels.openai.EmbeddingLarge3, "openai", "Embedding 3 Large", OpenAiTextPricing[EmbeddingModels.openai.EmbeddingLarge3]?.input ?? 0.13),
145
- embedding(EmbeddingModels.openai.EmbeddingSmall3, "openai", "Embedding 3 Small", OpenAiTextPricing[EmbeddingModels.openai.EmbeddingSmall3]?.input ?? 0.02),
146
- // Image generation
147
- image(Models.openai.DALL_E_3, "openai", "DALL-E 3", { image_generation: 0.04 }),
148
- image(Models.openai.DALL_E_2, "openai", "DALL-E 2", { image_generation: 0.02 }),
149
- image(Models.openai.GPT_Image_15, "openai", "GPT Image 1.5", { input: OpenAiTextPricing[Models.openai.GPT_Image_15]?.input ?? 5.0, output: OpenAiTextPricing[Models.openai.GPT_Image_15]?.output ?? 10.0 }),
150
- image(Models.openai.GPT_Image_1_Mini, "openai", "GPT Image 1 Mini", { input: OpenAiTextPricing[Models.openai.GPT_Image_1_Mini]?.input ?? 2.0 }),
151
- // Video generation
152
- video(Models.openai.Sora, "openai", "Sora", 0.012),
153
- video(Models.openai.Sora_2, "openai", "Sora 2", 0.015),
154
- // Audio
155
- audio(Models.openai.TTS_1, "openai", "TTS-1", { input: 15.0 }),
156
- audio(Models.openai.Whisper_1, "openai", "Whisper 1", { input: 0.006 }),
157
- // Transaction / Search
158
- transaction(Models.openai.GPT_4o_Mini_Search, "openai", "GPT-4o Mini Search", { input: OpenAiTextPricing[Models.openai.GPT_4o_Mini_Search]?.input ?? 0.15, output: OpenAiTextPricing[Models.openai.GPT_4o_Mini_Search]?.output ?? 0.6 }),
159
- transaction(Models.openai.GPT_4o_Search, "openai", "GPT-4o Search", { input: OpenAiTextPricing[Models.openai.GPT_4o_Search]?.input ?? 2.5, output: OpenAiTextPricing[Models.openai.GPT_4o_Search]?.output ?? 10.0 }),
160
- ];
161
-
162
- // ─── Anthropic ────────────────────────────────────────────────────────────────
163
-
164
- export const ANTHROPIC_MODEL_CATALOG: ModelCatalogEntry[] = [
165
- completion(Models.anthropic.Opus4_5, "anthropic", "Claude Opus 4.5"),
166
- completion(Models.anthropic.Sonnet4_5, "anthropic", "Claude Sonnet 4.5"),
167
- completion(Models.anthropic.Opus4, "anthropic", "Claude Opus 4"),
168
- completion(Models.anthropic.Sonnet4, "anthropic", "Claude Sonnet 4"),
169
- completion(Models.anthropic.Haiku4_5, "anthropic", "Claude Haiku 4.5"),
170
- completion(Models.anthropic.Sonnet3_7, "anthropic", "Claude Sonnet 3.7"),
171
- completion(Models.anthropic.Sonnet3_5, "anthropic", "Claude Sonnet 3.5"),
172
- completion(Models.anthropic.Haiku3, "anthropic", "Claude Haiku 3"),
173
- completion(Models.anthropic.Opus3, "anthropic", "Claude Opus 3"),
174
- ];
175
-
176
- // ─── Google ───────────────────────────────────────────────────────────────────
177
-
178
- export const GOOGLE_MODEL_CATALOG: ModelCatalogEntry[] = [
179
- // Completion
180
- completion(Models.google.Gemini_25_Pro, "google", "Gemini 2.5 Pro"),
181
- completion(Models.google.Gemini_25_Flash, "google", "Gemini 2.5 Flash"),
182
- completion(Models.google.Gemini_25_Flash_Lite, "google", "Gemini 2.5 Flash Lite"),
183
- completion(Models.google.Gemini_20_Flash, "google", "Gemini 2.0 Flash"),
184
- completion(Models.google.Gemini_15_Pro, "google", "Gemini 1.5 Pro"),
185
- completion(Models.google.Gemini_15_Flash, "google", "Gemini 1.5 Flash"),
186
- completion(Models.google.Gemini_15_Flash_8B, "google", "Gemini 1.5 Flash 8B"),
187
- // Embedding
188
- embedding(EmbeddingModels.google.Gemini_Embedding, "google", "Gemini Embedding", GeminiPricing[EmbeddingModels.google.Gemini_Embedding]?.input ?? 0),
189
- // Image generation
190
- image(Models.google.Gemini_20_Flash_Preview_Image_Generation, "google", "Gemini 2.0 Flash Image", {
191
- input: GeminiPricing[Models.google.Gemini_20_Flash_Preview_Image_Generation]?.input ?? 0.1,
192
- output: GeminiPricing[Models.google.Gemini_20_Flash_Preview_Image_Generation]?.output ?? 0.4,
193
- image_generation: GeminiPricing[Models.google.Gemini_20_Flash_Preview_Image_Generation]?.image_generation ?? 0.039,
194
- }),
195
- image(Models.google.Gemini_25_Flash_Image, "google", "Gemini 2.5 Flash Image", {
196
- input: GeminiPricing[Models.google.Gemini_25_Flash_Image]?.input ?? 0.3,
197
- output: GeminiPricing[Models.google.Gemini_25_Flash_Image]?.output ?? 0.039,
198
- image_generation: GeminiPricing[Models.google.Gemini_25_Flash_Image]?.image_generation ?? 0.039,
199
- }),
200
- image(Models.google.Gemini_31_Flash_Image_Preview, "google", "Gemini 3.1 Flash Image", {
201
- input: GeminiPricing[Models.google.Gemini_31_Flash_Image_Preview]?.input ?? 0.5,
202
- output: GeminiPricing[Models.google.Gemini_31_Flash_Image_Preview]?.output ?? 3.0,
203
- image_generation: GeminiPricing[Models.google.Gemini_31_Flash_Image_Preview]?.image_generation ?? 0.045,
204
- }),
205
- image(Models.google.Gemini_3_Pro_Image_Preview, "google", "Gemini 3 Pro Image", {
206
- input: GeminiPricing[Models.google.Gemini_3_Pro_Image_Preview]?.input ?? 2.0,
207
- output: GeminiPricing[Models.google.Gemini_3_Pro_Image_Preview]?.output ?? 12.0,
208
- image_generation: GeminiPricing[Models.google.Gemini_3_Pro_Image_Preview]?.image_generation ?? 0.134,
209
- }),
210
- image(Models.google.Imagen_3, "google", "Imagen 4", { image_generation: GeminiPricing[Models.google.Imagen_3]?.image_generation ?? 0.04 }),
211
- image(Models.google.Imagen_4_Fast, "google", "Imagen 4 Fast", { image_generation: GeminiPricing[Models.google.Imagen_4_Fast]?.image_generation ?? 0.02 }),
212
- image(Models.google.Imagen_4_Ultra, "google", "Imagen 4 Ultra", { image_generation: GeminiPricing[Models.google.Imagen_4_Ultra]?.image_generation ?? 0.06 }),
213
- // Video generation
214
- video(Models.google.Veo_2, "google", "Veo 2", GeminiPricing[Models.google.Veo_2]?.video_generation ?? 0.35),
215
- video(Models.google.Veo_3, "google", "Veo 3", GeminiPricing[Models.google.Veo_3]?.video_generation ?? 0.4),
216
- video(Models.google.Veo_3_Fast, "google", "Veo 3 Fast", GeminiPricing[Models.google.Veo_3_Fast]?.video_generation ?? 0.1),
217
- // Audio (TTS)
218
- audio(Models.google.Gemini_25_Flash_TTS, "google", "Gemini 2.5 Flash TTS", {
219
- input: GeminiPricing[Models.google.Gemini_25_Flash_TTS]?.input ?? 0.5,
220
- output_audio: GeminiPricing[Models.google.Gemini_25_Flash_TTS]?.output_audio ?? 10.0,
221
- output: GeminiPricing[Models.google.Gemini_25_Flash_TTS]?.output_audio ?? 10.0,
222
- }),
223
- audio(Models.google.Gemini_25_Pro_TTS, "google", "Gemini 2.5 Pro TTS", {
224
- input: GeminiPricing[Models.google.Gemini_25_Pro_TTS]?.input ?? 1.0,
225
- output_audio: GeminiPricing[Models.google.Gemini_25_Pro_TTS]?.output_audio ?? 20.0,
226
- output: GeminiPricing[Models.google.Gemini_25_Pro_TTS]?.output_audio ?? 20.0,
227
- }),
228
- ];
229
-
230
- // ─── xAI ──────────────────────────────────────────────────────────────────────
231
-
232
- export const XAI_MODEL_CATALOG: ModelCatalogEntry[] = [
233
- completion(Models.xai.Grok4, "xai", "Grok 4"),
234
- completion(Models.xai.Grok3Beta, "xai", "Grok 3 Beta"),
235
- completion(Models.xai.Grok3MiniBeta, "xai", "Grok 3 Mini Beta"),
236
- completion(Models.xai.Grok3FastBeta, "xai", "Grok 3 Fast Beta"),
237
- completion(Models.xai.Grok21212, "xai", "Grok 2"),
238
- // Image generation
239
- image(Models.xai.GrokImagineImage, "xai", "Grok Imagine Image", { image_generation: XaiImagePricing["grok-imagine-image"]?.image_generation ?? 0.02 }),
240
- image("grok-2-image-1212", "xai", "Grok 2 Image", { image_generation: XaiImagePricing["grok-2-image-1212"]?.image_generation ?? 0.07 }),
241
- // Video generation
242
- video(Models.xai.GrokImagineVideo, "xai", "Grok Imagine Video", XaiVideoPricing["grok-imagine-video"]?.video_generation ?? 0.05),
243
- ];
244
-
245
- // ─── Combined catalog ─────────────────────────────────────────────────────────
16
+ export { OPENAI_MODEL_CATALOG, ANTHROPIC_MODEL_CATALOG, GOOGLE_MODEL_CATALOG, XAI_MODEL_CATALOG };
246
17
 
247
18
  export const ALL_MODEL_CATALOG: ModelCatalogEntry[] = [
248
19
  ...OPENAI_MODEL_CATALOG,
@@ -0,0 +1,102 @@
1
+ /**
2
+ * NVIDIA NIM pricing (USD per 1M tokens)
3
+ * Source: https://build.nvidia.com/explore/discover
4
+ * Many models are free (marked $0). Paid models use credit-based pricing.
5
+ */
6
+ export const NvidiaTextPricing: Record<string, { input: number; output: number }> = {
7
+ // Free models
8
+ "meta/llama-3.1-8b-instruct": { input: 0.0, output: 0.0 },
9
+ "meta/llama-3.1-70b-instruct": { input: 0.0, output: 0.0 },
10
+ "meta/llama-3.1-405b-instruct": { input: 0.0, output: 0.0 },
11
+ "meta/llama-3.3-70b-instruct": { input: 0.0, output: 0.0 },
12
+ "meta/llama-4-scout-17b-16e-instruct": { input: 0.0, output: 0.0 },
13
+ "meta/llama-4-maverick-17b-128e-instruct": { input: 0.0, output: 0.0 },
14
+ "mistralai/mistral-7b-instruct-v0.3": { input: 0.0, output: 0.0 },
15
+ "mistralai/mixtral-8x7b-instruct-v0.1": { input: 0.0, output: 0.0 },
16
+ "mistralai/codestral-22b-instruct-v0.1": { input: 0.0, output: 0.0 },
17
+ "microsoft/phi-4-mini-instruct": { input: 0.0, output: 0.0 },
18
+ "microsoft/phi-4-multimodal-instruct": { input: 0.0, output: 0.0 },
19
+ "microsoft/phi-3-medium-128k-instruct": { input: 0.0, output: 0.0 },
20
+ "microsoft/phi-3-medium-4k-instruct": { input: 0.0, output: 0.0 },
21
+ "microsoft/phi-3-small-128k-instruct": { input: 0.0, output: 0.0 },
22
+ "microsoft/phi-3-small-8k-instruct": { input: 0.0, output: 0.0 },
23
+ "microsoft/phi-3-vision-128k-instruct": { input: 0.0, output: 0.0 },
24
+ "microsoft/phi-3.5-moe-instruct": { input: 0.0, output: 0.0 },
25
+ "microsoft/phi-3.5-vision-instruct": { input: 0.0, output: 0.0 },
26
+ "qwen/qwen2.5-7b-instruct": { input: 0.0, output: 0.0 },
27
+ "qwen/qwen2.5-72b-instruct": { input: 0.0, output: 0.0 },
28
+ "qwen/qwen2.5-coder-32b-instruct": { input: 0.0, output: 0.0 },
29
+ "qwen/qwen2.5-coder-7b-instruct": { input: 0.0, output: 0.0 },
30
+ "qwen/qwen3-235b-a22b": { input: 0.0, output: 0.0 },
31
+ "qwen/qwen3-coder-480b-a35b-instruct": { input: 0.0, output: 0.0 },
32
+ "qwen/qwen3-next-80b-a3b-instruct": { input: 0.0, output: 0.0 },
33
+ "qwen/qwen3-next-80b-a3b-thinking": { input: 0.0, output: 0.0 },
34
+ "qwen/qwen3.5-397b-a17b": { input: 0.0, output: 0.0 },
35
+ "qwen/qwq-32b": { input: 0.0, output: 0.0 },
36
+ "deepseek-ai/deepseek-r1": { input: 0.0, output: 0.0 },
37
+ "deepseek-ai/deepseek-r1-0528": { input: 0.0, output: 0.0 },
38
+ "deepseek-ai/deepseek-coder-6.7b-instruct": { input: 0.0, output: 0.0 },
39
+ "deepseek-ai/deepseek-v3.1": { input: 0.0, output: 0.0 },
40
+ "deepseek-ai/deepseek-v4-flash": { input: 0.14, output: 0.28 },
41
+ "deepseek-ai/deepseek-v3.1-terminus": { input: 0.0, output: 0.0 },
42
+ "deepseek-ai/deepseek-v3.2": { input: 0.0, output: 0.0 },
43
+ "nvidia/llama-3.1-nemotron-70b-instruct": { input: 0.0, output: 0.0 },
44
+ "nvidia/llama-3.1-nemotron-51b-instruct": { input: 0.0, output: 0.0 },
45
+ "nvidia/llama-3.1-nemotron-ultra-253b-v1": { input: 0.0, output: 0.0 },
46
+ "nvidia/llama-3.3-nemotron-super-49b-v1": { input: 0.0, output: 0.0 },
47
+ "nvidia/llama-3.3-nemotron-super-49b-v1.5": { input: 0.0, output: 0.0 },
48
+ "nvidia/llama-embed-nemotron-8b": { input: 0.0, output: 0.0 },
49
+ "nvidia/llama3-chatqa-1.5-70b": { input: 0.0, output: 0.0 },
50
+ "nvidia/cosmos-nemotron-34b": { input: 0.0, output: 0.0 },
51
+ "nvidia/nemoretriever-ocr-v1": { input: 0.0, output: 0.0 },
52
+ "nvidia/nemotron-3-nano-30b-a3b": { input: 0.0, output: 0.0 },
53
+ "nvidia/nvidia-nemotron-nano-9b-v2": { input: 0.0, output: 0.0 },
54
+ "nvidia/parakeet-tdt-0.6b-v2": { input: 0.0, output: 0.0 },
55
+ "google/gemma-3-27b-it": { input: 0.0, output: 0.0 },
56
+ "google/gemma-3-12b-it": { input: 0.0, output: 0.0 },
57
+ "google/gemma-3-4b-it": { input: 0.0, output: 0.0 },
58
+ "google/gemma-3-1b-it": { input: 0.0, output: 0.0 },
59
+ "google/gemma-3n-e2b-it": { input: 0.0, output: 0.0 },
60
+ "google/gemma-3n-e4b-it": { input: 0.0, output: 0.0 },
61
+ "google/gemma-4-31b-it": { input: 0.0, output: 0.0 },
62
+ "google/gemma-2-27b-it": { input: 0.0, output: 0.0 },
63
+ "google/gemma-2-2b-it": { input: 0.0, output: 0.0 },
64
+ "google/codegemma-1.1-7b": { input: 0.0, output: 0.0 },
65
+ "google/codegemma-7b": { input: 0.0, output: 0.0 },
66
+ "meta/llama-3.2-11b-vision-instruct": { input: 0.0, output: 0.0 },
67
+ "meta/llama-3.2-1b-instruct": { input: 0.0, output: 0.0 },
68
+ "meta/llama3-70b-instruct": { input: 0.0, output: 0.0 },
69
+ "meta/llama3-8b-instruct": { input: 0.0, output: 0.0 },
70
+ "meta/codellama-70b": { input: 0.0, output: 0.0 },
71
+ "mistralai/mistral-large-2-instruct": { input: 0.0, output: 0.0 },
72
+ "mistralai/mistral-large-3-675b-instruct-2512": { input: 0.0, output: 0.0 },
73
+ "mistralai/mistral-small-3.1-24b-instruct-2503": { input: 0.0, output: 0.0 },
74
+ "mistralai/ministral-14b-instruct-2512": { input: 0.0, output: 0.0 },
75
+ "mistralai/mamba-codestral-7b-v0.1": { input: 0.0, output: 0.0 },
76
+ "mistralai/devstral-2-123b-instruct-2512": { input: 0.0, output: 0.0 },
77
+ "minimaxai/minimax-m2.1": { input: 0.0, output: 0.0 },
78
+ "minimaxai/minimax-m2.5": { input: 0.0, output: 0.0 },
79
+ "minimaxai/minimax-m2.7": { input: 0.0, output: 0.0 },
80
+ "moonshotai/kimi-k2-instruct": { input: 0.0, output: 0.0 },
81
+ "moonshotai/kimi-k2-instruct-0905": { input: 0.0, output: 0.0 },
82
+ "moonshotai/kimi-k2-thinking": { input: 0.0, output: 0.0 },
83
+ "moonshotai/kimi-k2.5": { input: 0.0, output: 0.0 },
84
+ "openai/gpt-oss-120b": { input: 0.0, output: 0.0 },
85
+ "openai/whisper-large-v3": { input: 0.0, output: 0.0 },
86
+ "stepfun-ai/step-3.5-flash": { input: 0.0, output: 0.0 },
87
+ "z-ai/glm-5.1": { input: 0.0, output: 0.0 },
88
+ "z-ai/glm4.7": { input: 0.0, output: 0.0 },
89
+ "z-ai/glm5": { input: 0.0, output: 0.0 },
90
+ // Nemotron 4 340B — free on NVIDIA NIM platform
91
+ // Source: models.dev (cost: $0), build.nvidia.com (free sign-up, no credit card)
92
+ "nvidia/nemotron-4-340b-instruct": { input: 0.0, output: 0.0 },
93
+ // Paid models
94
+ "deepseek-ai/deepseek-v4-pro": { input: 1.74, output: 3.48 },
95
+ "nvidia/nemotron-3-super-120b-a12b": { input: 0.2, output: 0.8 },
96
+ };
97
+
98
+ export const NvidiaImagePricing: Record<string, { input: number; output: number }> = {
99
+ "black-forest-labs/flux.1-dev": { input: 0.0, output: 0.0 },
100
+ "black-forest-labs/flux.1-schnell": { input: 0.0, output: 0.0 },
101
+ "stabilityai/stable-diffusion-3.5-medium": { input: 0.0, output: 0.0 },
102
+ };