@funkai/models 0.1.0
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/.generated/entries.json +23 -0
- package/.generated/req.txt +1 -0
- package/.turbo/turbo-build.log +145 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +23 -0
- package/README.md +95 -0
- package/dist/alibaba-B6q4Ng1R.mjs +957 -0
- package/dist/alibaba-B6q4Ng1R.mjs.map +1 -0
- package/dist/amazon-bedrock-Cv9AHQBH.mjs +2070 -0
- package/dist/amazon-bedrock-Cv9AHQBH.mjs.map +1 -0
- package/dist/anthropic-yB7ST97_.mjs +651 -0
- package/dist/anthropic-yB7ST97_.mjs.map +1 -0
- package/dist/cerebras-COfl7XM-.mjs +95 -0
- package/dist/cerebras-COfl7XM-.mjs.map +1 -0
- package/dist/cohere-B7TgO0hT.mjs +271 -0
- package/dist/cohere-B7TgO0hT.mjs.map +1 -0
- package/dist/deepinfra-B0GxUwCG.mjs +636 -0
- package/dist/deepinfra-B0GxUwCG.mjs.map +1 -0
- package/dist/deepseek-D64ZEsvS.mjs +50 -0
- package/dist/deepseek-D64ZEsvS.mjs.map +1 -0
- package/dist/fireworks-ai-DJYvdAi_.mjs +304 -0
- package/dist/fireworks-ai-DJYvdAi_.mjs.map +1 -0
- package/dist/google-BypRl349.mjs +833 -0
- package/dist/google-BypRl349.mjs.map +1 -0
- package/dist/google-vertex-DbS-zTGD.mjs +730 -0
- package/dist/google-vertex-DbS-zTGD.mjs.map +1 -0
- package/dist/groq-ei_PerYi.mjs +381 -0
- package/dist/groq-ei_PerYi.mjs.map +1 -0
- package/dist/huggingface-DaM1EeLP.mjs +456 -0
- package/dist/huggingface-DaM1EeLP.mjs.map +1 -0
- package/dist/inception-CspEzqNV.mjs +101 -0
- package/dist/inception-CspEzqNV.mjs.map +1 -0
- package/dist/index.d.mts +30314 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +271 -0
- package/dist/index.mjs.map +1 -0
- package/dist/llama-Cf3-koap.mjs +161 -0
- package/dist/llama-Cf3-koap.mjs.map +1 -0
- package/dist/mistral-BI9MdAO4.mjs +579 -0
- package/dist/mistral-BI9MdAO4.mjs.map +1 -0
- package/dist/nvidia-COHacuoa.mjs +1625 -0
- package/dist/nvidia-COHacuoa.mjs.map +1 -0
- package/dist/openai-C0nCfZUq.mjs +1023 -0
- package/dist/openai-C0nCfZUq.mjs.map +1 -0
- package/dist/openrouter-DSFzxKQb.mjs +4608 -0
- package/dist/openrouter-DSFzxKQb.mjs.map +1 -0
- package/dist/perplexity-zeZ2WlBU.mjs +96 -0
- package/dist/perplexity-zeZ2WlBU.mjs.map +1 -0
- package/dist/providers/alibaba.d.mts +1795 -0
- package/dist/providers/alibaba.d.mts.map +1 -0
- package/dist/providers/alibaba.mjs +39 -0
- package/dist/providers/alibaba.mjs.map +1 -0
- package/dist/providers/amazon-bedrock.d.mts +3713 -0
- package/dist/providers/amazon-bedrock.d.mts.map +1 -0
- package/dist/providers/amazon-bedrock.mjs +39 -0
- package/dist/providers/amazon-bedrock.mjs.map +1 -0
- package/dist/providers/anthropic.d.mts +1109 -0
- package/dist/providers/anthropic.d.mts.map +1 -0
- package/dist/providers/anthropic.mjs +39 -0
- package/dist/providers/anthropic.mjs.map +1 -0
- package/dist/providers/cerebras.d.mts +219 -0
- package/dist/providers/cerebras.d.mts.map +1 -0
- package/dist/providers/cerebras.mjs +39 -0
- package/dist/providers/cerebras.mjs.map +1 -0
- package/dist/providers/cohere.d.mts +555 -0
- package/dist/providers/cohere.d.mts.map +1 -0
- package/dist/providers/cohere.mjs +39 -0
- package/dist/providers/cohere.mjs.map +1 -0
- package/dist/providers/deepinfra.d.mts +1245 -0
- package/dist/providers/deepinfra.d.mts.map +1 -0
- package/dist/providers/deepinfra.mjs +39 -0
- package/dist/providers/deepinfra.mjs.map +1 -0
- package/dist/providers/deepseek.d.mts +139 -0
- package/dist/providers/deepseek.d.mts.map +1 -0
- package/dist/providers/deepseek.mjs +39 -0
- package/dist/providers/deepseek.mjs.map +1 -0
- package/dist/providers/fireworks-ai.d.mts +611 -0
- package/dist/providers/fireworks-ai.d.mts.map +1 -0
- package/dist/providers/fireworks-ai.mjs +39 -0
- package/dist/providers/fireworks-ai.mjs.map +1 -0
- package/dist/providers/google-vertex.d.mts +1227 -0
- package/dist/providers/google-vertex.d.mts.map +1 -0
- package/dist/providers/google-vertex.mjs +39 -0
- package/dist/providers/google-vertex.mjs.map +1 -0
- package/dist/providers/google.d.mts +1359 -0
- package/dist/providers/google.d.mts.map +1 -0
- package/dist/providers/google.mjs +39 -0
- package/dist/providers/google.mjs.map +1 -0
- package/dist/providers/groq.d.mts +765 -0
- package/dist/providers/groq.d.mts.map +1 -0
- package/dist/providers/groq.mjs +39 -0
- package/dist/providers/groq.mjs.map +1 -0
- package/dist/providers/huggingface.d.mts +901 -0
- package/dist/providers/huggingface.d.mts.map +1 -0
- package/dist/providers/huggingface.mjs +39 -0
- package/dist/providers/huggingface.mjs.map +1 -0
- package/dist/providers/inception.d.mts +231 -0
- package/dist/providers/inception.d.mts.map +1 -0
- package/dist/providers/inception.mjs +39 -0
- package/dist/providers/inception.mjs.map +1 -0
- package/dist/providers/llama.d.mts +345 -0
- package/dist/providers/llama.d.mts.map +1 -0
- package/dist/providers/llama.mjs +39 -0
- package/dist/providers/llama.mjs.map +1 -0
- package/dist/providers/mistral.d.mts +1143 -0
- package/dist/providers/mistral.d.mts.map +1 -0
- package/dist/providers/mistral.mjs +39 -0
- package/dist/providers/mistral.mjs.map +1 -0
- package/dist/providers/nvidia.d.mts +3117 -0
- package/dist/providers/nvidia.d.mts.map +1 -0
- package/dist/providers/nvidia.mjs +39 -0
- package/dist/providers/nvidia.mjs.map +1 -0
- package/dist/providers/openai.d.mts +1963 -0
- package/dist/providers/openai.d.mts.map +1 -0
- package/dist/providers/openai.mjs +39 -0
- package/dist/providers/openai.mjs.map +1 -0
- package/dist/providers/openrouter.d.mts +8531 -0
- package/dist/providers/openrouter.d.mts.map +1 -0
- package/dist/providers/openrouter.mjs +39 -0
- package/dist/providers/openrouter.mjs.map +1 -0
- package/dist/providers/perplexity.d.mts +221 -0
- package/dist/providers/perplexity.d.mts.map +1 -0
- package/dist/providers/perplexity.mjs +39 -0
- package/dist/providers/perplexity.mjs.map +1 -0
- package/dist/providers/togetherai.d.mts +767 -0
- package/dist/providers/togetherai.d.mts.map +1 -0
- package/dist/providers/togetherai.mjs +39 -0
- package/dist/providers/togetherai.mjs.map +1 -0
- package/dist/providers/xai.d.mts +1161 -0
- package/dist/providers/xai.d.mts.map +1 -0
- package/dist/providers/xai.mjs +39 -0
- package/dist/providers/xai.mjs.map +1 -0
- package/dist/togetherai-BvcxUfPE.mjs +382 -0
- package/dist/togetherai-BvcxUfPE.mjs.map +1 -0
- package/dist/types-DjdaZckF.d.mts +71 -0
- package/dist/types-DjdaZckF.d.mts.map +1 -0
- package/dist/xai-fSuAkQJo.mjs +587 -0
- package/dist/xai-fSuAkQJo.mjs.map +1 -0
- package/docs/catalog/filtering.md +102 -0
- package/docs/catalog/overview.md +168 -0
- package/docs/catalog/providers.md +73 -0
- package/docs/cost/overview.md +125 -0
- package/docs/guides/filter-models.md +113 -0
- package/docs/guides/setup-resolver.md +106 -0
- package/docs/guides/track-costs.md +133 -0
- package/docs/overview.md +139 -0
- package/docs/provider/configuration.md +100 -0
- package/docs/provider/openrouter.md +105 -0
- package/docs/provider/overview.md +131 -0
- package/docs/troubleshooting.md +100 -0
- package/package.json +142 -0
- package/providers.json +39 -0
- package/scripts/generate-models.ts +392 -0
- package/src/catalog/index.test.ts +124 -0
- package/src/catalog/index.ts +65 -0
- package/src/catalog/providers/alibaba.ts +468 -0
- package/src/catalog/providers/amazon-bedrock.ts +941 -0
- package/src/catalog/providers/anthropic.ts +270 -0
- package/src/catalog/providers/cerebras.ts +61 -0
- package/src/catalog/providers/cohere.ts +149 -0
- package/src/catalog/providers/deepinfra.ts +325 -0
- package/src/catalog/providers/deepseek.ts +39 -0
- package/src/catalog/providers/fireworks-ai.ts +160 -0
- package/src/catalog/providers/google-vertex.ts +314 -0
- package/src/catalog/providers/google.ts +347 -0
- package/src/catalog/providers/groq.ts +204 -0
- package/src/catalog/providers/huggingface.ts +237 -0
- package/src/catalog/providers/inception.ts +61 -0
- package/src/catalog/providers/index.ts +59 -0
- package/src/catalog/providers/llama.ts +94 -0
- package/src/catalog/providers/mistral.ts +303 -0
- package/src/catalog/providers/nvidia.ts +820 -0
- package/src/catalog/providers/openai.ts +501 -0
- package/src/catalog/providers/openrouter.ts +2201 -0
- package/src/catalog/providers/perplexity.ts +61 -0
- package/src/catalog/providers/togetherai.ts +204 -0
- package/src/catalog/providers/xai.ts +292 -0
- package/src/catalog/types.ts +86 -0
- package/src/cost/calculate.test.ts +157 -0
- package/src/cost/calculate.ts +43 -0
- package/src/cost/index.ts +2 -0
- package/src/cost/types.ts +25 -0
- package/src/index.ts +25 -0
- package/src/provider/index.ts +9 -0
- package/src/provider/openrouter.test.ts +125 -0
- package/src/provider/openrouter.ts +110 -0
- package/src/provider/resolver.test.ts +138 -0
- package/src/provider/resolver.ts +125 -0
- package/src/provider/types.ts +39 -0
- package/src/providers/alibaba.ts +65 -0
- package/src/providers/amazon-bedrock.ts +67 -0
- package/src/providers/anthropic.ts +65 -0
- package/src/providers/cerebras.ts +65 -0
- package/src/providers/cohere.ts +65 -0
- package/src/providers/deepinfra.ts +65 -0
- package/src/providers/deepseek.ts +65 -0
- package/src/providers/fireworks-ai.ts +65 -0
- package/src/providers/google-vertex.ts +67 -0
- package/src/providers/google.ts +65 -0
- package/src/providers/groq.ts +65 -0
- package/src/providers/huggingface.ts +67 -0
- package/src/providers/inception.ts +65 -0
- package/src/providers/llama.ts +65 -0
- package/src/providers/mistral.ts +65 -0
- package/src/providers/nvidia.ts +65 -0
- package/src/providers/openai.ts +65 -0
- package/src/providers/openrouter.ts +67 -0
- package/src/providers/perplexity.ts +67 -0
- package/src/providers/togetherai.ts +65 -0
- package/src/providers/xai.ts +65 -0
- package/tsconfig.json +25 -0
- package/tsdown.config.ts +23 -0
- package/vitest.config.ts +29 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// ──────────────────────────────────────────────────────────────
|
|
2
|
+
// ███████╗██╗ ██╗███╗ ██╗██╗ ██╗ █████╗ ██╗
|
|
3
|
+
// ██╔════╝██║ ██║████╗ ██║██║ ██╔╝██╔══██╗██║
|
|
4
|
+
// █████╗ ██║ ██║██╔██╗ ██║█████╔╝ ███████║██║
|
|
5
|
+
// ██╔══╝ ██║ ██║██║╚██╗██║██╔═██╗ ██╔══██║██║
|
|
6
|
+
// ██║ ╚██████╔╝██║ ╚████║██║ ██╗██║ ██║██║
|
|
7
|
+
// ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
|
|
8
|
+
//
|
|
9
|
+
// AUTO-GENERATED — DO NOT EDIT
|
|
10
|
+
// Source: https://models.dev
|
|
11
|
+
// Update: pnpm --filter=@funkai/models generate:models
|
|
12
|
+
// ──────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
import type { LiteralUnion } from "type-fest";
|
|
15
|
+
|
|
16
|
+
import { FIREWORKS_AI_MODELS } from "../catalog/providers/fireworks-ai.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for Fireworks AI.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { FireworksModelId } from '@funkai/models/fireworks-ai'
|
|
25
|
+
*
|
|
26
|
+
* const id: FireworksModelId = 'accounts/fireworks/models/kimi-k2-instruct'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type FireworksModelId = (typeof FIREWORKS_AI_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All Fireworks AI models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { fireworksModels } from '@funkai/models/fireworks-ai'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of fireworksModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const fireworksModels = FIREWORKS_AI_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(FIREWORKS_AI_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up a Fireworks AI model by ID.
|
|
49
|
+
*
|
|
50
|
+
* @param id - The provider-native model identifier.
|
|
51
|
+
* @returns The matching model definition, or `null`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { fireworksModel } from '@funkai/models/fireworks-ai'
|
|
56
|
+
*
|
|
57
|
+
* const m = fireworksModel('accounts/fireworks/models/kimi-k2-instruct')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function fireworksModel(id: LiteralUnion<FireworksModelId, string>): ModelDefinition | null {
|
|
64
|
+
return MODEL_INDEX.get(id) ?? null;
|
|
65
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// ──────────────────────────────────────────────────────────────
|
|
2
|
+
// ███████╗██╗ ██╗███╗ ██╗██╗ ██╗ █████╗ ██╗
|
|
3
|
+
// ██╔════╝██║ ██║████╗ ██║██║ ██╔╝██╔══██╗██║
|
|
4
|
+
// █████╗ ██║ ██║██╔██╗ ██║█████╔╝ ███████║██║
|
|
5
|
+
// ██╔══╝ ██║ ██║██║╚██╗██║██╔═██╗ ██╔══██║██║
|
|
6
|
+
// ██║ ╚██████╔╝██║ ╚████║██║ ██╗██║ ██║██║
|
|
7
|
+
// ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
|
|
8
|
+
//
|
|
9
|
+
// AUTO-GENERATED — DO NOT EDIT
|
|
10
|
+
// Source: https://models.dev
|
|
11
|
+
// Update: pnpm --filter=@funkai/models generate:models
|
|
12
|
+
// ──────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
import type { LiteralUnion } from "type-fest";
|
|
15
|
+
|
|
16
|
+
import { GOOGLE_VERTEX_MODELS } from "../catalog/providers/google-vertex.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for Google Vertex AI.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { GoogleVertexModelId } from '@funkai/models/google-vertex'
|
|
25
|
+
*
|
|
26
|
+
* const id: GoogleVertexModelId = 'gemini-embedding-001'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type GoogleVertexModelId = (typeof GOOGLE_VERTEX_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All Google Vertex AI models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { googleVertexModels } from '@funkai/models/google-vertex'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of googleVertexModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const googleVertexModels = GOOGLE_VERTEX_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(GOOGLE_VERTEX_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up a Google Vertex AI model by ID.
|
|
49
|
+
*
|
|
50
|
+
* @param id - The provider-native model identifier.
|
|
51
|
+
* @returns The matching model definition, or `null`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { googleVertexModel } from '@funkai/models/google-vertex'
|
|
56
|
+
*
|
|
57
|
+
* const m = googleVertexModel('gemini-embedding-001')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function googleVertexModel(
|
|
64
|
+
id: LiteralUnion<GoogleVertexModelId, string>,
|
|
65
|
+
): ModelDefinition | null {
|
|
66
|
+
return MODEL_INDEX.get(id) ?? null;
|
|
67
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// ──────────────────────────────────────────────────────────────
|
|
2
|
+
// ███████╗██╗ ██╗███╗ ██╗██╗ ██╗ █████╗ ██╗
|
|
3
|
+
// ██╔════╝██║ ██║████╗ ██║██║ ██╔╝██╔══██╗██║
|
|
4
|
+
// █████╗ ██║ ██║██╔██╗ ██║█████╔╝ ███████║██║
|
|
5
|
+
// ██╔══╝ ██║ ██║██║╚██╗██║██╔═██╗ ██╔══██║██║
|
|
6
|
+
// ██║ ╚██████╔╝██║ ╚████║██║ ██╗██║ ██║██║
|
|
7
|
+
// ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
|
|
8
|
+
//
|
|
9
|
+
// AUTO-GENERATED — DO NOT EDIT
|
|
10
|
+
// Source: https://models.dev
|
|
11
|
+
// Update: pnpm --filter=@funkai/models generate:models
|
|
12
|
+
// ──────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
import type { LiteralUnion } from "type-fest";
|
|
15
|
+
|
|
16
|
+
import { GOOGLE_MODELS } from "../catalog/providers/google.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for Google.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { GoogleModelId } from '@funkai/models/google'
|
|
25
|
+
*
|
|
26
|
+
* const id: GoogleModelId = 'gemini-embedding-001'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type GoogleModelId = (typeof GOOGLE_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All Google models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { googleModels } from '@funkai/models/google'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of googleModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const googleModels = GOOGLE_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(GOOGLE_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up a Google model by ID.
|
|
49
|
+
*
|
|
50
|
+
* @param id - The provider-native model identifier.
|
|
51
|
+
* @returns The matching model definition, or `null`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { googleModel } from '@funkai/models/google'
|
|
56
|
+
*
|
|
57
|
+
* const m = googleModel('gemini-embedding-001')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function googleModel(id: LiteralUnion<GoogleModelId, string>): ModelDefinition | null {
|
|
64
|
+
return MODEL_INDEX.get(id) ?? null;
|
|
65
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// ──────────────────────────────────────────────────────────────
|
|
2
|
+
// ███████╗██╗ ██╗███╗ ██╗██╗ ██╗ █████╗ ██╗
|
|
3
|
+
// ██╔════╝██║ ██║████╗ ██║██║ ██╔╝██╔══██╗██║
|
|
4
|
+
// █████╗ ██║ ██║██╔██╗ ██║█████╔╝ ███████║██║
|
|
5
|
+
// ██╔══╝ ██║ ██║██║╚██╗██║██╔═██╗ ██╔══██║██║
|
|
6
|
+
// ██║ ╚██████╔╝██║ ╚████║██║ ██╗██║ ██║██║
|
|
7
|
+
// ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
|
|
8
|
+
//
|
|
9
|
+
// AUTO-GENERATED — DO NOT EDIT
|
|
10
|
+
// Source: https://models.dev
|
|
11
|
+
// Update: pnpm --filter=@funkai/models generate:models
|
|
12
|
+
// ──────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
import type { LiteralUnion } from "type-fest";
|
|
15
|
+
|
|
16
|
+
import { GROQ_MODELS } from "../catalog/providers/groq.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for Groq.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { GroqModelId } from '@funkai/models/groq'
|
|
25
|
+
*
|
|
26
|
+
* const id: GroqModelId = 'llama3-70b-8192'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type GroqModelId = (typeof GROQ_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All Groq models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { groqModels } from '@funkai/models/groq'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of groqModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const groqModels = GROQ_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(GROQ_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up a Groq model by ID.
|
|
49
|
+
*
|
|
50
|
+
* @param id - The provider-native model identifier.
|
|
51
|
+
* @returns The matching model definition, or `null`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { groqModel } from '@funkai/models/groq'
|
|
56
|
+
*
|
|
57
|
+
* const m = groqModel('llama3-70b-8192')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function groqModel(id: LiteralUnion<GroqModelId, string>): ModelDefinition | null {
|
|
64
|
+
return MODEL_INDEX.get(id) ?? null;
|
|
65
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// ──────────────────────────────────────────────────────────────
|
|
2
|
+
// ███████╗██╗ ██╗███╗ ██╗██╗ ██╗ █████╗ ██╗
|
|
3
|
+
// ██╔════╝██║ ██║████╗ ██║██║ ██╔╝██╔══██╗██║
|
|
4
|
+
// █████╗ ██║ ██║██╔██╗ ██║█████╔╝ ███████║██║
|
|
5
|
+
// ██╔══╝ ██║ ██║██║╚██╗██║██╔═██╗ ██╔══██║██║
|
|
6
|
+
// ██║ ╚██████╔╝██║ ╚████║██║ ██╗██║ ██║██║
|
|
7
|
+
// ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
|
|
8
|
+
//
|
|
9
|
+
// AUTO-GENERATED — DO NOT EDIT
|
|
10
|
+
// Source: https://models.dev
|
|
11
|
+
// Update: pnpm --filter=@funkai/models generate:models
|
|
12
|
+
// ──────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
import type { LiteralUnion } from "type-fest";
|
|
15
|
+
|
|
16
|
+
import { HUGGINGFACE_MODELS } from "../catalog/providers/huggingface.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for Hugging Face.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { HuggingFaceModelId } from '@funkai/models/huggingface'
|
|
25
|
+
*
|
|
26
|
+
* const id: HuggingFaceModelId = 'zai-org/GLM-4.7-Flash'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type HuggingFaceModelId = (typeof HUGGINGFACE_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All Hugging Face models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { huggingFaceModels } from '@funkai/models/huggingface'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of huggingFaceModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const huggingFaceModels = HUGGINGFACE_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(HUGGINGFACE_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up a Hugging Face model by ID.
|
|
49
|
+
*
|
|
50
|
+
* @param id - The provider-native model identifier.
|
|
51
|
+
* @returns The matching model definition, or `null`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { huggingFaceModel } from '@funkai/models/huggingface'
|
|
56
|
+
*
|
|
57
|
+
* const m = huggingFaceModel('zai-org/GLM-4.7-Flash')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function huggingFaceModel(
|
|
64
|
+
id: LiteralUnion<HuggingFaceModelId, string>,
|
|
65
|
+
): ModelDefinition | null {
|
|
66
|
+
return MODEL_INDEX.get(id) ?? null;
|
|
67
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// ──────────────────────────────────────────────────────────────
|
|
2
|
+
// ███████╗██╗ ██╗███╗ ██╗██╗ ██╗ █████╗ ██╗
|
|
3
|
+
// ██╔════╝██║ ██║████╗ ██║██║ ██╔╝██╔══██╗██║
|
|
4
|
+
// █████╗ ██║ ██║██╔██╗ ██║█████╔╝ ███████║██║
|
|
5
|
+
// ██╔══╝ ██║ ██║██║╚██╗██║██╔═██╗ ██╔══██║██║
|
|
6
|
+
// ██║ ╚██████╔╝██║ ╚████║██║ ██╗██║ ██║██║
|
|
7
|
+
// ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
|
|
8
|
+
//
|
|
9
|
+
// AUTO-GENERATED — DO NOT EDIT
|
|
10
|
+
// Source: https://models.dev
|
|
11
|
+
// Update: pnpm --filter=@funkai/models generate:models
|
|
12
|
+
// ──────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
import type { LiteralUnion } from "type-fest";
|
|
15
|
+
|
|
16
|
+
import { INCEPTION_MODELS } from "../catalog/providers/inception.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for Inception (Mercury).
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { InceptionModelId } from '@funkai/models/inception'
|
|
25
|
+
*
|
|
26
|
+
* const id: InceptionModelId = 'mercury-2'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type InceptionModelId = (typeof INCEPTION_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All Inception (Mercury) models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { inceptionModels } from '@funkai/models/inception'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of inceptionModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const inceptionModels = INCEPTION_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(INCEPTION_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up an Inception (Mercury) model by ID.
|
|
49
|
+
*
|
|
50
|
+
* @param id - The provider-native model identifier.
|
|
51
|
+
* @returns The matching model definition, or `null`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { inceptionModel } from '@funkai/models/inception'
|
|
56
|
+
*
|
|
57
|
+
* const m = inceptionModel('mercury-2')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function inceptionModel(id: LiteralUnion<InceptionModelId, string>): ModelDefinition | null {
|
|
64
|
+
return MODEL_INDEX.get(id) ?? null;
|
|
65
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// ──────────────────────────────────────────────────────────────
|
|
2
|
+
// ███████╗██╗ ██╗███╗ ██╗██╗ ██╗ █████╗ ██╗
|
|
3
|
+
// ██╔════╝██║ ██║████╗ ██║██║ ██╔╝██╔══██╗██║
|
|
4
|
+
// █████╗ ██║ ██║██╔██╗ ██║█████╔╝ ███████║██║
|
|
5
|
+
// ██╔══╝ ██║ ██║██║╚██╗██║██╔═██╗ ██╔══██║██║
|
|
6
|
+
// ██║ ╚██████╔╝██║ ╚████║██║ ██╗██║ ██║██║
|
|
7
|
+
// ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
|
|
8
|
+
//
|
|
9
|
+
// AUTO-GENERATED — DO NOT EDIT
|
|
10
|
+
// Source: https://models.dev
|
|
11
|
+
// Update: pnpm --filter=@funkai/models generate:models
|
|
12
|
+
// ──────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
import type { LiteralUnion } from "type-fest";
|
|
15
|
+
|
|
16
|
+
import { LLAMA_MODELS } from "../catalog/providers/llama.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for Meta Llama.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { LlamaModelId } from '@funkai/models/llama'
|
|
25
|
+
*
|
|
26
|
+
* const id: LlamaModelId = 'cerebras-llama-4-maverick-17b-128e-instruct'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type LlamaModelId = (typeof LLAMA_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All Meta Llama models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { llamaModels } from '@funkai/models/llama'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of llamaModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const llamaModels = LLAMA_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(LLAMA_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up a Meta Llama model by ID.
|
|
49
|
+
*
|
|
50
|
+
* @param id - The provider-native model identifier.
|
|
51
|
+
* @returns The matching model definition, or `null`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { llamaModel } from '@funkai/models/llama'
|
|
56
|
+
*
|
|
57
|
+
* const m = llamaModel('cerebras-llama-4-maverick-17b-128e-instruct')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function llamaModel(id: LiteralUnion<LlamaModelId, string>): ModelDefinition | null {
|
|
64
|
+
return MODEL_INDEX.get(id) ?? null;
|
|
65
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// ──────────────────────────────────────────────────────────────
|
|
2
|
+
// ███████╗██╗ ██╗███╗ ██╗██╗ ██╗ █████╗ ██╗
|
|
3
|
+
// ██╔════╝██║ ██║████╗ ██║██║ ██╔╝██╔══██╗██║
|
|
4
|
+
// █████╗ ██║ ██║██╔██╗ ██║█████╔╝ ███████║██║
|
|
5
|
+
// ██╔══╝ ██║ ██║██║╚██╗██║██╔═██╗ ██╔══██║██║
|
|
6
|
+
// ██║ ╚██████╔╝██║ ╚████║██║ ██╗██║ ██║██║
|
|
7
|
+
// ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
|
|
8
|
+
//
|
|
9
|
+
// AUTO-GENERATED — DO NOT EDIT
|
|
10
|
+
// Source: https://models.dev
|
|
11
|
+
// Update: pnpm --filter=@funkai/models generate:models
|
|
12
|
+
// ──────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
import type { LiteralUnion } from "type-fest";
|
|
15
|
+
|
|
16
|
+
import { MISTRAL_MODELS } from "../catalog/providers/mistral.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for Mistral.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { MistralModelId } from '@funkai/models/mistral'
|
|
25
|
+
*
|
|
26
|
+
* const id: MistralModelId = 'devstral-medium-2507'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type MistralModelId = (typeof MISTRAL_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All Mistral models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { mistralModels } from '@funkai/models/mistral'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of mistralModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const mistralModels = MISTRAL_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(MISTRAL_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up a Mistral model by ID.
|
|
49
|
+
*
|
|
50
|
+
* @param id - The provider-native model identifier.
|
|
51
|
+
* @returns The matching model definition, or `null`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { mistralModel } from '@funkai/models/mistral'
|
|
56
|
+
*
|
|
57
|
+
* const m = mistralModel('devstral-medium-2507')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function mistralModel(id: LiteralUnion<MistralModelId, string>): ModelDefinition | null {
|
|
64
|
+
return MODEL_INDEX.get(id) ?? null;
|
|
65
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// ──────────────────────────────────────────────────────────────
|
|
2
|
+
// ███████╗██╗ ██╗███╗ ██╗██╗ ██╗ █████╗ ██╗
|
|
3
|
+
// ██╔════╝██║ ██║████╗ ██║██║ ██╔╝██╔══██╗██║
|
|
4
|
+
// █████╗ ██║ ██║██╔██╗ ██║█████╔╝ ███████║██║
|
|
5
|
+
// ██╔══╝ ██║ ██║██║╚██╗██║██╔═██╗ ██╔══██║██║
|
|
6
|
+
// ██║ ╚██████╔╝██║ ╚████║██║ ██╗██║ ██║██║
|
|
7
|
+
// ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
|
|
8
|
+
//
|
|
9
|
+
// AUTO-GENERATED — DO NOT EDIT
|
|
10
|
+
// Source: https://models.dev
|
|
11
|
+
// Update: pnpm --filter=@funkai/models generate:models
|
|
12
|
+
// ──────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
import type { LiteralUnion } from "type-fest";
|
|
15
|
+
|
|
16
|
+
import { NVIDIA_MODELS } from "../catalog/providers/nvidia.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for NVIDIA NIM.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { NvidiaModelId } from '@funkai/models/nvidia'
|
|
25
|
+
*
|
|
26
|
+
* const id: NvidiaModelId = 'nvidia/llama-3.1-nemotron-70b-instruct'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type NvidiaModelId = (typeof NVIDIA_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All NVIDIA NIM models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { nvidiaModels } from '@funkai/models/nvidia'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of nvidiaModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const nvidiaModels = NVIDIA_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(NVIDIA_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up a NVIDIA NIM model by ID.
|
|
49
|
+
*
|
|
50
|
+
* @param id - The provider-native model identifier.
|
|
51
|
+
* @returns The matching model definition, or `null`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { nvidiaModel } from '@funkai/models/nvidia'
|
|
56
|
+
*
|
|
57
|
+
* const m = nvidiaModel('nvidia/llama-3.1-nemotron-70b-instruct')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function nvidiaModel(id: LiteralUnion<NvidiaModelId, string>): ModelDefinition | null {
|
|
64
|
+
return MODEL_INDEX.get(id) ?? null;
|
|
65
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// ──────────────────────────────────────────────────────────────
|
|
2
|
+
// ███████╗██╗ ██╗███╗ ██╗██╗ ██╗ █████╗ ██╗
|
|
3
|
+
// ██╔════╝██║ ██║████╗ ██║██║ ██╔╝██╔══██╗██║
|
|
4
|
+
// █████╗ ██║ ██║██╔██╗ ██║█████╔╝ ███████║██║
|
|
5
|
+
// ██╔══╝ ██║ ██║██║╚██╗██║██╔═██╗ ██╔══██║██║
|
|
6
|
+
// ██║ ╚██████╔╝██║ ╚████║██║ ██╗██║ ██║██║
|
|
7
|
+
// ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝
|
|
8
|
+
//
|
|
9
|
+
// AUTO-GENERATED — DO NOT EDIT
|
|
10
|
+
// Source: https://models.dev
|
|
11
|
+
// Update: pnpm --filter=@funkai/models generate:models
|
|
12
|
+
// ──────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
import type { LiteralUnion } from "type-fest";
|
|
15
|
+
|
|
16
|
+
import { OPENAI_MODELS } from "../catalog/providers/openai.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for OpenAI.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { OpenAIModelId } from '@funkai/models/openai'
|
|
25
|
+
*
|
|
26
|
+
* const id: OpenAIModelId = 'gpt-4o-2024-11-20'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type OpenAIModelId = (typeof OPENAI_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All OpenAI models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { openAIModels } from '@funkai/models/openai'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of openAIModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const openAIModels = OPENAI_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(OPENAI_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up an OpenAI model by ID.
|
|
49
|
+
*
|
|
50
|
+
* @param id - The provider-native model identifier.
|
|
51
|
+
* @returns The matching model definition, or `null`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { openAIModel } from '@funkai/models/openai'
|
|
56
|
+
*
|
|
57
|
+
* const m = openAIModel('gpt-4o-2024-11-20')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function openAIModel(id: LiteralUnion<OpenAIModelId, string>): ModelDefinition | null {
|
|
64
|
+
return MODEL_INDEX.get(id) ?? null;
|
|
65
|
+
}
|