@oh-my-pi/pi-catalog 17.2.11 → 17.2.13
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/CHANGELOG.md +18 -0
- package/package.json +4 -4
- package/src/identity/classify.ts +3 -3
- package/src/models.json +5431 -2067
- package/src/provider-models/openai-compat.ts +297 -301
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { USER_AGENT } from "@oh-my-pi/pi-utils";
|
|
2
2
|
import * as logger from "@oh-my-pi/pi-utils/logger";
|
|
3
3
|
import {
|
|
4
4
|
fetchOpenAICompatibleModels,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "../identity/family";
|
|
19
19
|
import { resolveModelReference } from "../identity/reference";
|
|
20
20
|
import type { ModelManagerOptions } from "../model-manager";
|
|
21
|
-
import { getBundledModels } from "../models";
|
|
21
|
+
import { type GeneratedProvider, getBundledModels } from "../models";
|
|
22
22
|
import type { Api, FetchImpl, Model, ModelSpec, OpenAICompat, Provider, ThinkingConfig } from "../types";
|
|
23
23
|
import { discoveryFetch, isAnthropicOAuthToken, isRecord, toBoolean, toNumber, toPositiveNumber } from "../utils";
|
|
24
24
|
import { ALIBABA_TOKEN_PLAN_BASE_URL, parseAlibabaTokenPlanCredential } from "../wire/alibaba-token-plan";
|
|
@@ -111,7 +111,7 @@ const catalogSession: {
|
|
|
111
111
|
hasPayload: boolean;
|
|
112
112
|
} = { inflight: null, payload: undefined, etag: null, hasPayload: false };
|
|
113
113
|
|
|
114
|
-
const CATALOG_USER_AGENT =
|
|
114
|
+
const CATALOG_USER_AGENT = USER_AGENT;
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
117
|
* Fetches the models.dev catalog via catalog.stencil.so, which serves a
|
|
@@ -592,60 +592,68 @@ function resolveSimpleProviderHeaders(
|
|
|
592
592
|
return typeof headers === "function" ? headers() : headers;
|
|
593
593
|
}
|
|
594
594
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
595
|
+
type OpenAICompatibleModelManagerBuilderOptions<TApi extends Api> = {
|
|
596
|
+
api: TApi;
|
|
597
|
+
providerId: GeneratedProvider;
|
|
598
|
+
defaultBaseUrl: string;
|
|
599
|
+
config?: SimpleProviderConfig;
|
|
600
|
+
headers?: SimpleProviderDiscoveryHeaders;
|
|
601
|
+
dynamicModelsAuthoritative?: true;
|
|
602
|
+
requireApiKey?: true;
|
|
603
|
+
filterModel?: (
|
|
604
|
+
entry: OpenAICompatibleModelRecord,
|
|
605
|
+
model: ModelSpec<TApi>,
|
|
606
|
+
references: Map<string, ModelSpec<TApi>>,
|
|
607
|
+
) => boolean;
|
|
608
|
+
mapModel: (
|
|
609
|
+
entry: OpenAICompatibleModelRecord,
|
|
610
|
+
defaults: ModelSpec<TApi>,
|
|
611
|
+
reference: ModelSpec<TApi> | undefined,
|
|
612
|
+
) => ModelSpec<TApi> | null;
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
function createOpenAICompatibleModelManagerOptions<TApi extends Api>(
|
|
616
|
+
options: OpenAICompatibleModelManagerBuilderOptions<TApi>,
|
|
617
|
+
): ModelManagerOptions<TApi> {
|
|
618
|
+
const apiKey = options.config?.apiKey;
|
|
619
|
+
const baseUrl = options.config?.baseUrl ?? options.defaultBaseUrl;
|
|
620
|
+
const references = createBundledReferenceMap<TApi>(options.providerId);
|
|
621
|
+
const filterModel = options.filterModel;
|
|
603
622
|
return {
|
|
604
|
-
providerId,
|
|
605
|
-
...(
|
|
623
|
+
providerId: options.providerId,
|
|
624
|
+
...(options.dynamicModelsAuthoritative && { dynamicModelsAuthoritative: true }),
|
|
625
|
+
...((!options.requireApiKey || apiKey) && {
|
|
606
626
|
fetchDynamicModels: () =>
|
|
607
627
|
fetchOpenAICompatibleModels({
|
|
608
|
-
api:
|
|
609
|
-
provider: providerId,
|
|
628
|
+
api: options.api,
|
|
629
|
+
provider: options.providerId,
|
|
610
630
|
baseUrl,
|
|
611
631
|
apiKey,
|
|
612
|
-
headers: resolveSimpleProviderHeaders(
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
fetch: config?.fetch,
|
|
632
|
+
...(options.headers && { headers: resolveSimpleProviderHeaders(options.headers) }),
|
|
633
|
+
...(filterModel && {
|
|
634
|
+
filterModel: (entry, model) => filterModel(entry, model, references),
|
|
635
|
+
}),
|
|
636
|
+
mapModel: (entry, defaults) => options.mapModel(entry, defaults, references.get(defaults.id)),
|
|
637
|
+
fetch: options.config?.fetch,
|
|
618
638
|
}),
|
|
619
639
|
}),
|
|
620
640
|
};
|
|
621
641
|
}
|
|
622
642
|
|
|
623
|
-
function
|
|
643
|
+
export function createSimpleOpenAICompletionsOptions(
|
|
624
644
|
providerId: Parameters<typeof getBundledModels>[0],
|
|
625
645
|
defaultBaseUrl: string,
|
|
626
646
|
config?: SimpleProviderConfig,
|
|
627
|
-
): ModelManagerOptions<"openai-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
const references = createBundledReferenceMap<"openai-responses">(providerId);
|
|
631
|
-
return {
|
|
647
|
+
): ModelManagerOptions<"openai-completions"> {
|
|
648
|
+
return createOpenAICompatibleModelManagerOptions({
|
|
649
|
+
api: "openai-completions",
|
|
632
650
|
providerId,
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
apiKey,
|
|
640
|
-
headers: resolveSimpleProviderHeaders(config?.headers),
|
|
641
|
-
mapModel: (entry, defaults) => {
|
|
642
|
-
const reference = references.get(defaults.id);
|
|
643
|
-
return mapWithBundledReference(entry, defaults, reference);
|
|
644
|
-
},
|
|
645
|
-
fetch: config?.fetch,
|
|
646
|
-
}),
|
|
647
|
-
}),
|
|
648
|
-
};
|
|
651
|
+
defaultBaseUrl,
|
|
652
|
+
config,
|
|
653
|
+
headers: config?.headers,
|
|
654
|
+
requireApiKey: true,
|
|
655
|
+
mapModel: mapWithBundledReference,
|
|
656
|
+
});
|
|
649
657
|
}
|
|
650
658
|
|
|
651
659
|
function createSimpleAnthropicProviderOptions(
|
|
@@ -865,27 +873,15 @@ export interface OpenAIModelManagerConfig {
|
|
|
865
873
|
}
|
|
866
874
|
|
|
867
875
|
export function openaiModelManagerOptions(config?: OpenAIModelManagerConfig): ModelManagerOptions<"openai-responses"> {
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
const references = createBundledReferenceMap<"openai-responses">("openai");
|
|
871
|
-
return {
|
|
876
|
+
return createOpenAICompatibleModelManagerOptions({
|
|
877
|
+
api: "openai-responses",
|
|
872
878
|
providerId: "openai",
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
apiKey,
|
|
880
|
-
filterModel: (_entry, model) => isLikelyOpenAIResponsesModelId(model.id, references),
|
|
881
|
-
mapModel: (entry, defaults) => {
|
|
882
|
-
const reference = references.get(defaults.id);
|
|
883
|
-
return mapWithBundledReference(entry, defaults, reference);
|
|
884
|
-
},
|
|
885
|
-
fetch: config?.fetch,
|
|
886
|
-
}),
|
|
887
|
-
}),
|
|
888
|
-
};
|
|
879
|
+
defaultBaseUrl: "https://api.openai.com/v1",
|
|
880
|
+
config,
|
|
881
|
+
requireApiKey: true,
|
|
882
|
+
filterModel: (_entry, model, references) => isLikelyOpenAIResponsesModelId(model.id, references),
|
|
883
|
+
mapModel: mapWithBundledReference,
|
|
884
|
+
});
|
|
889
885
|
}
|
|
890
886
|
|
|
891
887
|
/** First-party gpt-5.6 SKUs that accept `reasoning: { mode: "pro" }` on the Responses APIs. */
|
|
@@ -1036,27 +1032,15 @@ export interface CerebrasModelManagerConfig {
|
|
|
1036
1032
|
export function cerebrasModelManagerOptions(
|
|
1037
1033
|
config?: CerebrasModelManagerConfig,
|
|
1038
1034
|
): ModelManagerOptions<"openai-completions"> {
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
const references = createBundledReferenceMap<"openai-completions">("cerebras");
|
|
1042
|
-
return {
|
|
1035
|
+
return createOpenAICompatibleModelManagerOptions({
|
|
1036
|
+
api: "openai-completions",
|
|
1043
1037
|
providerId: "cerebras",
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
apiKey,
|
|
1051
|
-
mapModel: (entry, defaults) => {
|
|
1052
|
-
const reference = references.get(defaults.id);
|
|
1053
|
-
const model = mapWithBundledReference(entry, defaults, reference);
|
|
1054
|
-
return applyCerebrasDiscoveryOverrides(model);
|
|
1055
|
-
},
|
|
1056
|
-
fetch: config?.fetch,
|
|
1057
|
-
}),
|
|
1058
|
-
}),
|
|
1059
|
-
};
|
|
1038
|
+
defaultBaseUrl: "https://api.cerebras.ai/v1",
|
|
1039
|
+
config,
|
|
1040
|
+
requireApiKey: true,
|
|
1041
|
+
mapModel: (entry, defaults, reference) =>
|
|
1042
|
+
applyCerebrasDiscoveryOverrides(mapWithBundledReference(entry, defaults, reference)),
|
|
1043
|
+
});
|
|
1060
1044
|
}
|
|
1061
1045
|
|
|
1062
1046
|
// ---------------------------------------------------------------------------
|
|
@@ -1160,31 +1144,23 @@ function mapNovitaModel(
|
|
|
1160
1144
|
export function novitaModelManagerOptions(
|
|
1161
1145
|
config?: NovitaModelManagerConfig,
|
|
1162
1146
|
): ModelManagerOptions<"openai-completions"> {
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
const references = createBundledReferenceMap<"openai-completions">("novita");
|
|
1166
|
-
return {
|
|
1147
|
+
return createOpenAICompatibleModelManagerOptions({
|
|
1148
|
+
api: "openai-completions",
|
|
1167
1149
|
providerId: "novita",
|
|
1150
|
+
defaultBaseUrl: "https://api.novita.ai/openai/v1",
|
|
1151
|
+
config,
|
|
1168
1152
|
dynamicModelsAuthoritative: true,
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
isPublicNovitaModelId(model.id) &&
|
|
1181
|
-
novitaArrayIncludes(entry.endpoints, "chat/completions") &&
|
|
1182
|
-
toPositiveNumber(entry.max_output_tokens, 0) > 0
|
|
1183
|
-
);
|
|
1184
|
-
},
|
|
1185
|
-
fetch: config?.fetch,
|
|
1186
|
-
}),
|
|
1187
|
-
};
|
|
1153
|
+
filterModel: (entry, model) => {
|
|
1154
|
+
const active = typeof entry.status !== "number" || entry.status === 1;
|
|
1155
|
+
return (
|
|
1156
|
+
active &&
|
|
1157
|
+
isPublicNovitaModelId(model.id) &&
|
|
1158
|
+
novitaArrayIncludes(entry.endpoints, "chat/completions") &&
|
|
1159
|
+
toPositiveNumber(entry.max_output_tokens, 0) > 0
|
|
1160
|
+
);
|
|
1161
|
+
},
|
|
1162
|
+
mapModel: mapNovitaModel,
|
|
1163
|
+
});
|
|
1188
1164
|
}
|
|
1189
1165
|
|
|
1190
1166
|
// ---------------------------------------------------------------------------
|
|
@@ -1453,11 +1429,14 @@ export function xaiOAuthModelManagerOptions(
|
|
|
1453
1429
|
): ModelManagerOptions<"openai-responses"> {
|
|
1454
1430
|
const defaultBaseUrl = "https://api.x.ai/v1";
|
|
1455
1431
|
const resolvedBaseUrl = config?.baseUrl ?? defaultBaseUrl;
|
|
1456
|
-
const base =
|
|
1457
|
-
"
|
|
1432
|
+
const base = createOpenAICompatibleModelManagerOptions({
|
|
1433
|
+
api: "openai-responses",
|
|
1434
|
+
providerId: "xai-oauth",
|
|
1458
1435
|
defaultBaseUrl,
|
|
1459
1436
|
config,
|
|
1460
|
-
|
|
1437
|
+
requireApiKey: true,
|
|
1438
|
+
mapModel: mapWithBundledReference,
|
|
1439
|
+
});
|
|
1461
1440
|
// Static seed handed to the runtime model manager so the picker populates on
|
|
1462
1441
|
// a fresh login even before `fetchDynamicModels` fires (it is gated on
|
|
1463
1442
|
// `config.apiKey` at construction time, and OAuth tokens resolve later via
|
|
@@ -1510,28 +1489,16 @@ export interface AimlApiModelManagerConfig {
|
|
|
1510
1489
|
export function aimlApiModelManagerOptions(
|
|
1511
1490
|
config?: AimlApiModelManagerConfig,
|
|
1512
1491
|
): ModelManagerOptions<"openai-completions"> {
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
const references = createBundledReferenceMap<"openai-completions">("aimlapi");
|
|
1516
|
-
return {
|
|
1492
|
+
return createOpenAICompatibleModelManagerOptions({
|
|
1493
|
+
api: "openai-completions",
|
|
1517
1494
|
providerId: "aimlapi",
|
|
1495
|
+
defaultBaseUrl: "https://api.aimlapi.com/v1",
|
|
1496
|
+
config,
|
|
1518
1497
|
dynamicModelsAuthoritative: true,
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
provider: "aimlapi",
|
|
1524
|
-
baseUrl,
|
|
1525
|
-
apiKey,
|
|
1526
|
-
filterModel: (_entry, model) => isLikelyAimlApiChatModelId(model.id),
|
|
1527
|
-
mapModel: (entry, defaults) => {
|
|
1528
|
-
const reference = references.get(defaults.id);
|
|
1529
|
-
return mapWithBundledReference(entry, defaults, reference);
|
|
1530
|
-
},
|
|
1531
|
-
fetch: config?.fetch,
|
|
1532
|
-
}),
|
|
1533
|
-
}),
|
|
1534
|
-
};
|
|
1498
|
+
requireApiKey: true,
|
|
1499
|
+
filterModel: (_entry, model) => isLikelyAimlApiChatModelId(model.id),
|
|
1500
|
+
mapModel: mapWithBundledReference,
|
|
1501
|
+
});
|
|
1535
1502
|
}
|
|
1536
1503
|
|
|
1537
1504
|
// ---------------------------------------------------------------------------
|
|
@@ -1845,6 +1812,7 @@ const FIREWORKS_FAST_VARIANT_SPECS: ReadonlyArray<{
|
|
|
1845
1812
|
{ base: "kimi-k2.7-code", name: "Kimi K2.7 Code Fast", cost: { input: 1.9, output: 8, cacheRead: 0.38 } },
|
|
1846
1813
|
{ base: "kimi-k2.6", name: "Kimi K2.6 Fast", cost: { input: 2, output: 8, cacheRead: 0.3 } },
|
|
1847
1814
|
{ base: "glm-5.1", name: "GLM-5.1 Fast", cost: { input: 2.8, output: 8.8, cacheRead: 0.52 } },
|
|
1815
|
+
{ base: "glm-5.2", name: "GLM-5.2 Fast", cost: { input: 2.1, output: 6.6, cacheRead: 0.21 } },
|
|
1848
1816
|
];
|
|
1849
1817
|
|
|
1850
1818
|
/**
|
|
@@ -2699,24 +2667,13 @@ export interface AlibabaCodingPlanModelManagerConfig {
|
|
|
2699
2667
|
export function alibabaCodingPlanModelManagerOptions(
|
|
2700
2668
|
config?: AlibabaCodingPlanModelManagerConfig,
|
|
2701
2669
|
): ModelManagerOptions<"openai-completions"> {
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
const references = createBundledReferenceMap<"openai-completions">("alibaba-coding-plan");
|
|
2705
|
-
return {
|
|
2670
|
+
return createOpenAICompatibleModelManagerOptions({
|
|
2671
|
+
api: "openai-completions",
|
|
2706
2672
|
providerId: "alibaba-coding-plan",
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
baseUrl,
|
|
2712
|
-
apiKey,
|
|
2713
|
-
mapModel: (entry, defaults) => {
|
|
2714
|
-
const reference = references.get(defaults.id);
|
|
2715
|
-
return mapWithBundledReference(entry, defaults, reference);
|
|
2716
|
-
},
|
|
2717
|
-
fetch: config?.fetch,
|
|
2718
|
-
}),
|
|
2719
|
-
};
|
|
2673
|
+
defaultBaseUrl: "https://coding-intl.dashscope.aliyuncs.com/v1",
|
|
2674
|
+
config,
|
|
2675
|
+
mapModel: mapWithBundledReference,
|
|
2676
|
+
});
|
|
2720
2677
|
}
|
|
2721
2678
|
|
|
2722
2679
|
// ---------------------------------------------------------------------------
|
|
@@ -2733,6 +2690,17 @@ const ALIBABA_TOKEN_PLAN_REASONING: ThinkingConfig = {
|
|
|
2733
2690
|
mode: "effort",
|
|
2734
2691
|
efforts: [Effort.Minimal, Effort.Low, Effort.Medium, Effort.High],
|
|
2735
2692
|
};
|
|
2693
|
+
// Qwen3.8-Max combines Qwen's binary thinking toggle with OpenAI-style
|
|
2694
|
+
// `reasoning_effort`. The base Qwen view encodes disabled turns; reasoning
|
|
2695
|
+
// requests swap to the OpenAI effort dialect and explicitly enable thinking.
|
|
2696
|
+
const ALIBABA_TOKEN_PLAN_QWEN_EFFORT_COMPAT: OpenAICompat = {
|
|
2697
|
+
...ALIBABA_TOKEN_PLAN_COMPAT,
|
|
2698
|
+
supportsReasoningEffort: true,
|
|
2699
|
+
whenThinking: {
|
|
2700
|
+
thinkingFormat: "openai",
|
|
2701
|
+
extraBody: { enable_thinking: true },
|
|
2702
|
+
},
|
|
2703
|
+
};
|
|
2736
2704
|
|
|
2737
2705
|
export const ALIBABA_TOKEN_PLAN_STATIC_MODELS: readonly ModelSpec<"openai-completions">[] = [
|
|
2738
2706
|
{
|
|
@@ -2756,6 +2724,24 @@ export const ALIBABA_TOKEN_PLAN_STATIC_MODELS: readonly ModelSpec<"openai-comple
|
|
|
2756
2724
|
supportsReasoningEffort: true,
|
|
2757
2725
|
},
|
|
2758
2726
|
},
|
|
2727
|
+
{
|
|
2728
|
+
id: "qwen3.8-max",
|
|
2729
|
+
name: "Qwen3.8 Max",
|
|
2730
|
+
api: "openai-completions",
|
|
2731
|
+
provider: "alibaba-token-plan",
|
|
2732
|
+
baseUrl: ALIBABA_TOKEN_PLAN_BASE_URL,
|
|
2733
|
+
reasoning: true,
|
|
2734
|
+
input: ["text", "image"],
|
|
2735
|
+
cost: ALIBABA_TOKEN_PLAN_COST,
|
|
2736
|
+
contextWindow: 1_000_000,
|
|
2737
|
+
maxTokens: 131_072,
|
|
2738
|
+
thinking: {
|
|
2739
|
+
mode: "effort",
|
|
2740
|
+
efforts: [Effort.Low, Effort.Medium, Effort.XHigh],
|
|
2741
|
+
defaultLevel: Effort.XHigh,
|
|
2742
|
+
},
|
|
2743
|
+
compat: ALIBABA_TOKEN_PLAN_QWEN_EFFORT_COMPAT,
|
|
2744
|
+
},
|
|
2759
2745
|
{
|
|
2760
2746
|
id: "qwen3.7-max",
|
|
2761
2747
|
name: "Qwen3.7 Max",
|
|
@@ -3519,29 +3505,20 @@ export interface VeniceModelManagerConfig {
|
|
|
3519
3505
|
export function veniceModelManagerOptions(
|
|
3520
3506
|
config?: VeniceModelManagerConfig,
|
|
3521
3507
|
): ModelManagerOptions<"openai-completions"> {
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
const references = createBundledReferenceMap<"openai-completions">("venice");
|
|
3525
|
-
return {
|
|
3508
|
+
return createOpenAICompatibleModelManagerOptions({
|
|
3509
|
+
api: "openai-completions",
|
|
3526
3510
|
providerId: "venice",
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
maxTokens: clampKimiK27CodeMaxTokens(defaults.id, model.maxTokens),
|
|
3539
|
-
compat: { ...model.compat, supportsUsageInStreaming: false },
|
|
3540
|
-
};
|
|
3541
|
-
},
|
|
3542
|
-
fetch: config?.fetch,
|
|
3543
|
-
}),
|
|
3544
|
-
};
|
|
3511
|
+
defaultBaseUrl: "https://api.venice.ai/api/v1",
|
|
3512
|
+
config,
|
|
3513
|
+
mapModel: (entry, defaults, reference) => {
|
|
3514
|
+
const model = mapWithBundledReference(entry, defaults, reference);
|
|
3515
|
+
return {
|
|
3516
|
+
...model,
|
|
3517
|
+
maxTokens: clampKimiK27CodeMaxTokens(defaults.id, model.maxTokens),
|
|
3518
|
+
compat: { ...model.compat, supportsUsageInStreaming: false },
|
|
3519
|
+
};
|
|
3520
|
+
},
|
|
3521
|
+
});
|
|
3545
3522
|
}
|
|
3546
3523
|
|
|
3547
3524
|
// ---------------------------------------------------------------------------
|
|
@@ -3557,83 +3534,65 @@ export interface BasetenModelManagerConfig {
|
|
|
3557
3534
|
export function basetenModelManagerOptions(
|
|
3558
3535
|
config?: BasetenModelManagerConfig,
|
|
3559
3536
|
): ModelManagerOptions<"openai-completions"> {
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
const references = createBundledReferenceMap<"openai-completions">("baseten");
|
|
3563
|
-
return {
|
|
3537
|
+
return createOpenAICompatibleModelManagerOptions({
|
|
3538
|
+
api: "openai-completions",
|
|
3564
3539
|
providerId: "baseten",
|
|
3540
|
+
defaultBaseUrl: "https://inference.baseten.co/v1",
|
|
3541
|
+
config,
|
|
3565
3542
|
dynamicModelsAuthoritative: true,
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
input: toPositiveNumber(pricing.prompt, 0) * 1_000_000,
|
|
3596
|
-
output: toPositiveNumber(pricing.completion, 0) * 1_000_000,
|
|
3597
|
-
cacheRead: toPositiveNumber(pricing.input_cache_read, 0) * 1_000_000,
|
|
3598
|
-
cacheWrite: 0,
|
|
3599
|
-
};
|
|
3600
|
-
|
|
3601
|
-
const contextWindow = toPositiveNumber(
|
|
3602
|
-
raw.context_length,
|
|
3603
|
-
reference?.contextWindow ?? defaults.contextWindow,
|
|
3604
|
-
);
|
|
3605
|
-
const maxTokens = toPositiveNumber(
|
|
3606
|
-
raw.max_completion_tokens,
|
|
3607
|
-
reference?.maxTokens ?? defaults.maxTokens,
|
|
3608
|
-
);
|
|
3543
|
+
requireApiKey: true,
|
|
3544
|
+
mapModel: (entry, defaults, reference) => {
|
|
3545
|
+
const raw = entry as Record<string, unknown> & {
|
|
3546
|
+
supported_features?: unknown;
|
|
3547
|
+
input_modalities?: unknown;
|
|
3548
|
+
pricing?: Record<string, unknown>;
|
|
3549
|
+
};
|
|
3550
|
+
const features = Array.isArray(raw.supported_features) ? raw.supported_features : [];
|
|
3551
|
+
const modalities = Array.isArray(raw.input_modalities) ? raw.input_modalities : [];
|
|
3552
|
+
|
|
3553
|
+
// Baseten's reasoning router accepts only the high/max
|
|
3554
|
+
// effort tiers for its GLM-5.2 and gpt-oss routes.
|
|
3555
|
+
const isEffortReasoning =
|
|
3556
|
+
defaults.id === "openai/gpt-oss-120b" ||
|
|
3557
|
+
defaults.id === "zai-org/GLM-5.2" ||
|
|
3558
|
+
defaults.id === "zai-org/GLM-5.2-Fast";
|
|
3559
|
+
const isBasetenNativeReasoning = isEffortReasoning || defaults.id === "deepseek-ai/DeepSeek-V4-Pro";
|
|
3560
|
+
const reasoning =
|
|
3561
|
+
isBasetenNativeReasoning && (features.includes("reasoning") || features.includes("reasoning_effort"));
|
|
3562
|
+
const supportsTools = features.includes("tools") ? undefined : false;
|
|
3563
|
+
const vision = modalities.includes("image") || (reference?.input.includes("image") ?? false);
|
|
3564
|
+
|
|
3565
|
+
const pricing = raw.pricing ?? {};
|
|
3566
|
+
const cost = {
|
|
3567
|
+
input: toPositiveNumber(pricing.prompt, 0) * 1_000_000,
|
|
3568
|
+
output: toPositiveNumber(pricing.completion, 0) * 1_000_000,
|
|
3569
|
+
cacheRead: toPositiveNumber(pricing.input_cache_read, 0) * 1_000_000,
|
|
3570
|
+
cacheWrite: 0,
|
|
3571
|
+
};
|
|
3609
3572
|
|
|
3610
|
-
|
|
3573
|
+
const contextWindow = toPositiveNumber(raw.context_length, reference?.contextWindow ?? defaults.contextWindow);
|
|
3574
|
+
const maxTokens = toPositiveNumber(raw.max_completion_tokens, reference?.maxTokens ?? defaults.maxTokens);
|
|
3611
3575
|
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
}
|
|
3620
|
-
: undefined;
|
|
3576
|
+
const baseModel = mapWithBundledReference(entry, defaults, reference);
|
|
3577
|
+
const thinking = isEffortReasoning
|
|
3578
|
+
? {
|
|
3579
|
+
mode: "effort" as const,
|
|
3580
|
+
efforts: [Effort.High, Effort.Max],
|
|
3581
|
+
}
|
|
3582
|
+
: undefined;
|
|
3621
3583
|
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
}),
|
|
3635
|
-
}),
|
|
3636
|
-
};
|
|
3584
|
+
return {
|
|
3585
|
+
...baseModel,
|
|
3586
|
+
reasoning,
|
|
3587
|
+
input: vision ? ["text", "image"] : ["text"],
|
|
3588
|
+
cost,
|
|
3589
|
+
contextWindow,
|
|
3590
|
+
maxTokens,
|
|
3591
|
+
...(thinking ? { thinking } : {}),
|
|
3592
|
+
...(supportsTools === false ? { supportsTools } : {}),
|
|
3593
|
+
};
|
|
3594
|
+
},
|
|
3595
|
+
});
|
|
3637
3596
|
}
|
|
3638
3597
|
|
|
3639
3598
|
// ---------------------------------------------------------------------------
|
|
@@ -3700,6 +3659,40 @@ export const META_MUSE_STATIC_MODELS: readonly ModelSpec<"openai-responses">[] =
|
|
|
3700
3659
|
includeEncryptedReasoning: true,
|
|
3701
3660
|
},
|
|
3702
3661
|
},
|
|
3662
|
+
{
|
|
3663
|
+
id: "muse-spark-1.2",
|
|
3664
|
+
name: "Muse Spark 1.2",
|
|
3665
|
+
api: "openai-responses",
|
|
3666
|
+
provider: "meta",
|
|
3667
|
+
baseUrl: META_MODEL_API_BASE_URL,
|
|
3668
|
+
reasoning: true,
|
|
3669
|
+
input: ["text", "image"],
|
|
3670
|
+
cost: META_MUSE_SPARK_COST,
|
|
3671
|
+
contextWindow: 1_048_576,
|
|
3672
|
+
maxTokens: 131_072,
|
|
3673
|
+
thinking: META_MUSE_SPARK_THINKING,
|
|
3674
|
+
compat: {
|
|
3675
|
+
supportsReasoningEffort: true,
|
|
3676
|
+
includeEncryptedReasoning: true,
|
|
3677
|
+
},
|
|
3678
|
+
},
|
|
3679
|
+
{
|
|
3680
|
+
id: "muse-spark-1.2-contributor",
|
|
3681
|
+
name: "Muse Spark 1.2 Contributor (Data Used for Training)",
|
|
3682
|
+
api: "openai-responses",
|
|
3683
|
+
provider: "meta",
|
|
3684
|
+
baseUrl: META_MODEL_API_BASE_URL,
|
|
3685
|
+
reasoning: true,
|
|
3686
|
+
input: ["text", "image"],
|
|
3687
|
+
cost: { input: 0.1, output: 0.2, cacheRead: 0.002, cacheWrite: 0 },
|
|
3688
|
+
contextWindow: 1_048_576,
|
|
3689
|
+
maxTokens: 131_072,
|
|
3690
|
+
thinking: META_MUSE_SPARK_THINKING,
|
|
3691
|
+
compat: {
|
|
3692
|
+
supportsReasoningEffort: true,
|
|
3693
|
+
includeEncryptedReasoning: true,
|
|
3694
|
+
},
|
|
3695
|
+
},
|
|
3703
3696
|
];
|
|
3704
3697
|
|
|
3705
3698
|
// ---------------------------------------------------------------------------
|
|
@@ -3830,7 +3823,14 @@ export interface MetaModelManagerConfig {
|
|
|
3830
3823
|
|
|
3831
3824
|
export function metaModelManagerOptions(config?: MetaModelManagerConfig): ModelManagerOptions<"openai-responses"> {
|
|
3832
3825
|
return {
|
|
3833
|
-
...
|
|
3826
|
+
...createOpenAICompatibleModelManagerOptions({
|
|
3827
|
+
api: "openai-responses",
|
|
3828
|
+
providerId: "meta",
|
|
3829
|
+
defaultBaseUrl: META_MODEL_API_BASE_URL,
|
|
3830
|
+
config,
|
|
3831
|
+
requireApiKey: true,
|
|
3832
|
+
mapModel: mapWithBundledReference,
|
|
3833
|
+
}),
|
|
3834
3834
|
staticModels: META_MUSE_STATIC_MODELS,
|
|
3835
3835
|
};
|
|
3836
3836
|
}
|
|
@@ -3865,67 +3865,56 @@ const MOONSHOT_KIMI_K3_THINKING: ThinkingConfig = { mode: "effort", efforts: [Ef
|
|
|
3865
3865
|
export function moonshotModelManagerOptions(
|
|
3866
3866
|
config?: MoonshotModelManagerConfig,
|
|
3867
3867
|
): ModelManagerOptions<"openai-completions"> {
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
// inherits this baseUrl) at the Kimi China platform `api.moonshot.cn`; an
|
|
3871
|
-
// explicit `config.baseUrl` still wins. Mirrors LITELLM_BASE_URL/LM_STUDIO_BASE_URL. (#2883)
|
|
3872
|
-
const baseUrl = config?.baseUrl ?? Bun.env.MOONSHOT_BASE_URL ?? "https://api.moonshot.ai/v1";
|
|
3873
|
-
const references = createBundledReferenceMap<"openai-completions">("moonshot");
|
|
3874
|
-
return {
|
|
3868
|
+
return createOpenAICompatibleModelManagerOptions({
|
|
3869
|
+
api: "openai-completions",
|
|
3875
3870
|
providerId: "moonshot",
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
};
|
|
3924
|
-
},
|
|
3925
|
-
fetch: config?.fetch,
|
|
3926
|
-
}),
|
|
3927
|
-
}),
|
|
3928
|
-
};
|
|
3871
|
+
// `MOONSHOT_BASE_URL` redirects discovery (and the streaming request that
|
|
3872
|
+
// inherits this baseUrl) at the Kimi China platform `api.moonshot.cn`; an
|
|
3873
|
+
// explicit `config.baseUrl` still wins. Mirrors LITELLM_BASE_URL/LM_STUDIO_BASE_URL. (#2883)
|
|
3874
|
+
defaultBaseUrl: Bun.env.MOONSHOT_BASE_URL ?? "https://api.moonshot.ai/v1",
|
|
3875
|
+
config,
|
|
3876
|
+
requireApiKey: true,
|
|
3877
|
+
mapModel: (entry, defaults, reference) => {
|
|
3878
|
+
const model = mapWithBundledReference(entry, defaults, reference);
|
|
3879
|
+
const id = model.id.toLowerCase();
|
|
3880
|
+
// Kimi K3 is discovered but has no bundled/models.dev reference, so the
|
|
3881
|
+
// generic dynamic defaults would report it "Free" with no capabilities
|
|
3882
|
+
// (#5756). Stamp the official pricing/limits when the endpoint doesn't
|
|
3883
|
+
// carry them, and mark it reasoning + vision. K3 always reasons via
|
|
3884
|
+
// `reasoning_effort: "max"` and does NOT use the K2.x `thinking` block,
|
|
3885
|
+
// so its thinking config is the single-tier `max` scale — the wire path
|
|
3886
|
+
// routes it through `reasoning_effort` (see `buildOpenAICompat`).
|
|
3887
|
+
if (!reference && isKimiK3ModelId(id)) {
|
|
3888
|
+
const isZeroCost = model.cost.input === 0 && model.cost.output === 0 && model.cost.cacheRead === 0;
|
|
3889
|
+
return {
|
|
3890
|
+
...model,
|
|
3891
|
+
reasoning: true,
|
|
3892
|
+
input: ["text", "image"],
|
|
3893
|
+
cost: isZeroCost ? { ...MOONSHOT_KIMI_K3_COST } : model.cost,
|
|
3894
|
+
contextWindow: model.contextWindow ?? MOONSHOT_KIMI_K3_CONTEXT_WINDOW,
|
|
3895
|
+
maxTokens: model.maxTokens ?? MOONSHOT_KIMI_K3_MAX_TOKENS,
|
|
3896
|
+
thinking: model.thinking ?? { ...MOONSHOT_KIMI_K3_THINKING },
|
|
3897
|
+
};
|
|
3898
|
+
}
|
|
3899
|
+
// Moonshot's K2.x family (K2.5, K2.6, kimi-k2-thinking, …) is reasoning-capable
|
|
3900
|
+
// and vision-capable on the native API. Without these flags the openai-completions
|
|
3901
|
+
// path skips the z.ai-format `thinking` block, and Moonshot K2.6 stalls on first
|
|
3902
|
+
// turn because its endpoint expects an explicit `thinking: {type}` (#2113). Match
|
|
3903
|
+
// the bundled K2.5 metadata for every K2.x id we discover.
|
|
3904
|
+
const isKimiK2Reasoning = id.includes("thinking") || /(^|\/)kimi-k2(?:\.\d+)?(?:[-:]|$)/.test(id);
|
|
3905
|
+
const isVision = id.includes("vision") || id.includes("vl") || /(^|\/)kimi-k2(?:\.\d+)?(?:[-:]|$)/.test(id);
|
|
3906
|
+
return {
|
|
3907
|
+
...model,
|
|
3908
|
+
reasoning: isKimiK2Reasoning || model.reasoning,
|
|
3909
|
+
input: isVision ? ["text", "image"] : model.input,
|
|
3910
|
+
thinking:
|
|
3911
|
+
model.thinking ??
|
|
3912
|
+
(isKimiK2Reasoning
|
|
3913
|
+
? { mode: "effort", efforts: [Effort.Minimal, Effort.Low, Effort.Medium, Effort.High] }
|
|
3914
|
+
: undefined),
|
|
3915
|
+
};
|
|
3916
|
+
},
|
|
3917
|
+
});
|
|
3929
3918
|
}
|
|
3930
3919
|
|
|
3931
3920
|
// ---------------------------------------------------------------------------
|
|
@@ -5575,7 +5564,14 @@ const OPENCODE_ZEN_API_RESOLUTION = createOpenCodeApiResolution("https://opencod
|
|
|
5575
5564
|
// anthropic-style requests to /v1/messages and the gateway would return its
|
|
5576
5565
|
// `Page Not Found` HTML (issue #887 for the qwen/m2.7 entries; minimax-m3
|
|
5577
5566
|
// and minimax-m3-free added under #1617 for the same root cause).
|
|
5567
|
+
//
|
|
5568
|
+
// deepseek-v4-flash is the inverse case: it falls through to
|
|
5569
|
+
// openai-completions by default, but the Go gateway's
|
|
5570
|
+
// /zen/go/v1/chat/completions route does not work for this model while
|
|
5571
|
+
// /zen/go/v1/responses does (user-verified against the live gateway,
|
|
5572
|
+
// 2026-08-08; Flash only — deepseek-v4-pro serves fine on chat completions).
|
|
5578
5573
|
const OPENCODE_GO_API_RESOLUTION = createOpenCodeApiResolution("https://opencode.ai/zen/go", {
|
|
5574
|
+
"deepseek-v4-flash": "openai-responses",
|
|
5579
5575
|
"minimax-m2.7": "openai-completions",
|
|
5580
5576
|
"minimax-m3": "openai-completions",
|
|
5581
5577
|
"minimax-m3-free": "openai-completions",
|