@henjicc/ai-sdk 0.5.2 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +17 -17
- package/dist/capabilities/speech-recognition/bailian/module.js +15 -3
- package/dist/capabilities/speech-recognition/bailian/parse.js +9 -1
- package/dist/capabilities/speech-recognition/bailian/presets.d.ts +3 -1
- package/dist/capabilities/speech-recognition/bailian/presets.js +4 -0
- package/dist/capabilities/speech-recognition/bailian/realtime/presets.d.ts +2 -1
- package/dist/capabilities/speech-recognition/bailian/realtime/presets.js +2 -0
- package/dist/capabilities/speech-recognition/bailian/realtime/protocol.js +12 -4
- package/dist/capabilities/speech-recognition/bailian/realtime/types.d.ts +3 -0
- package/dist/capabilities/speech-recognition/bailian/types.d.ts +4 -0
- package/dist/capabilities/speech-recognition/index.d.ts +2 -0
- package/dist/catalog/index.js +39 -35
- package/dist/catalog/kie/happyhorse-1.1.model.d.ts +2 -0
- package/dist/catalog/kie/happyhorse-1.1.model.js +67 -0
- package/dist/catalog/volcengine/seedream-5.0-flash.model.d.ts +2 -0
- package/dist/catalog/volcengine/seedream-5.0-flash.model.js +7 -0
- package/dist/catalog/volcengine/seedream-5.0-pro.model.d.ts +0 -1
- package/dist/catalog/volcengine/seedream-5.0-pro.model.js +5 -147
- package/dist/catalog/volcengine/seedream-5.0.d.ts +11 -0
- package/dist/catalog/volcengine/seedream-5.0.js +153 -0
- package/dist/llm/bigmodel/profiles.d.ts +2 -0
- package/dist/llm/bigmodel/profiles.js +8 -1
- package/dist/llm/modelCatalogEntries.js +28 -6
- package/dist/llm/providerPresets.js +4 -3
- package/dist/llm/providerReasoningRequest.d.ts +2 -1
- package/dist/llm/providerReasoningRequest.js +27 -5
- package/dist/llm/sdk/mimoResponses.d.ts +4 -0
- package/dist/llm/sdk/mimoResponses.js +42 -0
- package/dist/llm/sdk/provider.js +4 -2
- package/dist/packs/models/kie/happyhorse-1.1.d.ts +6 -0
- package/dist/packs/models/kie/happyhorse-1.1.js +7 -0
- package/dist/packs/models/volcengine/seedream-5.0-flash.d.ts +6 -0
- package/dist/packs/models/volcengine/seedream-5.0-flash.js +7 -0
- package/dist/packs/provider-packs/kie.d.ts +1 -1
- package/dist/packs/provider-packs/kie.js +22 -21
- package/dist/packs/provider-packs/volcengine.d.ts +1 -1
- package/dist/packs/provider-packs/volcengine.js +4 -3
- package/docs/consumers.md +29 -15
- package/docs/llm-adaptation/README.md +8 -8
- package/docs/llm-adaptation//344/276/233/345/272/224/345/225/206/DeepSeek.md +4 -3
- package/docs/llm-adaptation//344/276/233/345/272/224/345/225/206/Kimi.md +3 -2
- package/docs/llm-adaptation//344/276/233/345/272/224/345/225/206//345/260/217/347/261/263MiMo.md +42 -1
- package/docs/model-adaptation/GLM-5.3-Flash/GLM-5.3-Flash_/346/231/272/350/260/261.md +6 -0
- package/docs/model-adaptation/HappyHorse-1.1/HappyHorse-1.1_KIE.md +27 -0
- package/docs/model-adaptation/README.md +11 -3
- package/docs/model-adaptation/Seedream-5.0-Flash/Seedream-5.0-Flash_/347/201/253/345/261/261/345/274/225/346/223/216.md +18 -0
- package/docs/model-adaptation//344/276/233/345/272/224/345/225/206//347/231/276/347/202/274.md +31 -0
- package/examples/form-renderer/package.json +1 -1
- package/examples/llm-chat/package.json +1 -1
- package/examples/minimal-node/package.json +1 -1
- package/package.json +258 -258
|
@@ -1,149 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const volcengineSeedream50ProModel = defineModel({
|
|
7
|
-
meta: {
|
|
8
|
-
id: 'volcengine-seedream-5.0-pro', canonicalModelId: 'seedream-5.0-pro', seriesId: 'seedream', seriesRank: 5.1,
|
|
9
|
-
provider: 'volcengine', type: 'image',
|
|
10
|
-
tags: ['text-to-image', 'image-to-image', 'supports-image-editing', 'supports-multi-image', 'supports-layer-decomposition', 'max-images-10', 'provider-volcengine'],
|
|
11
|
-
aliases: ['seedream-5-pro-official']
|
|
12
|
-
},
|
|
13
|
-
inputLimits: {
|
|
14
|
-
images: { max: 10 },
|
|
15
|
-
videos: { max: 0 },
|
|
16
|
-
rules: [
|
|
17
|
-
{ when: 'volcengineSeedream50ProMode === "layer-decomposition"', images: { min: 1, max: 1 } }
|
|
18
|
-
]
|
|
19
|
-
},
|
|
20
|
-
requirements: [
|
|
21
|
-
{
|
|
22
|
-
id: 'volcengine-seedream-5-pro-layer-single-image',
|
|
23
|
-
when: 'volcengineSeedream50ProMode === "layer-decomposition"',
|
|
24
|
-
require: { images: { exact: 1 } },
|
|
25
|
-
message: {
|
|
26
|
-
title: '需要一张图片',
|
|
27
|
-
message: '图层拆分模式必须且只能输入 1 张图片。',
|
|
28
|
-
type: 'warning'
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
params: [
|
|
33
|
-
{
|
|
34
|
-
id: 'volcengineSeedream50ProMode', type: 'dropdown', order: 1,
|
|
35
|
-
transferKey: 'layer-decomposition-mode',
|
|
36
|
-
default: 'generate',
|
|
37
|
-
options: [
|
|
38
|
-
{ value: 'generate' },
|
|
39
|
-
{ value: 'layer-decomposition' }
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
id: 'volcengineSeedream50ProAspectRatio', type: 'dropdown', order: 2,
|
|
44
|
-
default: 'smart',
|
|
45
|
-
visible: { condition: 'volcengineSeedream50ProMode !== "layer-decomposition"' },
|
|
46
|
-
options: [{ value: 'smart' }, ...ASPECT_RATIOS.map((ratio) => ({ value: ratio }))]
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
id: 'volcengineSeedream50ProResolution', type: 'dropdown', order: 3,
|
|
50
|
-
default: '2K',
|
|
51
|
-
visible: { condition: 'volcengineSeedream50ProMode !== "layer-decomposition"' },
|
|
52
|
-
options: ['1K', '1.5K', '2K'].map((value) => ({ value }))
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: 'volcengineSeedream50ProLayerSize', type: 'dropdown', order: 4,
|
|
56
|
-
transferKey: 'layer-output-size',
|
|
57
|
-
default: 'auto',
|
|
58
|
-
visible: { condition: 'volcengineSeedream50ProMode === "layer-decomposition"' },
|
|
59
|
-
options: [
|
|
60
|
-
{ value: 'auto' },
|
|
61
|
-
...['1K', '1.5K', '2K'].map((value) => ({ value }))
|
|
62
|
-
]
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
id: 'volcengineSeedream50ProBackground', type: 'dropdown', order: 5,
|
|
66
|
-
default: 'opaque',
|
|
67
|
-
visible: { condition: 'volcengineSeedream50ProMode !== "layer-decomposition"' },
|
|
68
|
-
options: [
|
|
69
|
-
{ value: 'opaque' },
|
|
70
|
-
{ value: 'transparent' }
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
endpoints: '/api/v3/images/generations',
|
|
75
|
-
request: {
|
|
76
|
-
builder: (params) => {
|
|
77
|
-
const filterSources = (value) => Array.isArray(value)
|
|
78
|
-
? value.filter((item) => typeof item === 'string' && item.trim().length > 0) : [];
|
|
79
|
-
const uploaded = filterSources(params.uploadedFilePaths);
|
|
80
|
-
const images = (uploaded.length > 0 ? uploaded : filterSources(params.images)).slice(0, 10);
|
|
81
|
-
if (params.volcengineSeedream50ProMode === 'layer-decomposition') {
|
|
82
|
-
if (images.length !== 1)
|
|
83
|
-
throw new Error('Seedream 5.0 Pro 图层拆分模式必须且只能输入 1 张图片');
|
|
84
|
-
const rawLayerSize = String(params.volcengineSeedream50ProLayerSize || 'auto');
|
|
85
|
-
return {
|
|
86
|
-
model: 'doubao-seedream-5-0-pro-260628',
|
|
87
|
-
prompt: typeof params.prompt === 'string' ? params.prompt : '',
|
|
88
|
-
image: images[0],
|
|
89
|
-
layer_decomposition: true,
|
|
90
|
-
size: ['auto', '1K', '1.5K', '2K'].includes(rawLayerSize) ? rawLayerSize : 'auto',
|
|
91
|
-
response_format: 'url',
|
|
92
|
-
watermark: false
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
const ratios = ['1:1', '4:3', '3:4', '16:9', '9:16', '3:2', '2:3', '21:9'];
|
|
96
|
-
const raw = String(params.volcengineSeedream50ProAspectRatio || 'smart');
|
|
97
|
-
const hint = typeof params.__firstImageRatio === 'number' && Number.isFinite(params.__firstImageRatio) && params.__firstImageRatio > 0 ? params.__firstImageRatio : 1;
|
|
98
|
-
let aspectRatio = ratios.includes(raw) ? raw : '1:1';
|
|
99
|
-
if (raw === 'smart' || raw === 'auto') {
|
|
100
|
-
let difference = Number.POSITIVE_INFINITY;
|
|
101
|
-
for (const candidate of ratios) {
|
|
102
|
-
const pair = candidate.split(':').map(Number);
|
|
103
|
-
const next = Math.abs(pair[0] / pair[1] - hint);
|
|
104
|
-
if (next < difference) {
|
|
105
|
-
difference = next;
|
|
106
|
-
aspectRatio = candidate;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
const pair = aspectRatio.split(':').map(Number);
|
|
111
|
-
const ratio = pair[0] / pair[1];
|
|
112
|
-
const resolution = String(params.volcengineSeedream50ProResolution || '2K');
|
|
113
|
-
const base = resolution === '2K' ? 2048 : (resolution === '1K' ? 1024 : 1536);
|
|
114
|
-
const width = Math.round(Math.sqrt(base * base * ratio) / 16) * 16;
|
|
115
|
-
const height = Math.round(Math.sqrt(base * base / ratio) / 16) * 16;
|
|
116
|
-
const body = {
|
|
117
|
-
model: 'doubao-seedream-5-0-pro-260628',
|
|
118
|
-
prompt: typeof params.prompt === 'string' ? params.prompt : '',
|
|
119
|
-
size: `${width}x${height}`,
|
|
120
|
-
background: params.volcengineSeedream50ProBackground === 'transparent' ? 'transparent' : 'opaque',
|
|
121
|
-
response_format: 'url', watermark: false
|
|
122
|
-
};
|
|
123
|
-
if (images.length > 0)
|
|
124
|
-
body.image = images;
|
|
125
|
-
return body;
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
response: {
|
|
129
|
-
structuredOutput: ({ metadata, params }) => params.volcengineSeedream50ProMode === 'layer-decomposition'
|
|
130
|
-
? parseSeedreamLayerStack('volcengine', metadata)
|
|
131
|
-
: undefined
|
|
132
|
-
},
|
|
133
|
-
pricing: {
|
|
134
|
-
currency: '¥',
|
|
135
|
-
calculator: (params) => {
|
|
136
|
-
if (params.volcengineSeedream50ProMode === 'layer-decomposition') {
|
|
137
|
-
// 输出层数及每层实际像素档位都由模型结果决定,提交前不能给出可靠总价。
|
|
138
|
-
return Number.NaN;
|
|
139
|
-
}
|
|
140
|
-
const output = params.volcengineSeedream50ProResolution === '1K' || params.volcengineSeedream50ProResolution === '1.5K'
|
|
141
|
-
? 0.3
|
|
142
|
-
: 0.6;
|
|
143
|
-
const inputs = countUploadedImages(params);
|
|
144
|
-
return output + Math.max(0, inputs - 1) * 0.02;
|
|
145
|
-
},
|
|
146
|
-
description: '生成/编辑:1K/1.5K ¥0.30、2K ¥0.60/张,第 2 张起输入图 +¥0.02/张;图层拆分按实际输出图层与像素档位计费,提交前总价暂不可估算(单层 1K/1.5K ¥0.15、2K/自动 ¥0.30)'
|
|
147
|
-
}
|
|
1
|
+
import { createSeedream50Model } from './seedream-5.0.js';
|
|
2
|
+
export const volcengineSeedream50ProModel = createSeedream50Model({
|
|
3
|
+
id: 'volcengine-seedream-5.0-pro', canonicalModelId: 'seedream-5.0-pro',
|
|
4
|
+
apiModel: 'doubao-seedream-5-0-pro-260628', paramPrefix: 'volcengineSeedream50Pro',
|
|
5
|
+
aliases: ['seedream-5-pro-official'],
|
|
148
6
|
});
|
|
149
7
|
export default volcengineSeedream50ProModel;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** 火山方舟官方 Seedream 5.0 Pro 图片生成与编辑模型(运行时契约) */
|
|
2
|
+
interface Seedream50Config {
|
|
3
|
+
id: string;
|
|
4
|
+
canonicalModelId: string;
|
|
5
|
+
apiModel: string;
|
|
6
|
+
paramPrefix: string;
|
|
7
|
+
aliases: string[];
|
|
8
|
+
flash?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function createSeedream50Model(config: Seedream50Config): import("../../index.js").ModelRuntimeDefinition;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/** 火山方舟官方 Seedream 5.0 Pro 图片生成与编辑模型(运行时契约) */
|
|
2
|
+
import { defineModel } from '../defineModel.js';
|
|
3
|
+
import { parseSeedreamLayerStack } from '../../structured-output/index.js';
|
|
4
|
+
import { countUploadedImages } from '../shared/mediaPresence.js';
|
|
5
|
+
const ASPECT_RATIOS = ['1:1', '4:3', '3:4', '16:9', '9:16', '3:2', '2:3', '21:9'];
|
|
6
|
+
export function createSeedream50Model(config) {
|
|
7
|
+
const key = (name) => config.paramPrefix + name;
|
|
8
|
+
return defineModel({
|
|
9
|
+
meta: {
|
|
10
|
+
id: config.id, canonicalModelId: config.canonicalModelId, seriesId: 'seedream', seriesRank: 5.1,
|
|
11
|
+
provider: 'volcengine', type: 'image',
|
|
12
|
+
tags: ['text-to-image', 'image-to-image', 'supports-image-editing', 'supports-multi-image', 'supports-layer-decomposition', 'max-images-10', 'provider-volcengine'],
|
|
13
|
+
aliases: config.aliases
|
|
14
|
+
},
|
|
15
|
+
inputLimits: {
|
|
16
|
+
images: { max: 10 },
|
|
17
|
+
videos: { max: 0 },
|
|
18
|
+
rules: [
|
|
19
|
+
{ when: `${key('Mode')} === "layer-decomposition"`, images: { min: 1, max: 1 } }
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
requirements: [
|
|
23
|
+
{
|
|
24
|
+
id: `${config.id}-layer-single-image`,
|
|
25
|
+
when: `${key('Mode')} === "layer-decomposition"`,
|
|
26
|
+
require: { images: { exact: 1 } },
|
|
27
|
+
message: {
|
|
28
|
+
title: '需要一张图片',
|
|
29
|
+
message: '图层拆分模式必须且只能输入 1 张图片。',
|
|
30
|
+
type: 'warning'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
params: [
|
|
35
|
+
{
|
|
36
|
+
id: key('Mode'), type: 'dropdown', order: 1,
|
|
37
|
+
transferKey: 'layer-decomposition-mode',
|
|
38
|
+
default: 'generate',
|
|
39
|
+
options: [
|
|
40
|
+
{ value: 'generate' },
|
|
41
|
+
{ value: 'layer-decomposition' }
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: key('AspectRatio'), type: 'dropdown', order: 2,
|
|
46
|
+
default: 'smart',
|
|
47
|
+
visible: { condition: `${key('Mode')} !== "layer-decomposition"` },
|
|
48
|
+
options: [{ value: 'smart' }, ...ASPECT_RATIOS.map((ratio) => ({ value: ratio }))]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: key('Resolution'), type: 'dropdown', order: 3,
|
|
52
|
+
default: '2K',
|
|
53
|
+
visible: { condition: `${key('Mode')} !== "layer-decomposition"` },
|
|
54
|
+
options: ['1K', '1.5K', '2K'].map((value) => ({ value }))
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: key('LayerSize'), type: 'dropdown', order: 4,
|
|
58
|
+
transferKey: 'layer-output-size',
|
|
59
|
+
default: 'auto',
|
|
60
|
+
visible: { condition: `${key('Mode')} === "layer-decomposition"` },
|
|
61
|
+
options: [
|
|
62
|
+
{ value: 'auto' },
|
|
63
|
+
...['1K', '1.5K', '2K'].map((value) => ({ value }))
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: key('Background'), type: 'dropdown', order: 5,
|
|
68
|
+
default: 'opaque',
|
|
69
|
+
visible: { condition: `${key('Mode')} !== "layer-decomposition"` },
|
|
70
|
+
options: [
|
|
71
|
+
{ value: 'opaque' },
|
|
72
|
+
{ value: 'transparent' }
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
endpoints: '/api/v3/images/generations',
|
|
77
|
+
request: {
|
|
78
|
+
builder: (params) => {
|
|
79
|
+
const filterSources = (value) => Array.isArray(value)
|
|
80
|
+
? value.filter((item) => typeof item === 'string' && item.trim().length > 0) : [];
|
|
81
|
+
const uploaded = filterSources(params.uploadedFilePaths);
|
|
82
|
+
const images = uploaded.length > 0 ? uploaded : filterSources(params.images);
|
|
83
|
+
if (images.length > 10)
|
|
84
|
+
throw new Error('Seedream 5.0 最多接受 10 张图片');
|
|
85
|
+
if (params[key('Mode')] === 'layer-decomposition') {
|
|
86
|
+
if (images.length !== 1)
|
|
87
|
+
throw new Error('Seedream 5.0 Pro 图层拆分模式必须且只能输入 1 张图片');
|
|
88
|
+
const rawLayerSize = String(params[key('LayerSize')] || 'auto');
|
|
89
|
+
return {
|
|
90
|
+
model: config.apiModel,
|
|
91
|
+
prompt: typeof params.prompt === 'string' ? params.prompt : '',
|
|
92
|
+
image: images[0],
|
|
93
|
+
layer_decomposition: true,
|
|
94
|
+
size: ['auto', '1K', '1.5K', '2K'].includes(rawLayerSize) ? rawLayerSize : 'auto',
|
|
95
|
+
response_format: 'url',
|
|
96
|
+
watermark: false
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const ratios = ['1:1', '4:3', '3:4', '16:9', '9:16', '3:2', '2:3', '21:9'];
|
|
100
|
+
const raw = String(params[key('AspectRatio')] || 'smart');
|
|
101
|
+
const hint = typeof params.__firstImageRatio === 'number' && Number.isFinite(params.__firstImageRatio) && params.__firstImageRatio > 0 ? params.__firstImageRatio : 1;
|
|
102
|
+
let aspectRatio = ratios.includes(raw) ? raw : '1:1';
|
|
103
|
+
if (raw === 'smart' || raw === 'auto') {
|
|
104
|
+
let difference = Number.POSITIVE_INFINITY;
|
|
105
|
+
for (const candidate of ratios) {
|
|
106
|
+
const pair = candidate.split(':').map(Number);
|
|
107
|
+
const next = Math.abs(pair[0] / pair[1] - hint);
|
|
108
|
+
if (next < difference) {
|
|
109
|
+
difference = next;
|
|
110
|
+
aspectRatio = candidate;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const pair = aspectRatio.split(':').map(Number);
|
|
115
|
+
const ratio = pair[0] / pair[1];
|
|
116
|
+
const resolution = String(params[key('Resolution')] || '2K');
|
|
117
|
+
const base = resolution === '2K' ? 2048 : (resolution === '1K' ? 1024 : 1536);
|
|
118
|
+
const width = Math.round(Math.sqrt(base * base * ratio) / 16) * 16;
|
|
119
|
+
const height = Math.round(Math.sqrt(base * base / ratio) / 16) * 16;
|
|
120
|
+
const body = {
|
|
121
|
+
model: config.apiModel,
|
|
122
|
+
prompt: typeof params.prompt === 'string' ? params.prompt : '',
|
|
123
|
+
size: `${width}x${height}`,
|
|
124
|
+
background: params[key('Background')] === 'transparent' ? 'transparent' : 'opaque',
|
|
125
|
+
response_format: 'url', watermark: false
|
|
126
|
+
};
|
|
127
|
+
if (images.length > 0)
|
|
128
|
+
body.image = images;
|
|
129
|
+
return body;
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
response: {
|
|
133
|
+
structuredOutput: ({ metadata, params }) => params[key('Mode')] === 'layer-decomposition'
|
|
134
|
+
? parseSeedreamLayerStack('volcengine', metadata)
|
|
135
|
+
: undefined
|
|
136
|
+
},
|
|
137
|
+
pricing: {
|
|
138
|
+
currency: '¥',
|
|
139
|
+
calculator: (params) => {
|
|
140
|
+
if (params[key('Mode')] === 'layer-decomposition') {
|
|
141
|
+
// 输出层数及每层实际像素档位都由模型结果决定,提交前不能给出可靠总价。
|
|
142
|
+
return Number.NaN;
|
|
143
|
+
}
|
|
144
|
+
const output = params[key('Resolution')] === '1K' || params[key('Resolution')] === '1.5K'
|
|
145
|
+
? 0.3
|
|
146
|
+
: 0.6;
|
|
147
|
+
const inputs = countUploadedImages(params);
|
|
148
|
+
return config.flash ? 0.12 : output + Math.max(0, inputs - 1) * 0.02;
|
|
149
|
+
},
|
|
150
|
+
description: config.flash ? '输入图片免费;输出 ¥0.12/张,图层拆分按实际输出计费,提交前总价暂不可估算' : '生成/编辑:1K/1.5K ¥0.30、2K ¥0.60/张,第 2 张起输入图 +¥0.02/张;图层拆分按实际输出图层与像素档位计费,提交前总价暂不可估算(单层 1K/1.5K ¥0.15、2K/自动 ¥0.30)'
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
@@ -19,3 +19,5 @@ export interface BigmodelTokenPricing {
|
|
|
19
19
|
}
|
|
20
20
|
export declare const BIGMODEL_ENDPOINT_PROFILE_FAMILY: LlmEndpointProfileFamily;
|
|
21
21
|
export declare const BIGMODEL_GLM_5_3_FLASH_PRICING: Readonly<Record<'cn' | 'global', BigmodelTokenPricing>>;
|
|
22
|
+
/** 中国大陆常规单价,2026-09-24 核对官方价格页;不把限时免费缓存写入算作永久价格。 */
|
|
23
|
+
export declare const BIGMODEL_GLM_5_3_FLASHX_PRICING: Readonly<BigmodelTokenPricing>;
|
|
@@ -21,7 +21,7 @@ export const BIGMODEL_ENDPOINT_PROFILE_FAMILY = {
|
|
|
21
21
|
websiteUrl: BIGMODEL_CN_METADATA.websiteUrl,
|
|
22
22
|
apiKeyUrl: BIGMODEL_CN_METADATA.apiKeyUrl,
|
|
23
23
|
defaultCredentialId: BIGMODEL_CN_CREDENTIAL_ID,
|
|
24
|
-
modelIds: ['glm-5.3', 'glm-5v-turbo', 'glm-5.3-flash'],
|
|
24
|
+
modelIds: ['glm-5.3', 'glm-5v-turbo', 'glm-5.3-flash', 'glm-5.3-flashx'],
|
|
25
25
|
docs: 'docs/llm-adaptation/供应商/智谱GLM.md',
|
|
26
26
|
},
|
|
27
27
|
{
|
|
@@ -63,3 +63,10 @@ export const BIGMODEL_GLM_5_3_FLASH_PRICING = {
|
|
|
63
63
|
},
|
|
64
64
|
},
|
|
65
65
|
};
|
|
66
|
+
/** 中国大陆常规单价,2026-09-24 核对官方价格页;不把限时免费缓存写入算作永久价格。 */
|
|
67
|
+
export const BIGMODEL_GLM_5_3_FLASHX_PRICING = {
|
|
68
|
+
currency: 'CNY',
|
|
69
|
+
inputPerMillionTokens: 2,
|
|
70
|
+
outputPerMillionTokens: 7,
|
|
71
|
+
cacheReadPerMillionTokens: 0.57,
|
|
72
|
+
};
|
|
@@ -144,21 +144,24 @@ export const LLM_MODEL_CATALOG_ENTRIES = [
|
|
|
144
144
|
docs: 'docs/llm-adaptation/供应商/Kimi.md',
|
|
145
145
|
},
|
|
146
146
|
// ---------------- 智谱 GLM ----------------
|
|
147
|
-
|
|
148
|
-
id: 'glm-5.3-flash',
|
|
149
|
-
displayName: 'GLM-5.3-
|
|
147
|
+
...[
|
|
148
|
+
{ id: 'glm-5.3-flash', displayName: 'GLM-5.3-Flash' },
|
|
149
|
+
{ id: 'glm-5.3-flashx', displayName: 'GLM-5.3-FlashX' },
|
|
150
|
+
].map(model => ({
|
|
151
|
+
...model,
|
|
150
152
|
vendor: '智谱',
|
|
151
153
|
input: { image: true, video: true, audio: false, file: true },
|
|
152
154
|
toolCall: true,
|
|
153
155
|
parallelTools: false,
|
|
154
|
-
structuredOutputMode: '
|
|
156
|
+
structuredOutputMode: 'json',
|
|
157
|
+
structuredOutputWithReasoning: true,
|
|
155
158
|
reasoning: true,
|
|
156
159
|
sampling: true,
|
|
157
160
|
contextWindow: 1_000_000,
|
|
158
161
|
maxOutputTokens: 131_072,
|
|
159
|
-
note: '
|
|
162
|
+
note: '始终开启思考;支持 JSON 输出。文件只接受宿主已持有的 URL/内联内容,不声明上传与 file_id。FlashX 仅核验中国大陆端点。',
|
|
160
163
|
docs: 'docs/model-adaptation/GLM-5.3-Flash/GLM-5.3-Flash_智谱.md',
|
|
161
|
-
},
|
|
164
|
+
})),
|
|
162
165
|
{
|
|
163
166
|
id: 'glm-5.3',
|
|
164
167
|
displayName: 'GLM-5.3',
|
|
@@ -239,6 +242,25 @@ export const LLM_MODEL_CATALOG_ENTRIES = [
|
|
|
239
242
|
docs: 'docs/llm-adaptation/供应商/火山引擎.md',
|
|
240
243
|
},
|
|
241
244
|
// ---------------- 小米 MiMo ----------------
|
|
245
|
+
...[
|
|
246
|
+
{ id: 'mimo-v2.6-pro', displayName: 'MiMo-V2.6-Pro' },
|
|
247
|
+
{ id: 'mimo-v2.6-flash', displayName: 'MiMo-V2.6-Flash' },
|
|
248
|
+
{ id: 'mimo-v2.6-pro-ultraspeed', displayName: 'MiMo-V2.6-Pro-UltraSpeed' },
|
|
249
|
+
].map(model => ({
|
|
250
|
+
...model,
|
|
251
|
+
vendor: '小米',
|
|
252
|
+
input: { image: true, video: true, audio: true },
|
|
253
|
+
toolCall: true,
|
|
254
|
+
parallelTools: false,
|
|
255
|
+
structuredOutputMode: 'json',
|
|
256
|
+
reasoning: true,
|
|
257
|
+
sampling: true,
|
|
258
|
+
contextWindow: 1_000_000,
|
|
259
|
+
maxOutputTokens: 131_072,
|
|
260
|
+
apiProtocols: ['openai-responses', 'openai-compatible'],
|
|
261
|
+
note: '支持 Chat Completions 与 Responses;思考只有开关,无强度分级。UltraSpeed 需要联系供应商开通。',
|
|
262
|
+
docs: 'docs/llm-adaptation/供应商/小米MiMo.md',
|
|
263
|
+
})),
|
|
242
264
|
{
|
|
243
265
|
id: 'mimo-v2.5-pro',
|
|
244
266
|
displayName: 'MiMo-V2.5-Pro',
|
|
@@ -85,7 +85,7 @@ export const LLM_PROVIDER_PRESETS = [
|
|
|
85
85
|
baseUrl: 'https://open.bigmodel.cn/api/paas/v4',
|
|
86
86
|
reasoning: { enabled: true, effort: 'max' },
|
|
87
87
|
reasoningConfigurable: true,
|
|
88
|
-
modelIds: ['glm-5.3', 'glm-5v-turbo', 'glm-5.3-flash'],
|
|
88
|
+
modelIds: ['glm-5.3', 'glm-5v-turbo', 'glm-5.3-flash', 'glm-5.3-flashx'],
|
|
89
89
|
responsesModelIds: ['glm-5.3'],
|
|
90
90
|
websiteUrl: providerMetadata('bigmodel').websiteUrl,
|
|
91
91
|
apiKeyUrl: providerMetadata('bigmodel').apiKeyUrl,
|
|
@@ -100,11 +100,12 @@ export const LLM_PROVIDER_PRESETS = [
|
|
|
100
100
|
baseUrl: 'https://api.xiaomimimo.com/v1',
|
|
101
101
|
reasoning: { enabled: true, effort: 'high' },
|
|
102
102
|
reasoningConfigurable: true,
|
|
103
|
-
modelIds: ['mimo-v2.
|
|
103
|
+
modelIds: ['mimo-v2.6-pro', 'mimo-v2.6-flash'],
|
|
104
|
+
responsesModelIds: ['mimo-v2.6-pro', 'mimo-v2.6-flash', 'mimo-v2.6-pro-ultraspeed'],
|
|
104
105
|
websiteUrl: providerMetadata('mimo').websiteUrl,
|
|
105
106
|
apiKeyUrl: providerMetadata('mimo').apiKeyUrl,
|
|
106
107
|
docs: 'docs/llm-adaptation/供应商/小米MiMo.md',
|
|
107
|
-
note: '
|
|
108
|
+
note: '2.5 系列将于北京时间 2026-10-21 10:00 下线;已有模型选择保持不变,请主动迁移到 2.6。UltraSpeed 需要另行开通。',
|
|
108
109
|
},
|
|
109
110
|
{
|
|
110
111
|
providerId: 'minimax',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LlmReasoningConfig } from './reasoning.js';
|
|
2
|
+
import type { LlmApiProtocol } from './providerProtocolCore.js';
|
|
2
3
|
/** 该供应商是否有专门登记的思考参数写法;false 表示走通用兜底。 */
|
|
3
4
|
export declare function hasProviderReasoningRule(providerId: string, adapter?: string): boolean;
|
|
4
|
-
export declare function applyProviderReasoningRequestBody(providerId: string, adapter: string | undefined, body: Record<string, unknown>, reasoning: LlmReasoningConfig | undefined): Record<string, unknown>;
|
|
5
|
+
export declare function applyProviderReasoningRequestBody(providerId: string, adapter: string | undefined, body: Record<string, unknown>, reasoning: LlmReasoningConfig | undefined, protocol?: LlmApiProtocol): Record<string, unknown>;
|
|
@@ -32,6 +32,7 @@ function pickEffort(effort, supported) {
|
|
|
32
32
|
return picked;
|
|
33
33
|
}
|
|
34
34
|
const PROVIDER_REASONING_BODY = {
|
|
35
|
+
mimo: reasoning => ({ thinking: { type: reasoning.enabled ? 'enabled' : 'disabled' } }),
|
|
35
36
|
// 硅基流动的思考开关与原厂不同;强度字段只发送给端点文档明确列举的模型。
|
|
36
37
|
siliconflow: (reasoning, body) => ({
|
|
37
38
|
enable_thinking: reasoning.enabled,
|
|
@@ -75,8 +76,6 @@ const PROVIDER_REASONING_BODY = {
|
|
|
75
76
|
include_reasoning: true,
|
|
76
77
|
}
|
|
77
78
|
: { include_reasoning: false }),
|
|
78
|
-
// 小米 MiMo、MiniMax:官方文档只约定了思考内容怎么回传,没有给出请求侧的开关或强度字段,
|
|
79
|
-
// 因此不下发任何字段。等文档补齐再加,不要凭字段名相似猜。
|
|
80
79
|
};
|
|
81
80
|
/**
|
|
82
81
|
* 未登记供应商的兜底:只发 OpenAI 事实标准字段,关闭时什么都不发。
|
|
@@ -101,11 +100,34 @@ function resolveReasoningKey(providerId, adapter) {
|
|
|
101
100
|
export function hasProviderReasoningRule(providerId, adapter) {
|
|
102
101
|
return resolveReasoningKey(providerId, adapter) !== null;
|
|
103
102
|
}
|
|
104
|
-
export function applyProviderReasoningRequestBody(providerId, adapter, body, reasoning) {
|
|
105
|
-
if (!reasoning)
|
|
106
|
-
return body;
|
|
103
|
+
export function applyProviderReasoningRequestBody(providerId, adapter, body, reasoning, protocol = 'openai-compatible') {
|
|
107
104
|
const key = resolveReasoningKey(providerId, adapter);
|
|
105
|
+
if (!reasoning && key !== 'mimo')
|
|
106
|
+
return body;
|
|
107
|
+
reasoning ??= { enabled: true, effort: 'high' };
|
|
108
108
|
const build = key ? PROVIDER_REASONING_BODY[key] : defaultReasoningBody;
|
|
109
|
+
if (key === 'mimo') {
|
|
110
|
+
const { thinking: _thinking, reasoning_effort: _effort, reasoning: _reasoning, ...clean } = body;
|
|
111
|
+
// MiMo 思考时采样参数固定为 1 / 0.95;省略可避免用户采样设置造成 400。
|
|
112
|
+
if (reasoning.enabled) {
|
|
113
|
+
delete clean.temperature;
|
|
114
|
+
delete clean.top_p;
|
|
115
|
+
}
|
|
116
|
+
if (protocol === 'openai-responses' && Array.isArray(clean.input)) {
|
|
117
|
+
clean.input = clean.input.map((item) => {
|
|
118
|
+
if (!item || typeof item !== 'object' || Array.isArray(item))
|
|
119
|
+
return item;
|
|
120
|
+
const value = item;
|
|
121
|
+
if (value.type !== 'reasoning' || !Array.isArray(value.summary))
|
|
122
|
+
return value;
|
|
123
|
+
const { summary, encrypted_content: _encrypted, ...rest } = value;
|
|
124
|
+
return { ...rest, content: summary.map((part) => ({ type: 'reasoning_text', text: part.text })) };
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return protocol === 'openai-responses'
|
|
128
|
+
? { ...clean, reasoning: { effort: reasoning.enabled ? 'high' : 'none' } }
|
|
129
|
+
: { ...clean, ...build(reasoning, clean) };
|
|
130
|
+
}
|
|
109
131
|
if (key === 'siliconflow') {
|
|
110
132
|
const { thinking: _thinking, reasoning_effort: _effort, ...clean } = body;
|
|
111
133
|
return { ...clean, ...build(reasoning, clean) };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { EventSourceParserStream } from '@ai-sdk/provider-utils';
|
|
2
|
+
/** MiMo 返回完整 reasoning_text;OpenAI adapter 只识别 summary 事件。
|
|
3
|
+
* 只在 MiMo Responses 边界改写事件名/索引,不丢弃正文、工具或 usage。
|
|
4
|
+
*/
|
|
5
|
+
export function adaptMimoResponses(response) {
|
|
6
|
+
if (!response.ok || !response.body || !response.headers.get('content-type')?.includes('text/event-stream'))
|
|
7
|
+
return response;
|
|
8
|
+
let terminal = false;
|
|
9
|
+
const stream = response.body
|
|
10
|
+
.pipeThrough(new TextDecoderStream())
|
|
11
|
+
.pipeThrough(new EventSourceParserStream())
|
|
12
|
+
.pipeThrough(new TransformStream({
|
|
13
|
+
transform(event, controller) {
|
|
14
|
+
if (!event.data || event.data === '[DONE]')
|
|
15
|
+
return;
|
|
16
|
+
const value = JSON.parse(event.data);
|
|
17
|
+
if (['response.completed', 'response.incomplete', 'response.failed', 'error'].includes(String(value.type)))
|
|
18
|
+
terminal = true;
|
|
19
|
+
if (value.type === 'response.reasoning_text.delta') {
|
|
20
|
+
value.type = 'response.reasoning_summary_text.delta';
|
|
21
|
+
value.summary_index = value.content_index ?? 0;
|
|
22
|
+
}
|
|
23
|
+
else if (value.type === 'response.content_part.added' || value.type === 'response.content_part.done') {
|
|
24
|
+
const part = value.part;
|
|
25
|
+
if (part?.type === 'reasoning_text') {
|
|
26
|
+
value.type = value.type === 'response.content_part.added'
|
|
27
|
+
? 'response.reasoning_summary_part.added' : 'response.reasoning_summary_part.done';
|
|
28
|
+
value.summary_index = value.content_index ?? 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
controller.enqueue(new TextEncoder().encode(`data: ${JSON.stringify(value)}\n\n`));
|
|
32
|
+
},
|
|
33
|
+
flush() {
|
|
34
|
+
if (!terminal)
|
|
35
|
+
throw new Error('[provider_response_incomplete] MiMo Responses stream ended before a terminal event');
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
38
|
+
const headers = new Headers(response.headers);
|
|
39
|
+
headers.delete('content-length');
|
|
40
|
+
headers.delete('content-encoding');
|
|
41
|
+
return new Response(stream, { status: response.status, statusText: response.statusText, headers });
|
|
42
|
+
}
|
package/dist/llm/sdk/provider.js
CHANGED
|
@@ -3,6 +3,7 @@ import { createOpenAI } from '@ai-sdk/openai';
|
|
|
3
3
|
import { fetchProvider } from '../../providers/provider-fetch.js';
|
|
4
4
|
import { applyProviderRequestBodyQuirks, resolveProviderExtraAuthHeaders, } from '../providerProtocol.js';
|
|
5
5
|
import { applyProviderReasoningRequestBody } from '../providerReasoningRequest.js';
|
|
6
|
+
import { adaptMimoResponses } from './mimoResponses.js';
|
|
6
7
|
import { resolveOpenAiCompatibleEndpoint, resolvePpioChatEndpoint } from '../streaming.js';
|
|
7
8
|
import { modelStepProviderAdapters, } from './providerAdapter.js';
|
|
8
9
|
import { getLlmEndpointProfileFamily, resolveLlmEndpointIdentity } from '../endpointProfiles.js';
|
|
@@ -92,7 +93,7 @@ function createOpenAiResponsesLanguageModel(input, apiKey, httpTrace, transport)
|
|
|
92
93
|
captureHttp: httpTrace?.captureHttp === true,
|
|
93
94
|
captureDeepSeekUsage: adapter === 'deepseek',
|
|
94
95
|
transformRequestBody: body => applyProviderRequestBodyQuirks(identity.providerFamilyId, input.capabilities.reasoning
|
|
95
|
-
? applyProviderReasoningRequestBody(identity.providerFamilyId, adapter, body, input.reasoning)
|
|
96
|
+
? applyProviderReasoningRequestBody(identity.providerFamilyId, adapter, body, input.reasoning, 'openai-responses')
|
|
96
97
|
: body),
|
|
97
98
|
}),
|
|
98
99
|
});
|
|
@@ -159,7 +160,8 @@ function createModelStepFetch(providerId, trace, transport, options) {
|
|
|
159
160
|
trace.deepSeekUsage = usage;
|
|
160
161
|
}).catch(() => undefined);
|
|
161
162
|
}
|
|
162
|
-
return
|
|
163
|
+
return providerId === 'mimo' && /\/responses(?:\?|$)/.test(request.url)
|
|
164
|
+
? adaptMimoResponses(response) : response;
|
|
163
165
|
}
|
|
164
166
|
catch (error) {
|
|
165
167
|
if (options.captureHttp && trace) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** 由 scripts/generate-catalog-index.cjs 自动生成;`pack` 是完整执行单元,`model` 仅供低层目录用途。 */
|
|
2
|
+
import model from '../../../catalog/kie/happyhorse-1.1.model.js';
|
|
3
|
+
import type { GenerationClientProviderRegistration, GenerationPack } from '../../../generation/core.js';
|
|
4
|
+
export { model };
|
|
5
|
+
export declare const provider: GenerationClientProviderRegistration;
|
|
6
|
+
export declare const pack: GenerationPack;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** 由 scripts/generate-catalog-index.cjs 自动生成;`pack` 是完整执行单元,`model` 仅供低层目录用途。 */
|
|
2
|
+
import model from '../../../catalog/kie/happyhorse-1.1.model.js';
|
|
3
|
+
import * as adapter from '../../../providers/kie.js';
|
|
4
|
+
import { preprocess } from '../../../upload/provider-preprocessors/kie.js';
|
|
5
|
+
export { model };
|
|
6
|
+
export const provider = { id: 'kie', adapter, preprocess };
|
|
7
|
+
export const pack = { models: [model], providers: [provider] };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** 由 scripts/generate-catalog-index.cjs 自动生成;`pack` 是完整执行单元,`model` 仅供低层目录用途。 */
|
|
2
|
+
import model from '../../../catalog/volcengine/seedream-5.0-flash.model.js';
|
|
3
|
+
import type { GenerationClientProviderRegistration, GenerationPack } from '../../../generation/core.js';
|
|
4
|
+
export { model };
|
|
5
|
+
export declare const provider: GenerationClientProviderRegistration;
|
|
6
|
+
export declare const pack: GenerationPack;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** 由 scripts/generate-catalog-index.cjs 自动生成;`pack` 是完整执行单元,`model` 仅供低层目录用途。 */
|
|
2
|
+
import model from '../../../catalog/volcengine/seedream-5.0-flash.model.js';
|
|
3
|
+
import * as adapter from '../../../providers/volcengine.js';
|
|
4
|
+
import { preprocess } from '../../../upload/provider-preprocessors/data-uri.js';
|
|
5
|
+
export { model };
|
|
6
|
+
export const provider = { id: 'volcengine', adapter, preprocess };
|
|
7
|
+
export const pack = { models: [model], providers: [provider] };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { GenerationPack } from '../../generation/core.js';
|
|
2
|
-
export declare const models: readonly [import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition];
|
|
2
|
+
export declare const models: readonly [import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition, import("../../index.js").ModelRuntimeDefinition];
|
|
3
3
|
export declare const pack: GenerationPack;
|
|
4
4
|
export default pack;
|