@byte_fluffy/nexra-sdk 0.1.0-alpha.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/README.md +35 -0
- package/dist/catalog-mytCeh5t.d.ts +313 -0
- package/dist/catalog.d.ts +1 -0
- package/dist/catalog.js +10 -0
- package/dist/chunk-ADKRTC6X.js +1512 -0
- package/dist/chunk-FCH5IQP5.js +34 -0
- package/dist/decimal.d.ts +4 -0
- package/dist/decimal.js +8 -0
- package/dist/index.d.ts +1006 -0
- package/dist/index.js +1428 -0
- package/package.json +44 -0
|
@@ -0,0 +1,1512 @@
|
|
|
1
|
+
// src/generated/public-catalog.generated.json
|
|
2
|
+
var public_catalog_generated_default = [
|
|
3
|
+
{
|
|
4
|
+
id: "bytedance/doubao-seedream-5-0-260128",
|
|
5
|
+
contractVersion: 2,
|
|
6
|
+
developer: "bytedance",
|
|
7
|
+
displayName: "Doubao Seedream 5.0 Lite",
|
|
8
|
+
summary: "\u652F\u6301\u56FE\u50CF\u751F\u6210\u4E0E\u591A\u56FE\u7F16\u8F91\u3002",
|
|
9
|
+
kind: "image",
|
|
10
|
+
family: "Doubao Seedream Lite",
|
|
11
|
+
versionLabel: "5.0",
|
|
12
|
+
aliases: [
|
|
13
|
+
"seedream-5-0",
|
|
14
|
+
"seedream-5.0",
|
|
15
|
+
"volcengine/doubao-seedream-5-0-260128"
|
|
16
|
+
],
|
|
17
|
+
capabilities: {
|
|
18
|
+
inputModalities: [
|
|
19
|
+
"text",
|
|
20
|
+
"image"
|
|
21
|
+
],
|
|
22
|
+
outputModalities: [
|
|
23
|
+
"image"
|
|
24
|
+
],
|
|
25
|
+
inputModes: [
|
|
26
|
+
"text-to-image",
|
|
27
|
+
"image-to-image"
|
|
28
|
+
],
|
|
29
|
+
features: []
|
|
30
|
+
},
|
|
31
|
+
operations: [
|
|
32
|
+
{
|
|
33
|
+
operation: "image.generate",
|
|
34
|
+
inputModalities: [
|
|
35
|
+
"text",
|
|
36
|
+
"image"
|
|
37
|
+
],
|
|
38
|
+
outputModalities: [
|
|
39
|
+
"image"
|
|
40
|
+
],
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: "object",
|
|
43
|
+
properties: {
|
|
44
|
+
model: {
|
|
45
|
+
type: "string",
|
|
46
|
+
minLength: 1,
|
|
47
|
+
title: "\u6A21\u578B ID",
|
|
48
|
+
description: "Nexra \u516C\u5171\u6A21\u578B ID\uFF0C\u5FC5\u987B\u4E0E\u5916\u5C42 modelId \u76F8\u540C\u3002",
|
|
49
|
+
"x-ui": {
|
|
50
|
+
order: 0
|
|
51
|
+
},
|
|
52
|
+
examples: [
|
|
53
|
+
"bytedance/doubao-seedream-5-0-260128"
|
|
54
|
+
],
|
|
55
|
+
const: "bytedance/doubao-seedream-5-0-260128"
|
|
56
|
+
},
|
|
57
|
+
prompt: {
|
|
58
|
+
type: "string",
|
|
59
|
+
minLength: 1,
|
|
60
|
+
title: "\u63D0\u793A\u8BCD",
|
|
61
|
+
description: "\u63CF\u8FF0\u751F\u6210\u6216\u7F16\u8F91\u8981\u6C42\u3002",
|
|
62
|
+
"x-ui": {
|
|
63
|
+
order: 1,
|
|
64
|
+
control: "textarea"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
image: {
|
|
68
|
+
title: "\u53C2\u8003\u56FE\u7247",
|
|
69
|
+
description: "\u56FE\u7247 URL \u6216\u5B8C\u6574 Data URL\u3002\u6700\u591A 14 \u5F20\u3002",
|
|
70
|
+
anyOf: [
|
|
71
|
+
{
|
|
72
|
+
type: "string",
|
|
73
|
+
format: "uri",
|
|
74
|
+
minLength: 1
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: "array",
|
|
78
|
+
items: {
|
|
79
|
+
type: "string",
|
|
80
|
+
format: "uri",
|
|
81
|
+
minLength: 1
|
|
82
|
+
},
|
|
83
|
+
minItems: 1,
|
|
84
|
+
maxItems: 14
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"x-ui": {
|
|
88
|
+
order: 2
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
size: {
|
|
92
|
+
type: "string",
|
|
93
|
+
minLength: 1,
|
|
94
|
+
title: "\u8F93\u51FA\u5C3A\u5BF8",
|
|
95
|
+
description: "\u5C3A\u5BF8\u6863\u4F4D 2K\u30013K\u30014K\uFF0C\u6216\u5BBD\xD7\u9AD8\u50CF\u7D20\uFF0C\u5982 2048x2048\u3002",
|
|
96
|
+
examples: [
|
|
97
|
+
"2K",
|
|
98
|
+
"3K",
|
|
99
|
+
"4K",
|
|
100
|
+
"2048x2048"
|
|
101
|
+
],
|
|
102
|
+
"x-ui": {
|
|
103
|
+
order: 3
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
response_format: {
|
|
107
|
+
type: "string",
|
|
108
|
+
enum: [
|
|
109
|
+
"url",
|
|
110
|
+
"b64_json"
|
|
111
|
+
],
|
|
112
|
+
title: "\u54CD\u5E94\u56FE\u7247\u5F62\u5F0F",
|
|
113
|
+
description: "url \u8FD4\u56DE\u56FE\u7247\u5730\u5740\uFF0Cb64_json \u8FD4\u56DE Base64 \u56FE\u7247\u6570\u636E\u3002"
|
|
114
|
+
},
|
|
115
|
+
output_format: {
|
|
116
|
+
type: "string",
|
|
117
|
+
enum: [
|
|
118
|
+
"png",
|
|
119
|
+
"jpeg"
|
|
120
|
+
],
|
|
121
|
+
title: "\u56FE\u7247\u683C\u5F0F"
|
|
122
|
+
},
|
|
123
|
+
watermark: {
|
|
124
|
+
type: "boolean",
|
|
125
|
+
title: "\u6C34\u5370",
|
|
126
|
+
description: "\u662F\u5426\u6DFB\u52A0\u6C34\u5370\u3002"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
required: [
|
|
130
|
+
"model",
|
|
131
|
+
"prompt"
|
|
132
|
+
],
|
|
133
|
+
additionalProperties: true
|
|
134
|
+
},
|
|
135
|
+
outputSchema: {
|
|
136
|
+
type: "object",
|
|
137
|
+
properties: {
|
|
138
|
+
data: {
|
|
139
|
+
type: "array",
|
|
140
|
+
items: {
|
|
141
|
+
type: "object",
|
|
142
|
+
properties: {
|
|
143
|
+
url: {
|
|
144
|
+
type: "string",
|
|
145
|
+
title: "\u56FE\u7247\u5730\u5740",
|
|
146
|
+
format: "uri"
|
|
147
|
+
},
|
|
148
|
+
b64_json: {
|
|
149
|
+
type: "string",
|
|
150
|
+
title: "Base64 \u56FE\u7247\u6570\u636E"
|
|
151
|
+
},
|
|
152
|
+
size: {
|
|
153
|
+
type: "string",
|
|
154
|
+
title: "\u56FE\u7247\u5C3A\u5BF8"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
additionalProperties: true
|
|
158
|
+
},
|
|
159
|
+
title: "\u751F\u6210\u56FE\u7247"
|
|
160
|
+
},
|
|
161
|
+
usage: {
|
|
162
|
+
type: "object",
|
|
163
|
+
properties: {},
|
|
164
|
+
additionalProperties: true,
|
|
165
|
+
title: "\u4E0A\u6E38\u7528\u91CF"
|
|
166
|
+
},
|
|
167
|
+
model: {
|
|
168
|
+
type: "string",
|
|
169
|
+
title: "\u6A21\u578B ID",
|
|
170
|
+
const: "bytedance/doubao-seedream-5-0-260128",
|
|
171
|
+
description: "Nexra \u516C\u5171\u6A21\u578B ID\u3002",
|
|
172
|
+
examples: [
|
|
173
|
+
"bytedance/doubao-seedream-5-0-260128"
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
created: {
|
|
177
|
+
type: "integer",
|
|
178
|
+
title: "\u751F\u6210\u65F6\u95F4",
|
|
179
|
+
description: "Unix \u65F6\u95F4\u6233\uFF0C\u5355\u4F4D\u79D2\u3002"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
required: [
|
|
183
|
+
"data"
|
|
184
|
+
],
|
|
185
|
+
additionalProperties: true
|
|
186
|
+
},
|
|
187
|
+
metering: {
|
|
188
|
+
schemaVersion: 1,
|
|
189
|
+
kind: "non_token",
|
|
190
|
+
metrics: [
|
|
191
|
+
{
|
|
192
|
+
metric: "requests",
|
|
193
|
+
requirement: "required"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
metric: "input_images",
|
|
197
|
+
requirement: "informational"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
metric: "output_images",
|
|
201
|
+
requirement: "required"
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: "openai/gpt-image-2",
|
|
210
|
+
contractVersion: 2,
|
|
211
|
+
developer: "openai",
|
|
212
|
+
displayName: "GPT Image 2",
|
|
213
|
+
summary: "GPT Image 2 \u56FE\u7247\u751F\u6210\u4E0E\u7F16\u8F91\uFF0C\u652F\u6301\u591A\u56FE\u8F93\u5165\u3001\u8499\u7248\u53CA\u81EA\u5B9A\u4E49\u8F93\u51FA\u5C3A\u5BF8\u3002",
|
|
214
|
+
kind: "image",
|
|
215
|
+
family: "GPT Image",
|
|
216
|
+
versionLabel: "2",
|
|
217
|
+
aliases: [
|
|
218
|
+
"azure/gpt-image-2",
|
|
219
|
+
"gpt-image-2",
|
|
220
|
+
"gpt-image2",
|
|
221
|
+
"gptimage2"
|
|
222
|
+
],
|
|
223
|
+
capabilities: {
|
|
224
|
+
inputModalities: [
|
|
225
|
+
"text",
|
|
226
|
+
"image"
|
|
227
|
+
],
|
|
228
|
+
outputModalities: [
|
|
229
|
+
"image"
|
|
230
|
+
],
|
|
231
|
+
inputModes: [
|
|
232
|
+
"text-to-image",
|
|
233
|
+
"image-to-image"
|
|
234
|
+
],
|
|
235
|
+
features: []
|
|
236
|
+
},
|
|
237
|
+
operations: [
|
|
238
|
+
{
|
|
239
|
+
operation: "image.generate",
|
|
240
|
+
inputModalities: [
|
|
241
|
+
"text",
|
|
242
|
+
"image"
|
|
243
|
+
],
|
|
244
|
+
outputModalities: [
|
|
245
|
+
"image"
|
|
246
|
+
],
|
|
247
|
+
inputSchema: {
|
|
248
|
+
type: "object",
|
|
249
|
+
properties: {
|
|
250
|
+
model: {
|
|
251
|
+
type: "string",
|
|
252
|
+
title: "\u6A21\u578B ID",
|
|
253
|
+
minLength: 1,
|
|
254
|
+
description: "Nexra \u516C\u5171\u6A21\u578B ID\uFF0C\u5FC5\u987B\u4E0E\u5916\u5C42 modelId \u76F8\u540C\u3002",
|
|
255
|
+
"x-ui": {
|
|
256
|
+
order: 0
|
|
257
|
+
},
|
|
258
|
+
const: "openai/gpt-image-2",
|
|
259
|
+
examples: [
|
|
260
|
+
"openai/gpt-image-2"
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
prompt: {
|
|
264
|
+
type: "string",
|
|
265
|
+
title: "\u63D0\u793A\u8BCD",
|
|
266
|
+
minLength: 1,
|
|
267
|
+
maxLength: 32e3,
|
|
268
|
+
description: "\u63CF\u8FF0\u8981\u751F\u6210\u7684\u56FE\u7247\uFF0C\u6216\u5BF9\u8F93\u5165\u56FE\u7247\u7684\u4FEE\u6539\u8981\u6C42\u3002",
|
|
269
|
+
"x-ui": {
|
|
270
|
+
order: 1,
|
|
271
|
+
control: "textarea"
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
image: {
|
|
275
|
+
title: "\u8F93\u5165\u56FE\u7247",
|
|
276
|
+
description: "\u7528\u4E8E\u56FE\u7247\u7F16\u8F91\uFF0C\u6700\u591A 16 \u5F20\u3002Task \u4E2D\u586B\u5199\u56FE\u7247 URL \u6216 Data URL\uFF1B\u6267\u884C\u65F6\u6309\u539F\u751F image[] \u5B57\u6BB5\u4E0A\u4F20\u6587\u4EF6\uFF0C\u987A\u5E8F\u4E0D\u53D8\u3002",
|
|
277
|
+
anyOf: [
|
|
278
|
+
{
|
|
279
|
+
type: "string",
|
|
280
|
+
format: "uri",
|
|
281
|
+
pattern: "^(https?://|data:image/)",
|
|
282
|
+
minLength: 1
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
type: "array",
|
|
286
|
+
items: {
|
|
287
|
+
type: "string",
|
|
288
|
+
format: "uri",
|
|
289
|
+
pattern: "^(https?://|data:image/)",
|
|
290
|
+
minLength: 1
|
|
291
|
+
},
|
|
292
|
+
minItems: 1,
|
|
293
|
+
maxItems: 16
|
|
294
|
+
}
|
|
295
|
+
],
|
|
296
|
+
"x-ui": {
|
|
297
|
+
order: 2
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
mask: {
|
|
301
|
+
type: "string",
|
|
302
|
+
format: "uri",
|
|
303
|
+
pattern: "^(https?://|data:image/)",
|
|
304
|
+
minLength: 1,
|
|
305
|
+
title: "\u7F16\u8F91\u8499\u7248",
|
|
306
|
+
description: "\u53EF\u9009\u7684\u4E00\u5F20 PNG \u8499\u7248\uFF0C\u9700\u540C\u65F6\u63D0\u4F9B\u8F93\u5165\u56FE\u7247\uFF1B\u5C3A\u5BF8\u4E0E\u7B2C\u4E00\u5F20\u8F93\u5165\u56FE\u4E00\u81F4\uFF0C\u900F\u660E\u533A\u57DF\u7528\u4E8E\u7F16\u8F91\u3002Task \u4E2D\u586B\u5199 URL \u6216 Data URL\uFF0C\u6267\u884C\u65F6\u4E0A\u4F20\u4E3A mask \u6587\u4EF6\u3002",
|
|
307
|
+
"x-ui": {
|
|
308
|
+
order: 3
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
size: {
|
|
312
|
+
type: "string",
|
|
313
|
+
title: "\u8F93\u51FA\u5C3A\u5BF8",
|
|
314
|
+
pattern: "^(auto|[1-9][0-9]{2,3}x[1-9][0-9]{2,3})$",
|
|
315
|
+
description: "\u586B\u5199 WIDTHxHEIGHT \u6216 auto\u3002\u4E24\u8FB9\u5747\u987B\u4E3A 16 \u7684\u500D\u6570\uFF0C\u6700\u957F\u8FB9\u4E0D\u8D85\u8FC7 3840\uFF0C\u5BBD\u9AD8\u6BD4\u5728 1:3\uFF5E3:1\uFF0C\u50CF\u7D20\u603B\u6570\u4E3A 655360\uFF5E8294400\u3002",
|
|
316
|
+
examples: [
|
|
317
|
+
"1024x1024",
|
|
318
|
+
"1536x1024",
|
|
319
|
+
"2048x1152",
|
|
320
|
+
"3840x2160",
|
|
321
|
+
"auto"
|
|
322
|
+
],
|
|
323
|
+
"x-ui": {
|
|
324
|
+
order: 4
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
n: {
|
|
328
|
+
type: "integer",
|
|
329
|
+
title: "\u8F93\u51FA\u5F20\u6570",
|
|
330
|
+
minimum: 1,
|
|
331
|
+
maximum: 10,
|
|
332
|
+
"x-ui": {
|
|
333
|
+
order: 5
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
quality: {
|
|
337
|
+
type: "string",
|
|
338
|
+
title: "\u56FE\u7247\u8D28\u91CF",
|
|
339
|
+
enum: [
|
|
340
|
+
"auto",
|
|
341
|
+
"low",
|
|
342
|
+
"medium",
|
|
343
|
+
"high"
|
|
344
|
+
],
|
|
345
|
+
"x-ui": {
|
|
346
|
+
order: 6,
|
|
347
|
+
optionLabels: {
|
|
348
|
+
auto: "\u81EA\u52A8",
|
|
349
|
+
low: "\u4F4E",
|
|
350
|
+
medium: "\u4E2D",
|
|
351
|
+
high: "\u9AD8"
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
output_format: {
|
|
356
|
+
type: "string",
|
|
357
|
+
description: "\u8F93\u51FA\u56FE\u7247\u7684\u7F16\u7801\u683C\u5F0F\u3002",
|
|
358
|
+
enum: [
|
|
359
|
+
"png",
|
|
360
|
+
"jpeg"
|
|
361
|
+
],
|
|
362
|
+
title: "\u56FE\u7247\u683C\u5F0F",
|
|
363
|
+
"x-ui": {
|
|
364
|
+
order: 7,
|
|
365
|
+
optionLabels: {
|
|
366
|
+
png: "PNG",
|
|
367
|
+
jpeg: "JPEG"
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
output_compression: {
|
|
372
|
+
type: "integer",
|
|
373
|
+
minimum: 0,
|
|
374
|
+
maximum: 100,
|
|
375
|
+
multipleOf: 1,
|
|
376
|
+
description: "JPEG \u538B\u7F29\u8D28\u91CF\uFF0C0\uFF5E100\uFF1B\u4EC5\u5728 output_format \u4E3A jpeg \u65F6\u4F7F\u7528\u3002",
|
|
377
|
+
"x-ui": {
|
|
378
|
+
order: 8
|
|
379
|
+
},
|
|
380
|
+
title: "\u538B\u7F29\u8D28\u91CF"
|
|
381
|
+
},
|
|
382
|
+
background: {
|
|
383
|
+
type: "string",
|
|
384
|
+
enum: [
|
|
385
|
+
"auto",
|
|
386
|
+
"opaque",
|
|
387
|
+
"transparent"
|
|
388
|
+
],
|
|
389
|
+
description: "\u53EF\u9009\u62E9\u81EA\u52A8\u3001\u4E0D\u900F\u660E\u6216\u900F\u660E\u80CC\u666F\uFF1B\u900F\u660E\u80CC\u666F\u4E3A\u4E0A\u6E38\u9884\u89C8\u80FD\u529B\uFF0C\u9700\u4F7F\u7528 PNG\u3002",
|
|
390
|
+
"x-ui": {
|
|
391
|
+
order: 9,
|
|
392
|
+
optionLabels: {
|
|
393
|
+
auto: "\u81EA\u52A8",
|
|
394
|
+
opaque: "\u4E0D\u900F\u660E",
|
|
395
|
+
transparent: "\u900F\u660E"
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
title: "\u80CC\u666F"
|
|
399
|
+
},
|
|
400
|
+
moderation: {
|
|
401
|
+
type: "string",
|
|
402
|
+
enum: [
|
|
403
|
+
"auto",
|
|
404
|
+
"low"
|
|
405
|
+
],
|
|
406
|
+
description: "\u4F20\u7ED9\u4E0A\u6E38\u7684\u5185\u5BB9\u5BA1\u6838\u7EA7\u522B\u3002",
|
|
407
|
+
"x-ui": {
|
|
408
|
+
order: 10,
|
|
409
|
+
optionLabels: {
|
|
410
|
+
auto: "\u81EA\u52A8",
|
|
411
|
+
low: "\u4F4E"
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
title: "\u5185\u5BB9\u5BA1\u6838"
|
|
415
|
+
},
|
|
416
|
+
user: {
|
|
417
|
+
type: "string",
|
|
418
|
+
title: "\u7EC8\u7AEF\u7528\u6237\u6807\u8BC6",
|
|
419
|
+
description: "\u4F20\u7ED9\u4E0A\u6E38\u7684\u7EC8\u7AEF\u7528\u6237\u6807\u8BC6\uFF0C\u7528\u4E8E\u6EE5\u7528\u76D1\u6D4B\u3002",
|
|
420
|
+
"x-ui": {
|
|
421
|
+
order: 11
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
required: [
|
|
426
|
+
"prompt"
|
|
427
|
+
],
|
|
428
|
+
additionalProperties: true,
|
|
429
|
+
allOf: [
|
|
430
|
+
{
|
|
431
|
+
if: {
|
|
432
|
+
required: [
|
|
433
|
+
"mask"
|
|
434
|
+
]
|
|
435
|
+
},
|
|
436
|
+
then: {
|
|
437
|
+
required: [
|
|
438
|
+
"image"
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
if: {
|
|
444
|
+
required: [
|
|
445
|
+
"image"
|
|
446
|
+
]
|
|
447
|
+
},
|
|
448
|
+
then: {
|
|
449
|
+
required: [
|
|
450
|
+
"model"
|
|
451
|
+
]
|
|
452
|
+
}
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
if: {
|
|
456
|
+
required: [
|
|
457
|
+
"output_compression"
|
|
458
|
+
]
|
|
459
|
+
},
|
|
460
|
+
then: {
|
|
461
|
+
required: [
|
|
462
|
+
"output_format"
|
|
463
|
+
],
|
|
464
|
+
properties: {
|
|
465
|
+
output_format: {
|
|
466
|
+
const: "jpeg"
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
if: {
|
|
473
|
+
required: [
|
|
474
|
+
"background"
|
|
475
|
+
],
|
|
476
|
+
properties: {
|
|
477
|
+
background: {
|
|
478
|
+
const: "transparent"
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
then: {
|
|
483
|
+
properties: {
|
|
484
|
+
output_format: {
|
|
485
|
+
const: "png"
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
not: {
|
|
492
|
+
anyOf: [
|
|
493
|
+
{
|
|
494
|
+
required: [
|
|
495
|
+
"texts"
|
|
496
|
+
]
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
required: [
|
|
500
|
+
"images"
|
|
501
|
+
]
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
required: [
|
|
505
|
+
"ratio"
|
|
506
|
+
]
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
required: [
|
|
510
|
+
"resolution"
|
|
511
|
+
]
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
required: [
|
|
515
|
+
"generate_count"
|
|
516
|
+
]
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
required: [
|
|
520
|
+
"callback_url"
|
|
521
|
+
]
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
required: [
|
|
525
|
+
"partial_images"
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
]
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
properties: {
|
|
533
|
+
stream: {
|
|
534
|
+
const: false
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
]
|
|
539
|
+
},
|
|
540
|
+
outputSchema: {
|
|
541
|
+
type: "object",
|
|
542
|
+
properties: {
|
|
543
|
+
created: {
|
|
544
|
+
type: "integer",
|
|
545
|
+
title: "\u751F\u6210\u65F6\u95F4",
|
|
546
|
+
description: "\u4E0A\u6E38\u751F\u6210\u65F6\u95F4\uFF0CUnix \u65F6\u95F4\u6233\uFF0C\u5355\u4F4D\u4E3A\u79D2\u3002",
|
|
547
|
+
"x-ui": {
|
|
548
|
+
order: 0
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
data: {
|
|
552
|
+
type: "array",
|
|
553
|
+
title: "\u751F\u6210\u56FE\u7247",
|
|
554
|
+
items: {
|
|
555
|
+
type: "object",
|
|
556
|
+
properties: {
|
|
557
|
+
b64_json: {
|
|
558
|
+
type: "string",
|
|
559
|
+
title: "\u56FE\u7247 Base64",
|
|
560
|
+
description: "\u5B8C\u6574\u56FE\u7247\u7F16\u7801\uFF1B\u683C\u5F0F\u7531\u54CD\u5E94 output_format \u6216\u8BF7\u6C42 output_format \u786E\u5B9A\u3002",
|
|
561
|
+
"x-ui": {
|
|
562
|
+
order: 0
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
url: {
|
|
566
|
+
type: "string",
|
|
567
|
+
title: "\u56FE\u7247\u5730\u5740",
|
|
568
|
+
format: "uri",
|
|
569
|
+
"x-ui": {
|
|
570
|
+
order: 1
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
additionalProperties: true
|
|
575
|
+
},
|
|
576
|
+
"x-ui": {
|
|
577
|
+
order: 1
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
size: {
|
|
581
|
+
type: "string",
|
|
582
|
+
title: "\u5B9E\u9645\u8F93\u51FA\u5C3A\u5BF8",
|
|
583
|
+
"x-ui": {
|
|
584
|
+
order: 2
|
|
585
|
+
}
|
|
586
|
+
},
|
|
587
|
+
quality: {
|
|
588
|
+
type: "string",
|
|
589
|
+
title: "\u5B9E\u9645\u56FE\u7247\u8D28\u91CF",
|
|
590
|
+
"x-ui": {
|
|
591
|
+
order: 3
|
|
592
|
+
}
|
|
593
|
+
},
|
|
594
|
+
output_format: {
|
|
595
|
+
type: "string",
|
|
596
|
+
title: "\u5B9E\u9645\u56FE\u7247\u683C\u5F0F",
|
|
597
|
+
"x-ui": {
|
|
598
|
+
order: 4
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
background: {
|
|
602
|
+
type: "string",
|
|
603
|
+
title: "\u5B9E\u9645\u80CC\u666F",
|
|
604
|
+
"x-ui": {
|
|
605
|
+
order: 5
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
usage: {
|
|
609
|
+
type: "object",
|
|
610
|
+
title: "\u4E0A\u6E38\u7528\u91CF",
|
|
611
|
+
properties: {
|
|
612
|
+
input_tokens: {
|
|
613
|
+
type: "integer",
|
|
614
|
+
title: "\u8F93\u5165 Token \u603B\u6570",
|
|
615
|
+
minimum: 0,
|
|
616
|
+
"x-ui": {
|
|
617
|
+
order: 0
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
input_tokens_details: {
|
|
621
|
+
type: "object",
|
|
622
|
+
properties: {
|
|
623
|
+
text_tokens: {
|
|
624
|
+
type: "integer",
|
|
625
|
+
title: "\u6587\u672C Token",
|
|
626
|
+
minimum: 0,
|
|
627
|
+
"x-ui": {
|
|
628
|
+
order: 0
|
|
629
|
+
}
|
|
630
|
+
},
|
|
631
|
+
image_tokens: {
|
|
632
|
+
type: "integer",
|
|
633
|
+
title: "\u56FE\u7247 Token",
|
|
634
|
+
minimum: 0,
|
|
635
|
+
"x-ui": {
|
|
636
|
+
order: 1
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
additionalProperties: true,
|
|
641
|
+
title: "\u8F93\u5165 Token \u660E\u7EC6",
|
|
642
|
+
"x-ui": {
|
|
643
|
+
order: 1
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
output_tokens: {
|
|
647
|
+
type: "integer",
|
|
648
|
+
title: "\u8F93\u51FA Token \u603B\u6570",
|
|
649
|
+
minimum: 0,
|
|
650
|
+
"x-ui": {
|
|
651
|
+
order: 2
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
output_tokens_details: {
|
|
655
|
+
type: "object",
|
|
656
|
+
properties: {
|
|
657
|
+
text_tokens: {
|
|
658
|
+
type: "integer",
|
|
659
|
+
title: "\u6587\u672C Token",
|
|
660
|
+
minimum: 0,
|
|
661
|
+
"x-ui": {
|
|
662
|
+
order: 0
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
image_tokens: {
|
|
666
|
+
type: "integer",
|
|
667
|
+
title: "\u56FE\u7247 Token",
|
|
668
|
+
minimum: 0,
|
|
669
|
+
"x-ui": {
|
|
670
|
+
order: 1
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
additionalProperties: true,
|
|
675
|
+
title: "\u8F93\u51FA Token \u660E\u7EC6",
|
|
676
|
+
"x-ui": {
|
|
677
|
+
order: 3
|
|
678
|
+
}
|
|
679
|
+
},
|
|
680
|
+
total_tokens: {
|
|
681
|
+
type: "integer",
|
|
682
|
+
title: "Token \u603B\u6570",
|
|
683
|
+
minimum: 0,
|
|
684
|
+
"x-ui": {
|
|
685
|
+
order: 4
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
additionalProperties: true,
|
|
690
|
+
"x-ui": {
|
|
691
|
+
order: 6
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
required: [
|
|
696
|
+
"data"
|
|
697
|
+
],
|
|
698
|
+
additionalProperties: true
|
|
699
|
+
},
|
|
700
|
+
metering: {
|
|
701
|
+
schemaVersion: 1,
|
|
702
|
+
kind: "token",
|
|
703
|
+
metrics: [
|
|
704
|
+
{
|
|
705
|
+
metric: "requests",
|
|
706
|
+
requirement: "required"
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
metric: "input_tokens",
|
|
710
|
+
requirement: "required"
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
metric: "output_tokens",
|
|
714
|
+
requirement: "required"
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
metric: "cached_input_tokens",
|
|
718
|
+
requirement: "informational"
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
metric: "input_images",
|
|
722
|
+
requirement: "informational"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
metric: "output_images",
|
|
726
|
+
requirement: "informational"
|
|
727
|
+
}
|
|
728
|
+
]
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
]
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
id: "xai/grok-imagine-image-quality",
|
|
735
|
+
contractVersion: 2,
|
|
736
|
+
developer: "xai",
|
|
737
|
+
displayName: "grok-imagine-image-quality",
|
|
738
|
+
summary: "Grok \u9AD8\u8D28\u91CF\u56FE\u7247\u751F\u6210\u4E0E\u7F16\u8F91\uFF0C\u652F\u6301\u591A\u56FE\u53C2\u8003\u53CA 1K / 2K \u8F93\u51FA\u3002",
|
|
739
|
+
kind: "image",
|
|
740
|
+
family: "Grok Image Quality",
|
|
741
|
+
aliases: [
|
|
742
|
+
"grok-imagine-image-quality"
|
|
743
|
+
],
|
|
744
|
+
capabilities: {
|
|
745
|
+
inputModalities: [
|
|
746
|
+
"text",
|
|
747
|
+
"image"
|
|
748
|
+
],
|
|
749
|
+
outputModalities: [
|
|
750
|
+
"image"
|
|
751
|
+
],
|
|
752
|
+
inputModes: [
|
|
753
|
+
"text-to-image",
|
|
754
|
+
"image-to-image"
|
|
755
|
+
],
|
|
756
|
+
features: [
|
|
757
|
+
"structured-output"
|
|
758
|
+
]
|
|
759
|
+
},
|
|
760
|
+
operations: [
|
|
761
|
+
{
|
|
762
|
+
operation: "image.generate",
|
|
763
|
+
inputModalities: [
|
|
764
|
+
"text",
|
|
765
|
+
"image"
|
|
766
|
+
],
|
|
767
|
+
outputModalities: [
|
|
768
|
+
"image"
|
|
769
|
+
],
|
|
770
|
+
inputSchema: {
|
|
771
|
+
type: "object",
|
|
772
|
+
properties: {
|
|
773
|
+
model: {
|
|
774
|
+
type: "string",
|
|
775
|
+
minLength: 1,
|
|
776
|
+
title: "\u6A21\u578B ID",
|
|
777
|
+
description: "Nexra \u516C\u5171\u6A21\u578B ID\uFF0C\u5FC5\u987B\u4E0E\u5916\u5C42 modelId \u76F8\u540C\u3002",
|
|
778
|
+
"x-ui": {
|
|
779
|
+
order: 0
|
|
780
|
+
},
|
|
781
|
+
const: "xai/grok-imagine-image-quality",
|
|
782
|
+
examples: [
|
|
783
|
+
"xai/grok-imagine-image-quality"
|
|
784
|
+
]
|
|
785
|
+
},
|
|
786
|
+
prompt: {
|
|
787
|
+
type: "string",
|
|
788
|
+
minLength: 1,
|
|
789
|
+
title: "\u63D0\u793A\u8BCD",
|
|
790
|
+
description: "\u63CF\u8FF0\u8981\u751F\u6210\u7684\u56FE\u50CF\uFF0C\u6216\u5BF9\u53C2\u8003\u56FE\u7247\u7684\u4FEE\u6539\u8981\u6C42\u3002",
|
|
791
|
+
"x-ui": {
|
|
792
|
+
order: 1,
|
|
793
|
+
control: "textarea"
|
|
794
|
+
}
|
|
795
|
+
},
|
|
796
|
+
image: {
|
|
797
|
+
type: "object",
|
|
798
|
+
title: "\u5355\u5F20\u53C2\u8003\u56FE\u7247",
|
|
799
|
+
properties: {
|
|
800
|
+
url: {
|
|
801
|
+
type: "string",
|
|
802
|
+
format: "uri",
|
|
803
|
+
title: "\u56FE\u7247\u5730\u5740",
|
|
804
|
+
description: "\u516C\u7F51 URL \u6216\u5305\u542B\u5B8C\u6574\u524D\u7F00\u7684\u56FE\u7247 Data URL\u3002",
|
|
805
|
+
"x-ui": {
|
|
806
|
+
order: 0
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
image_url: {
|
|
810
|
+
type: "string",
|
|
811
|
+
format: "uri",
|
|
812
|
+
title: "\u56FE\u7247\u5730\u5740\u522B\u540D",
|
|
813
|
+
description: "\u4E0A\u6E38\u517C\u5BB9\u7684 url \u522B\u540D\uFF1B\u53EA\u586B\u5199\u4E00\u79CD\u56FE\u7247\u5730\u5740\u3002",
|
|
814
|
+
"x-ui": {
|
|
815
|
+
order: 1
|
|
816
|
+
}
|
|
817
|
+
},
|
|
818
|
+
file_id: {
|
|
819
|
+
type: [
|
|
820
|
+
"string",
|
|
821
|
+
"null"
|
|
822
|
+
],
|
|
823
|
+
title: "\u4E0A\u6E38\u6587\u4EF6 ID",
|
|
824
|
+
description: "\u6240\u9009 xAI \u6E20\u9053\u8D26\u53F7\u4E2D\u7684\u56FE\u7247\u6587\u4EF6\uFF1B\u4E0D\u662F Nexra \u8D44\u6E90 ID\u3002",
|
|
825
|
+
"x-ui": {
|
|
826
|
+
order: 2
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
},
|
|
830
|
+
anyOf: [
|
|
831
|
+
{
|
|
832
|
+
required: [
|
|
833
|
+
"url"
|
|
834
|
+
],
|
|
835
|
+
properties: {
|
|
836
|
+
file_id: {
|
|
837
|
+
type: "null"
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
not: {
|
|
841
|
+
required: [
|
|
842
|
+
"image_url"
|
|
843
|
+
]
|
|
844
|
+
}
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
required: [
|
|
848
|
+
"image_url"
|
|
849
|
+
],
|
|
850
|
+
properties: {
|
|
851
|
+
file_id: {
|
|
852
|
+
type: "null"
|
|
853
|
+
}
|
|
854
|
+
},
|
|
855
|
+
not: {
|
|
856
|
+
required: [
|
|
857
|
+
"url"
|
|
858
|
+
]
|
|
859
|
+
}
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
required: [
|
|
863
|
+
"file_id"
|
|
864
|
+
],
|
|
865
|
+
properties: {
|
|
866
|
+
file_id: {
|
|
867
|
+
type: "string",
|
|
868
|
+
minLength: 1
|
|
869
|
+
}
|
|
870
|
+
},
|
|
871
|
+
not: {
|
|
872
|
+
anyOf: [
|
|
873
|
+
{
|
|
874
|
+
required: [
|
|
875
|
+
"url"
|
|
876
|
+
]
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
required: [
|
|
880
|
+
"image_url"
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
]
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
],
|
|
887
|
+
additionalProperties: true,
|
|
888
|
+
description: "\u7528\u4E8E\u56FE\u7247\u7F16\u8F91\uFF1B\u4E0E images \u4E8C\u9009\u4E00\u3002",
|
|
889
|
+
"x-ui": {
|
|
890
|
+
order: 2
|
|
891
|
+
}
|
|
892
|
+
},
|
|
893
|
+
images: {
|
|
894
|
+
type: "array",
|
|
895
|
+
minItems: 1,
|
|
896
|
+
maxItems: 3,
|
|
897
|
+
items: {
|
|
898
|
+
type: "object",
|
|
899
|
+
title: "\u56FE\u7247\u5F15\u7528",
|
|
900
|
+
properties: {
|
|
901
|
+
url: {
|
|
902
|
+
type: "string",
|
|
903
|
+
format: "uri",
|
|
904
|
+
title: "\u56FE\u7247\u5730\u5740",
|
|
905
|
+
description: "\u516C\u7F51 URL \u6216\u5305\u542B\u5B8C\u6574\u524D\u7F00\u7684\u56FE\u7247 Data URL\u3002",
|
|
906
|
+
"x-ui": {
|
|
907
|
+
order: 0
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
image_url: {
|
|
911
|
+
type: "string",
|
|
912
|
+
format: "uri",
|
|
913
|
+
title: "\u56FE\u7247\u5730\u5740\u522B\u540D",
|
|
914
|
+
description: "\u4E0A\u6E38\u517C\u5BB9\u7684 url \u522B\u540D\uFF1B\u53EA\u586B\u5199\u4E00\u79CD\u56FE\u7247\u5730\u5740\u3002",
|
|
915
|
+
"x-ui": {
|
|
916
|
+
order: 1
|
|
917
|
+
}
|
|
918
|
+
},
|
|
919
|
+
file_id: {
|
|
920
|
+
type: [
|
|
921
|
+
"string",
|
|
922
|
+
"null"
|
|
923
|
+
],
|
|
924
|
+
title: "\u4E0A\u6E38\u6587\u4EF6 ID",
|
|
925
|
+
description: "\u6240\u9009 xAI \u6E20\u9053\u8D26\u53F7\u4E2D\u7684\u56FE\u7247\u6587\u4EF6\uFF1B\u4E0D\u662F Nexra \u8D44\u6E90 ID\u3002",
|
|
926
|
+
"x-ui": {
|
|
927
|
+
order: 2
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
},
|
|
931
|
+
anyOf: [
|
|
932
|
+
{
|
|
933
|
+
required: [
|
|
934
|
+
"url"
|
|
935
|
+
],
|
|
936
|
+
properties: {
|
|
937
|
+
file_id: {
|
|
938
|
+
type: "null"
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
not: {
|
|
942
|
+
required: [
|
|
943
|
+
"image_url"
|
|
944
|
+
]
|
|
945
|
+
}
|
|
946
|
+
},
|
|
947
|
+
{
|
|
948
|
+
required: [
|
|
949
|
+
"image_url"
|
|
950
|
+
],
|
|
951
|
+
properties: {
|
|
952
|
+
file_id: {
|
|
953
|
+
type: "null"
|
|
954
|
+
}
|
|
955
|
+
},
|
|
956
|
+
not: {
|
|
957
|
+
required: [
|
|
958
|
+
"url"
|
|
959
|
+
]
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
required: [
|
|
964
|
+
"file_id"
|
|
965
|
+
],
|
|
966
|
+
properties: {
|
|
967
|
+
file_id: {
|
|
968
|
+
type: "string",
|
|
969
|
+
minLength: 1
|
|
970
|
+
}
|
|
971
|
+
},
|
|
972
|
+
not: {
|
|
973
|
+
anyOf: [
|
|
974
|
+
{
|
|
975
|
+
required: [
|
|
976
|
+
"url"
|
|
977
|
+
]
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
required: [
|
|
981
|
+
"image_url"
|
|
982
|
+
]
|
|
983
|
+
}
|
|
984
|
+
]
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
],
|
|
988
|
+
additionalProperties: true
|
|
989
|
+
},
|
|
990
|
+
title: "\u591A\u5F20\u53C2\u8003\u56FE\u7247",
|
|
991
|
+
description: "\u6309\u8F93\u5165\u987A\u5E8F\u63D0\u4F9B\u56FE\u7247\u5F15\u7528\uFF0C\u4E0E image \u4E8C\u9009\u4E00\u3002",
|
|
992
|
+
"x-ui": {
|
|
993
|
+
order: 3
|
|
994
|
+
}
|
|
995
|
+
},
|
|
996
|
+
aspect_ratio: {
|
|
997
|
+
type: "string",
|
|
998
|
+
description: "\u8F93\u51FA\u5BBD\u9AD8\u6BD4\uFF1B\u56FE\u7247\u7F16\u8F91\u9ED8\u8BA4\u8DDF\u968F\u7B2C\u4E00\u5F20\u8F93\u5165\u56FE\uFF0C\u4E5F\u53EF\u663E\u5F0F\u6307\u5B9A\u5982 1:1\u300116:9\u3002",
|
|
999
|
+
enum: [
|
|
1000
|
+
"auto",
|
|
1001
|
+
"1:1",
|
|
1002
|
+
"16:9",
|
|
1003
|
+
"9:16",
|
|
1004
|
+
"4:3",
|
|
1005
|
+
"3:4",
|
|
1006
|
+
"3:2",
|
|
1007
|
+
"2:3",
|
|
1008
|
+
"2:1",
|
|
1009
|
+
"1:2",
|
|
1010
|
+
"19.5:9",
|
|
1011
|
+
"9:19.5",
|
|
1012
|
+
"20:9",
|
|
1013
|
+
"9:20",
|
|
1014
|
+
"21:9",
|
|
1015
|
+
"5:2"
|
|
1016
|
+
],
|
|
1017
|
+
"x-ui": {
|
|
1018
|
+
order: 4,
|
|
1019
|
+
control: "select"
|
|
1020
|
+
},
|
|
1021
|
+
title: "\u753B\u9762\u6BD4\u4F8B"
|
|
1022
|
+
},
|
|
1023
|
+
resolution: {
|
|
1024
|
+
type: "string",
|
|
1025
|
+
enum: [
|
|
1026
|
+
"1k",
|
|
1027
|
+
"2k"
|
|
1028
|
+
],
|
|
1029
|
+
title: "\u8F93\u51FA\u5206\u8FA8\u7387",
|
|
1030
|
+
"x-ui": {
|
|
1031
|
+
order: 5,
|
|
1032
|
+
control: "select"
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
1035
|
+
n: {
|
|
1036
|
+
type: [
|
|
1037
|
+
"integer",
|
|
1038
|
+
"null"
|
|
1039
|
+
],
|
|
1040
|
+
minimum: 1,
|
|
1041
|
+
maximum: 10,
|
|
1042
|
+
title: "\u8F93\u51FA\u5F20\u6570",
|
|
1043
|
+
"x-ui": {
|
|
1044
|
+
order: 6,
|
|
1045
|
+
control: "number"
|
|
1046
|
+
}
|
|
1047
|
+
},
|
|
1048
|
+
response_format: {
|
|
1049
|
+
type: [
|
|
1050
|
+
"string",
|
|
1051
|
+
"null"
|
|
1052
|
+
],
|
|
1053
|
+
enum: [
|
|
1054
|
+
"url",
|
|
1055
|
+
"b64_json",
|
|
1056
|
+
null
|
|
1057
|
+
],
|
|
1058
|
+
title: "\u56FE\u7247\u8FD4\u56DE\u683C\u5F0F",
|
|
1059
|
+
description: "url \u8FD4\u56DE\u56FE\u7247\u5730\u5740\uFF1Bb64_json \u8FD4\u56DE Base64\u3002",
|
|
1060
|
+
"x-ui": {
|
|
1061
|
+
order: 7,
|
|
1062
|
+
control: "select",
|
|
1063
|
+
optionLabels: {
|
|
1064
|
+
url: "\u56FE\u7247 URL",
|
|
1065
|
+
b64_json: "Base64",
|
|
1066
|
+
null: "\u4E0A\u6E38\u9ED8\u8BA4"
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
},
|
|
1070
|
+
user: {
|
|
1071
|
+
type: [
|
|
1072
|
+
"string",
|
|
1073
|
+
"null"
|
|
1074
|
+
],
|
|
1075
|
+
title: "\u7EC8\u7AEF\u7528\u6237\u6807\u8BC6",
|
|
1076
|
+
description: "\u4F20\u7ED9 xAI \u7684\u7EC8\u7AEF\u7528\u6237\u6807\u8BC6\uFF0C\u7528\u4E8E\u6EE5\u7528\u76D1\u6D4B\u3002",
|
|
1077
|
+
"x-ui": {
|
|
1078
|
+
order: 8
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
},
|
|
1082
|
+
required: [
|
|
1083
|
+
"model",
|
|
1084
|
+
"prompt"
|
|
1085
|
+
],
|
|
1086
|
+
additionalProperties: true,
|
|
1087
|
+
allOf: [
|
|
1088
|
+
{
|
|
1089
|
+
not: {
|
|
1090
|
+
required: [
|
|
1091
|
+
"image",
|
|
1092
|
+
"images"
|
|
1093
|
+
]
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
not: {
|
|
1098
|
+
anyOf: [
|
|
1099
|
+
{
|
|
1100
|
+
required: [
|
|
1101
|
+
"texts"
|
|
1102
|
+
]
|
|
1103
|
+
},
|
|
1104
|
+
{
|
|
1105
|
+
required: [
|
|
1106
|
+
"ratio"
|
|
1107
|
+
]
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
required: [
|
|
1111
|
+
"generate_count"
|
|
1112
|
+
]
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
required: [
|
|
1116
|
+
"callback_url"
|
|
1117
|
+
]
|
|
1118
|
+
}
|
|
1119
|
+
]
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
]
|
|
1123
|
+
},
|
|
1124
|
+
outputSchema: {
|
|
1125
|
+
type: "object",
|
|
1126
|
+
required: [
|
|
1127
|
+
"data"
|
|
1128
|
+
],
|
|
1129
|
+
additionalProperties: true,
|
|
1130
|
+
properties: {
|
|
1131
|
+
data: {
|
|
1132
|
+
type: "array",
|
|
1133
|
+
title: "\u751F\u6210\u56FE\u7247",
|
|
1134
|
+
items: {
|
|
1135
|
+
type: "object",
|
|
1136
|
+
additionalProperties: true,
|
|
1137
|
+
properties: {
|
|
1138
|
+
url: {
|
|
1139
|
+
type: [
|
|
1140
|
+
"string",
|
|
1141
|
+
"null"
|
|
1142
|
+
],
|
|
1143
|
+
title: "\u56FE\u7247\u5730\u5740",
|
|
1144
|
+
"x-ui": {
|
|
1145
|
+
order: 0
|
|
1146
|
+
}
|
|
1147
|
+
},
|
|
1148
|
+
b64_json: {
|
|
1149
|
+
type: [
|
|
1150
|
+
"string",
|
|
1151
|
+
"null"
|
|
1152
|
+
],
|
|
1153
|
+
title: "\u56FE\u7247 Base64",
|
|
1154
|
+
description: "\u4E0D\u5305\u542B Data URL \u524D\u7F00\u7684\u56FE\u7247\u5185\u5BB9\u3002",
|
|
1155
|
+
"x-ui": {
|
|
1156
|
+
order: 1
|
|
1157
|
+
}
|
|
1158
|
+
},
|
|
1159
|
+
mime_type: {
|
|
1160
|
+
type: [
|
|
1161
|
+
"string",
|
|
1162
|
+
"null"
|
|
1163
|
+
],
|
|
1164
|
+
title: "\u5A92\u4F53\u7C7B\u578B",
|
|
1165
|
+
"x-ui": {
|
|
1166
|
+
order: 2
|
|
1167
|
+
}
|
|
1168
|
+
},
|
|
1169
|
+
revised_prompt: {
|
|
1170
|
+
type: [
|
|
1171
|
+
"string",
|
|
1172
|
+
"null"
|
|
1173
|
+
],
|
|
1174
|
+
title: "\u4E0A\u6E38\u8C03\u6574\u540E\u7684\u63D0\u793A\u8BCD",
|
|
1175
|
+
"x-ui": {
|
|
1176
|
+
order: 3
|
|
1177
|
+
}
|
|
1178
|
+
},
|
|
1179
|
+
file_output: {
|
|
1180
|
+
type: "object",
|
|
1181
|
+
title: "\u4E0A\u6E38\u6587\u4EF6\u4FDD\u5B58\u7ED3\u679C",
|
|
1182
|
+
additionalProperties: true,
|
|
1183
|
+
properties: {
|
|
1184
|
+
file_id: {
|
|
1185
|
+
type: "string",
|
|
1186
|
+
title: "\u4E0A\u6E38\u6587\u4EF6 ID"
|
|
1187
|
+
},
|
|
1188
|
+
filename: {
|
|
1189
|
+
type: "string",
|
|
1190
|
+
title: "\u6587\u4EF6\u540D"
|
|
1191
|
+
},
|
|
1192
|
+
public_url: {
|
|
1193
|
+
type: [
|
|
1194
|
+
"string",
|
|
1195
|
+
"null"
|
|
1196
|
+
],
|
|
1197
|
+
title: "\u516C\u5F00\u5730\u5740"
|
|
1198
|
+
},
|
|
1199
|
+
expires_at: {
|
|
1200
|
+
type: [
|
|
1201
|
+
"integer",
|
|
1202
|
+
"null"
|
|
1203
|
+
],
|
|
1204
|
+
title: "\u6587\u4EF6\u8FC7\u671F\u65F6\u95F4",
|
|
1205
|
+
description: "Unix \u65F6\u95F4\u6233\uFF0C\u5355\u4F4D\u4E3A\u79D2\u3002"
|
|
1206
|
+
},
|
|
1207
|
+
public_url_expires_at: {
|
|
1208
|
+
type: [
|
|
1209
|
+
"integer",
|
|
1210
|
+
"null"
|
|
1211
|
+
],
|
|
1212
|
+
title: "\u516C\u5F00\u5730\u5740\u8FC7\u671F\u65F6\u95F4",
|
|
1213
|
+
description: "Unix \u65F6\u95F4\u6233\uFF0C\u5355\u4F4D\u4E3A\u79D2\u3002"
|
|
1214
|
+
},
|
|
1215
|
+
public_url_error: {
|
|
1216
|
+
type: [
|
|
1217
|
+
"string",
|
|
1218
|
+
"null"
|
|
1219
|
+
],
|
|
1220
|
+
title: "\u516C\u5F00\u5730\u5740\u521B\u5EFA\u9519\u8BEF"
|
|
1221
|
+
}
|
|
1222
|
+
},
|
|
1223
|
+
"x-ui": {
|
|
1224
|
+
order: 4
|
|
1225
|
+
}
|
|
1226
|
+
},
|
|
1227
|
+
storage_error: {
|
|
1228
|
+
type: [
|
|
1229
|
+
"string",
|
|
1230
|
+
"null"
|
|
1231
|
+
],
|
|
1232
|
+
title: "\u4E0A\u6E38\u6587\u4EF6\u4FDD\u5B58\u9519\u8BEF",
|
|
1233
|
+
"x-ui": {
|
|
1234
|
+
order: 5
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
},
|
|
1239
|
+
"x-ui": {
|
|
1240
|
+
order: 0
|
|
1241
|
+
}
|
|
1242
|
+
},
|
|
1243
|
+
usage: {
|
|
1244
|
+
type: "object",
|
|
1245
|
+
title: "\u4E0A\u6E38\u7528\u91CF",
|
|
1246
|
+
additionalProperties: true,
|
|
1247
|
+
properties: {
|
|
1248
|
+
input_tokens: {
|
|
1249
|
+
type: [
|
|
1250
|
+
"integer",
|
|
1251
|
+
"null"
|
|
1252
|
+
],
|
|
1253
|
+
title: "\u8F93\u5165 Token"
|
|
1254
|
+
},
|
|
1255
|
+
output_tokens: {
|
|
1256
|
+
type: [
|
|
1257
|
+
"integer",
|
|
1258
|
+
"null"
|
|
1259
|
+
],
|
|
1260
|
+
title: "\u8F93\u51FA Token"
|
|
1261
|
+
},
|
|
1262
|
+
total_tokens: {
|
|
1263
|
+
type: [
|
|
1264
|
+
"integer",
|
|
1265
|
+
"null"
|
|
1266
|
+
],
|
|
1267
|
+
title: "\u603B Token"
|
|
1268
|
+
},
|
|
1269
|
+
cost_in_usd_ticks: {
|
|
1270
|
+
type: "integer",
|
|
1271
|
+
title: "\u4E0A\u6E38\u91D1\u989D\u5355\u4F4D",
|
|
1272
|
+
description: "xAI \u7684 USD ticks\uFF1B\u4E0D\u662F Nexra \u5411\u7528\u6237\u6536\u53D6\u7684\u8D39\u7528\u3002"
|
|
1273
|
+
}
|
|
1274
|
+
},
|
|
1275
|
+
"x-ui": {
|
|
1276
|
+
order: 1
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
},
|
|
1281
|
+
metering: {
|
|
1282
|
+
schemaVersion: 1,
|
|
1283
|
+
kind: "non_token",
|
|
1284
|
+
metrics: [
|
|
1285
|
+
{
|
|
1286
|
+
metric: "requests",
|
|
1287
|
+
requirement: "required"
|
|
1288
|
+
},
|
|
1289
|
+
{
|
|
1290
|
+
metric: "input_images",
|
|
1291
|
+
requirement: "required"
|
|
1292
|
+
},
|
|
1293
|
+
{
|
|
1294
|
+
metric: "output_images",
|
|
1295
|
+
requirement: "required"
|
|
1296
|
+
}
|
|
1297
|
+
]
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
]
|
|
1301
|
+
}
|
|
1302
|
+
];
|
|
1303
|
+
|
|
1304
|
+
// src/errors.ts
|
|
1305
|
+
var NexraApiError = class extends Error {
|
|
1306
|
+
status;
|
|
1307
|
+
code;
|
|
1308
|
+
requestId;
|
|
1309
|
+
retryable;
|
|
1310
|
+
details;
|
|
1311
|
+
constructor(message, options) {
|
|
1312
|
+
super(message);
|
|
1313
|
+
this.name = "NexraApiError";
|
|
1314
|
+
this.status = options.status;
|
|
1315
|
+
this.code = options.code ?? "api_error";
|
|
1316
|
+
this.requestId = options.requestId;
|
|
1317
|
+
this.retryable = options.retryable ?? false;
|
|
1318
|
+
this.details = options.details;
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
var NexraTaskError = class extends Error {
|
|
1322
|
+
task;
|
|
1323
|
+
constructor(task) {
|
|
1324
|
+
super(task.error?.message ?? `Task ${task.id} ended with status ${task.status}`);
|
|
1325
|
+
this.name = "NexraTaskError";
|
|
1326
|
+
this.task = task;
|
|
1327
|
+
}
|
|
1328
|
+
};
|
|
1329
|
+
var NexraWaitTimeoutError = class extends Error {
|
|
1330
|
+
taskId;
|
|
1331
|
+
timeoutMs;
|
|
1332
|
+
constructor(taskId, timeoutMs) {
|
|
1333
|
+
super(`Timed out waiting ${timeoutMs}ms for task ${taskId}`);
|
|
1334
|
+
this.name = "NexraWaitTimeoutError";
|
|
1335
|
+
this.taskId = taskId;
|
|
1336
|
+
this.timeoutMs = timeoutMs;
|
|
1337
|
+
}
|
|
1338
|
+
};
|
|
1339
|
+
|
|
1340
|
+
// src/generated/version.generated.ts
|
|
1341
|
+
var SDK_VERSION = "0.1.0-alpha.1";
|
|
1342
|
+
|
|
1343
|
+
// src/transport.ts
|
|
1344
|
+
var DEFAULT_BASE_URL = "https://api.nexra-ai.com/v1";
|
|
1345
|
+
var HttpTransport = class {
|
|
1346
|
+
baseUrl;
|
|
1347
|
+
apiKey;
|
|
1348
|
+
fetchImplementation;
|
|
1349
|
+
defaultHeaders;
|
|
1350
|
+
maxRetries;
|
|
1351
|
+
constructor(options) {
|
|
1352
|
+
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
1353
|
+
this.apiKey = options.apiKey;
|
|
1354
|
+
this.fetchImplementation = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
1355
|
+
this.defaultHeaders = new Headers(options.headers);
|
|
1356
|
+
this.maxRetries = options.maxRetries ?? 2;
|
|
1357
|
+
if (!this.fetchImplementation) {
|
|
1358
|
+
throw new TypeError("A Web-compatible fetch implementation is required");
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
url(path) {
|
|
1362
|
+
return `${this.baseUrl}${path.startsWith("/") ? path : `/${path}`}`;
|
|
1363
|
+
}
|
|
1364
|
+
async json(path, init = {}, options = {}) {
|
|
1365
|
+
const response = await this.response(path, init, options);
|
|
1366
|
+
if (response.status === 204) return void 0;
|
|
1367
|
+
return await response.json();
|
|
1368
|
+
}
|
|
1369
|
+
async response(path, init = {}, options = {}) {
|
|
1370
|
+
const headers = new Headers(this.defaultHeaders);
|
|
1371
|
+
new Headers(init.headers).forEach((value, key) => headers.set(key, value));
|
|
1372
|
+
if (this.apiKey && !headers.has("authorization")) {
|
|
1373
|
+
headers.set("authorization", `Bearer ${this.apiKey}`);
|
|
1374
|
+
}
|
|
1375
|
+
if (!headers.has("x-nexra-client-request-id")) {
|
|
1376
|
+
headers.set("x-nexra-client-request-id", crypto.randomUUID());
|
|
1377
|
+
}
|
|
1378
|
+
headers.set("x-nexra-sdk", `typescript/${SDK_VERSION}`);
|
|
1379
|
+
const retryable = options.retryable ?? isSafeMethod(init.method);
|
|
1380
|
+
const attempts = retryable ? this.maxRetries + 1 : 1;
|
|
1381
|
+
let lastError;
|
|
1382
|
+
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
|
1383
|
+
try {
|
|
1384
|
+
const response = await this.fetchImplementation(this.url(path), {
|
|
1385
|
+
...init,
|
|
1386
|
+
headers
|
|
1387
|
+
});
|
|
1388
|
+
if (response.ok) return response;
|
|
1389
|
+
if (attempt + 1 < attempts && shouldRetryStatus(response.status)) {
|
|
1390
|
+
await waitForRetry(response, attempt, init.signal);
|
|
1391
|
+
continue;
|
|
1392
|
+
}
|
|
1393
|
+
throw await createApiError(response);
|
|
1394
|
+
} catch (error) {
|
|
1395
|
+
if (error instanceof NexraApiError) throw error;
|
|
1396
|
+
if (init.signal?.aborted) throw init.signal.reason ?? error;
|
|
1397
|
+
lastError = error;
|
|
1398
|
+
if (attempt + 1 < attempts) {
|
|
1399
|
+
await sleep(200 * 2 ** attempt, init.signal);
|
|
1400
|
+
continue;
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
throw lastError instanceof Error ? lastError : new Error("Nexra request failed without an error response");
|
|
1405
|
+
}
|
|
1406
|
+
};
|
|
1407
|
+
function jsonBody(value) {
|
|
1408
|
+
return {
|
|
1409
|
+
body: JSON.stringify(value),
|
|
1410
|
+
headers: { "content-type": "application/json" }
|
|
1411
|
+
};
|
|
1412
|
+
}
|
|
1413
|
+
function queryString(values) {
|
|
1414
|
+
const params = new URLSearchParams();
|
|
1415
|
+
for (const [key, value] of Object.entries(values)) {
|
|
1416
|
+
if (value !== void 0) params.set(key, String(value));
|
|
1417
|
+
}
|
|
1418
|
+
const query = params.toString();
|
|
1419
|
+
return query ? `?${query}` : "";
|
|
1420
|
+
}
|
|
1421
|
+
function sleep(milliseconds, signal) {
|
|
1422
|
+
if (signal?.aborted) return Promise.reject(signal.reason);
|
|
1423
|
+
return new Promise((resolve, reject) => {
|
|
1424
|
+
const timeout = setTimeout(resolve, milliseconds);
|
|
1425
|
+
signal?.addEventListener(
|
|
1426
|
+
"abort",
|
|
1427
|
+
() => {
|
|
1428
|
+
clearTimeout(timeout);
|
|
1429
|
+
reject(signal.reason);
|
|
1430
|
+
},
|
|
1431
|
+
{ once: true }
|
|
1432
|
+
);
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
async function createApiError(response) {
|
|
1436
|
+
let payload;
|
|
1437
|
+
try {
|
|
1438
|
+
payload = await response.clone().json();
|
|
1439
|
+
} catch {
|
|
1440
|
+
}
|
|
1441
|
+
const error = payload?.error;
|
|
1442
|
+
return new NexraApiError(error?.message ?? `Nexra API returned HTTP ${response.status}`, {
|
|
1443
|
+
status: response.status,
|
|
1444
|
+
code: error?.code,
|
|
1445
|
+
requestId: error?.requestId ?? response.headers.get("x-request-id") ?? void 0,
|
|
1446
|
+
retryable: error?.retryable ?? shouldRetryStatus(response.status),
|
|
1447
|
+
details: error?.details
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
function isSafeMethod(method) {
|
|
1451
|
+
const normalized = (method ?? "GET").toUpperCase();
|
|
1452
|
+
return normalized === "GET" || normalized === "HEAD" || normalized === "OPTIONS";
|
|
1453
|
+
}
|
|
1454
|
+
function shouldRetryStatus(status) {
|
|
1455
|
+
return status === 408 || status === 409 || status === 429 || status >= 500;
|
|
1456
|
+
}
|
|
1457
|
+
async function waitForRetry(response, attempt, signal) {
|
|
1458
|
+
const retryAfter = response.headers.get("retry-after");
|
|
1459
|
+
const seconds = retryAfter ? Number(retryAfter) : Number.NaN;
|
|
1460
|
+
await sleep(Number.isFinite(seconds) ? seconds * 1e3 : 200 * 2 ** attempt, signal);
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
// src/catalog.ts
|
|
1464
|
+
var modelSpecs = deepFreeze(structuredClone(public_catalog_generated_default));
|
|
1465
|
+
var byIdentifier = /* @__PURE__ */ new Map();
|
|
1466
|
+
for (const model of modelSpecs) {
|
|
1467
|
+
for (const identifier of [model.id, ...model.aliases]) {
|
|
1468
|
+
if (byIdentifier.has(identifier)) throw new Error(`Duplicate public SDK model identifier: ${identifier}`);
|
|
1469
|
+
byIdentifier.set(identifier, model);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
var CatalogClient = class {
|
|
1473
|
+
constructor(transport) {
|
|
1474
|
+
this.transport = transport;
|
|
1475
|
+
}
|
|
1476
|
+
transport;
|
|
1477
|
+
quote(request, signal) {
|
|
1478
|
+
return this.transport.json(
|
|
1479
|
+
"/catalog/quotes",
|
|
1480
|
+
{ method: "POST", ...jsonBody(request), signal },
|
|
1481
|
+
{ retryable: false }
|
|
1482
|
+
);
|
|
1483
|
+
}
|
|
1484
|
+
};
|
|
1485
|
+
function getModelSpec(modelId) {
|
|
1486
|
+
return byIdentifier.get(modelId);
|
|
1487
|
+
}
|
|
1488
|
+
function listModelSpecs(filter = {}) {
|
|
1489
|
+
return modelSpecs.filter(
|
|
1490
|
+
(model) => (!filter.kind || model.kind === filter.kind) && (!filter.operation || model.operations.some((operation) => operation.operation === filter.operation))
|
|
1491
|
+
);
|
|
1492
|
+
}
|
|
1493
|
+
function deepFreeze(value) {
|
|
1494
|
+
if (value && typeof value === "object" && !Object.isFrozen(value)) {
|
|
1495
|
+
Object.freeze(value);
|
|
1496
|
+
for (const child of Object.values(value)) deepFreeze(child);
|
|
1497
|
+
}
|
|
1498
|
+
return value;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
export {
|
|
1502
|
+
NexraApiError,
|
|
1503
|
+
NexraTaskError,
|
|
1504
|
+
NexraWaitTimeoutError,
|
|
1505
|
+
HttpTransport,
|
|
1506
|
+
jsonBody,
|
|
1507
|
+
queryString,
|
|
1508
|
+
sleep,
|
|
1509
|
+
CatalogClient,
|
|
1510
|
+
getModelSpec,
|
|
1511
|
+
listModelSpecs
|
|
1512
|
+
};
|