@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,125 @@
|
|
|
1
|
+
import type { ModelId } from "@/catalog/index.js";
|
|
2
|
+
import type { LanguageModel } from "@/provider/types.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A function that resolves a provider-specific model name to a {@link LanguageModel}.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { createOpenAI } from '@ai-sdk/openai'
|
|
10
|
+
*
|
|
11
|
+
* const factory: ProviderFactory = createOpenAI({ apiKey: '...' })
|
|
12
|
+
* const model = factory('gpt-4.1')
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export type ProviderFactory = (modelName: string) => LanguageModel;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Mapping from provider prefix (e.g. `"openai"`, `"anthropic"`) to a factory
|
|
19
|
+
* that creates {@link LanguageModel} instances for that provider.
|
|
20
|
+
*/
|
|
21
|
+
export type ProviderMap = Readonly<Record<string, ProviderFactory>>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Configuration for {@link createModelResolver}.
|
|
25
|
+
*/
|
|
26
|
+
export interface ModelResolverConfig {
|
|
27
|
+
/**
|
|
28
|
+
* Direct AI SDK provider mappings by prefix.
|
|
29
|
+
*
|
|
30
|
+
* When a model ID like `"openai/gpt-4.1"` is resolved, the prefix
|
|
31
|
+
* `"openai"` is extracted and looked up in this map. If found, the
|
|
32
|
+
* factory receives the model portion (`"gpt-4.1"`).
|
|
33
|
+
*/
|
|
34
|
+
readonly providers?: ProviderMap;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A fallback factory used when no mapped provider matches.
|
|
38
|
+
*
|
|
39
|
+
* Receives the full model ID string. Useful for routing unmapped
|
|
40
|
+
* providers through an aggregator like OpenRouter.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* import { openrouter } from '@funkai/models'
|
|
45
|
+
*
|
|
46
|
+
* const resolve = createModelResolver({
|
|
47
|
+
* providers: { openai: createOpenAI({ apiKey: '...' }) },
|
|
48
|
+
* fallback: openrouter,
|
|
49
|
+
* })
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
readonly fallback?: (modelId: string) => LanguageModel;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A function that resolves a model ID to a {@link LanguageModel} instance.
|
|
57
|
+
*/
|
|
58
|
+
export type ModelResolver = (modelId: ModelId) => LanguageModel;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Create a model resolver with configurable provider mappings.
|
|
62
|
+
*
|
|
63
|
+
* When a model ID like `"openai/gpt-4.1"` is resolved:
|
|
64
|
+
* 1. The provider prefix (`"openai"`) is extracted
|
|
65
|
+
* 2. If a direct provider is mapped for that prefix, it receives the model portion (`"gpt-4.1"`)
|
|
66
|
+
* 3. Otherwise, the fallback is called with the full ID (if configured)
|
|
67
|
+
* 4. If no fallback, an error is thrown
|
|
68
|
+
*
|
|
69
|
+
* @param config - Provider mappings and fallback configuration.
|
|
70
|
+
* @returns A resolver function that maps model IDs to {@link LanguageModel} instances.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* import { createOpenAI } from '@ai-sdk/openai'
|
|
75
|
+
* import { createAnthropic } from '@ai-sdk/anthropic'
|
|
76
|
+
*
|
|
77
|
+
* const resolve = createModelResolver({
|
|
78
|
+
* providers: {
|
|
79
|
+
* openai: createOpenAI({ apiKey: '...' }),
|
|
80
|
+
* anthropic: createAnthropic({ apiKey: '...' }),
|
|
81
|
+
* },
|
|
82
|
+
* })
|
|
83
|
+
*
|
|
84
|
+
* const m1 = resolve('openai/gpt-4.1') // uses @ai-sdk/openai directly
|
|
85
|
+
* const m2 = resolve('anthropic/claude-sonnet-4') // uses @ai-sdk/anthropic directly
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export function createModelResolver(config?: ModelResolverConfig): ModelResolver {
|
|
89
|
+
const providers = config?.providers ?? {};
|
|
90
|
+
const fallback = config?.fallback;
|
|
91
|
+
|
|
92
|
+
return (modelId: ModelId): LanguageModel => {
|
|
93
|
+
if (!modelId.trim()) {
|
|
94
|
+
throw new Error("Cannot resolve model: model ID is empty");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const slashIndex = modelId.indexOf("/");
|
|
98
|
+
|
|
99
|
+
if (slashIndex === -1) {
|
|
100
|
+
if (fallback) {
|
|
101
|
+
return fallback(modelId);
|
|
102
|
+
}
|
|
103
|
+
throw new Error(
|
|
104
|
+
`Cannot resolve model "${modelId}": no provider prefix and no fallback configured`,
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const prefix = modelId.slice(0, slashIndex);
|
|
109
|
+
// eslint-disable-next-line security/detect-object-injection -- Prefix extracted from user model ID, used as record key lookup
|
|
110
|
+
const factory = providers[prefix];
|
|
111
|
+
|
|
112
|
+
if (factory) {
|
|
113
|
+
const modelName = modelId.slice(slashIndex + 1);
|
|
114
|
+
return factory(modelName);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (fallback) {
|
|
118
|
+
return fallback(modelId);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
throw new Error(
|
|
122
|
+
`Cannot resolve model "${modelId}": no provider mapped for "${prefix}" and no fallback configured`,
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type LanguageModel as BaseLanguageModel } from "ai";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AI SDK language model instance (v3 specification).
|
|
5
|
+
*
|
|
6
|
+
* Narrowed from the base `LanguageModel` union (which includes `string`) to
|
|
7
|
+
* only concrete v3 model objects. This is required because AI SDK functions
|
|
8
|
+
* like `wrapLanguageModel` expect `LanguageModelV3` specifically.
|
|
9
|
+
*
|
|
10
|
+
* When the AI SDK introduces a new specification version, update the
|
|
11
|
+
* `specificationVersion` literal here and verify compatibility with
|
|
12
|
+
* downstream consumers (e.g. `@funkai/agents` middleware).
|
|
13
|
+
*/
|
|
14
|
+
export type LanguageModel = Extract<BaseLanguageModel, { specificationVersion: "v3" }>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Base token counts shared by raw tracking records and final output.
|
|
18
|
+
*
|
|
19
|
+
* All fields are resolved `number` (0 when absent).
|
|
20
|
+
*/
|
|
21
|
+
export interface TokenUsage {
|
|
22
|
+
/** Number of input (prompt) tokens. */
|
|
23
|
+
readonly inputTokens: number;
|
|
24
|
+
|
|
25
|
+
/** Number of output (completion) tokens. */
|
|
26
|
+
readonly outputTokens: number;
|
|
27
|
+
|
|
28
|
+
/** Total tokens (input + output). */
|
|
29
|
+
readonly totalTokens: number;
|
|
30
|
+
|
|
31
|
+
/** Tokens served from the provider's prompt cache. */
|
|
32
|
+
readonly cacheReadTokens: number;
|
|
33
|
+
|
|
34
|
+
/** Tokens written into the provider's prompt cache. */
|
|
35
|
+
readonly cacheWriteTokens: number;
|
|
36
|
+
|
|
37
|
+
/** Tokens consumed by the model's internal reasoning (e.g. o3/o4). */
|
|
38
|
+
readonly reasoningTokens: number;
|
|
39
|
+
}
|
|
@@ -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 { ALIBABA_MODELS } from "../catalog/providers/alibaba.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for Alibaba (Qwen).
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { AlibabaModelId } from '@funkai/models/alibaba'
|
|
25
|
+
*
|
|
26
|
+
* const id: AlibabaModelId = 'qwen-vl-plus'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type AlibabaModelId = (typeof ALIBABA_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All Alibaba (Qwen) models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { alibabaModels } from '@funkai/models/alibaba'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of alibabaModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const alibabaModels = ALIBABA_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(ALIBABA_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up an Alibaba (Qwen) 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 { alibabaModel } from '@funkai/models/alibaba'
|
|
56
|
+
*
|
|
57
|
+
* const m = alibabaModel('qwen-vl-plus')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function alibabaModel(id: LiteralUnion<AlibabaModelId, 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 { AMAZON_BEDROCK_MODELS } from "../catalog/providers/amazon-bedrock.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for Amazon Bedrock.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { AmazonBedrockModelId } from '@funkai/models/amazon-bedrock'
|
|
25
|
+
*
|
|
26
|
+
* const id: AmazonBedrockModelId = 'deepseek.r1-v1:0'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type AmazonBedrockModelId = (typeof AMAZON_BEDROCK_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All Amazon Bedrock models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { amazonBedrockModels } from '@funkai/models/amazon-bedrock'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of amazonBedrockModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const amazonBedrockModels = AMAZON_BEDROCK_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(AMAZON_BEDROCK_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up an Amazon Bedrock 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 { amazonBedrockModel } from '@funkai/models/amazon-bedrock'
|
|
56
|
+
*
|
|
57
|
+
* const m = amazonBedrockModel('deepseek.r1-v1:0')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function amazonBedrockModel(
|
|
64
|
+
id: LiteralUnion<AmazonBedrockModelId, 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 { ANTHROPIC_MODELS } from "../catalog/providers/anthropic.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for Anthropic.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { AnthropicModelId } from '@funkai/models/anthropic'
|
|
25
|
+
*
|
|
26
|
+
* const id: AnthropicModelId = 'claude-opus-4-5-20251101'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type AnthropicModelId = (typeof ANTHROPIC_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All Anthropic models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { anthropicModels } from '@funkai/models/anthropic'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of anthropicModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const anthropicModels = ANTHROPIC_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(ANTHROPIC_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up an Anthropic 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 { anthropicModel } from '@funkai/models/anthropic'
|
|
56
|
+
*
|
|
57
|
+
* const m = anthropicModel('claude-opus-4-5-20251101')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function anthropicModel(id: LiteralUnion<AnthropicModelId, 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 { CEREBRAS_MODELS } from "../catalog/providers/cerebras.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for Cerebras.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { CerebrasModelId } from '@funkai/models/cerebras'
|
|
25
|
+
*
|
|
26
|
+
* const id: CerebrasModelId = 'qwen-3-235b-a22b-instruct-2507'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type CerebrasModelId = (typeof CEREBRAS_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All Cerebras models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { cerebrasModels } from '@funkai/models/cerebras'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of cerebrasModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const cerebrasModels = CEREBRAS_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(CEREBRAS_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up a Cerebras 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 { cerebrasModel } from '@funkai/models/cerebras'
|
|
56
|
+
*
|
|
57
|
+
* const m = cerebrasModel('qwen-3-235b-a22b-instruct-2507')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function cerebrasModel(id: LiteralUnion<CerebrasModelId, 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 { COHERE_MODELS } from "../catalog/providers/cohere.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for Cohere.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { CohereModelId } from '@funkai/models/cohere'
|
|
25
|
+
*
|
|
26
|
+
* const id: CohereModelId = 'c4ai-aya-expanse-32b'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type CohereModelId = (typeof COHERE_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All Cohere models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { cohereModels } from '@funkai/models/cohere'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of cohereModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const cohereModels = COHERE_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(COHERE_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up a Cohere 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 { cohereModel } from '@funkai/models/cohere'
|
|
56
|
+
*
|
|
57
|
+
* const m = cohereModel('c4ai-aya-expanse-32b')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function cohereModel(id: LiteralUnion<CohereModelId, 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 { DEEPINFRA_MODELS } from "../catalog/providers/deepinfra.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for DeepInfra.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { DeepInfraModelId } from '@funkai/models/deepinfra'
|
|
25
|
+
*
|
|
26
|
+
* const id: DeepInfraModelId = 'zai-org/GLM-4.7-Flash'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type DeepInfraModelId = (typeof DEEPINFRA_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All DeepInfra models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { deepInfraModels } from '@funkai/models/deepinfra'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of deepInfraModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const deepInfraModels = DEEPINFRA_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(DEEPINFRA_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up a DeepInfra 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 { deepInfraModel } from '@funkai/models/deepinfra'
|
|
56
|
+
*
|
|
57
|
+
* const m = deepInfraModel('zai-org/GLM-4.7-Flash')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function deepInfraModel(id: LiteralUnion<DeepInfraModelId, 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 { DEEPSEEK_MODELS } from "../catalog/providers/deepseek.js";
|
|
17
|
+
import type { ModelDefinition } from "../catalog/types.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Known model identifiers for DeepSeek.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import type { DeepSeekModelId } from '@funkai/models/deepseek'
|
|
25
|
+
*
|
|
26
|
+
* const id: DeepSeekModelId = 'deepseek-reasoner'
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type DeepSeekModelId = (typeof DEEPSEEK_MODELS)[number]["id"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* All DeepSeek models in the catalog.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { deepSeekModels } from '@funkai/models/deepseek'
|
|
37
|
+
*
|
|
38
|
+
* for (const m of deepSeekModels) {
|
|
39
|
+
* console.log(m.id, m.pricing.input)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export const deepSeekModels = DEEPSEEK_MODELS;
|
|
44
|
+
|
|
45
|
+
const MODEL_INDEX = new Map<string, ModelDefinition>(DEEPSEEK_MODELS.map((m) => [m.id, m]));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Look up a DeepSeek 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 { deepSeekModel } from '@funkai/models/deepseek'
|
|
56
|
+
*
|
|
57
|
+
* const m = deepSeekModel('deepseek-reasoner')
|
|
58
|
+
* if (m) {
|
|
59
|
+
* console.log(m.pricing.input)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function deepSeekModel(id: LiteralUnion<DeepSeekModelId, string>): ModelDefinition | null {
|
|
64
|
+
return MODEL_INDEX.get(id) ?? null;
|
|
65
|
+
}
|