@byte_fluffy/nexra-sdk 0.1.0-alpha.41 → 0.1.0-alpha.42
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 +29 -1
- package/dist/catalog.js +2 -2
- package/dist/{chunk-QHQJD3EN.js → chunk-ESPUF2D4.js} +14 -2
- package/dist/{chunk-BIAPYH3J.js → chunk-QPUI7EN7.js} +263 -2
- package/dist/index.js +2 -2
- package/dist/language.js +2 -2
- package/dist/media.d.ts +3 -2
- package/dist/media.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ const result = await nexra.run(spec!.id, input, { quoteToken: quote.quoteToken }
|
|
|
29
29
|
|
|
30
30
|
Media apps send the versioned Nexra category contract: ordered `content` parts plus
|
|
31
31
|
the common parameters for `image.generate`, `video.generate`, `audio.generate` or
|
|
32
|
-
`image.upscale`. The server resolves the selected model component and explicitly
|
|
32
|
+
`image.upscale` or `video.upscale`. The server resolves the selected model component and explicitly
|
|
33
33
|
adapts that input to the channel Provider. The SDK does not expose or emulate
|
|
34
34
|
Provider-native endpoints. Protocol constants, schemas and types are also
|
|
35
35
|
available from `@byte_fluffy/nexra-sdk/media`.
|
|
@@ -37,6 +37,34 @@ available from `@byte_fluffy/nexra-sdk/media`.
|
|
|
37
37
|
The default API base URL is `https://api.nexra-ai.com/v1`. When overriding
|
|
38
38
|
`baseUrl`, include the `/v1` API prefix.
|
|
39
39
|
|
|
40
|
+
## Image and video upscale
|
|
41
|
+
|
|
42
|
+
`0.1.0-alpha.42` adds `bytedance/image-enhancement` and
|
|
43
|
+
`bytedance/video-super-resolution`. Both use the Task API and the existing
|
|
44
|
+
asset delivery lifecycle. Read the stored result from `result.assets`; wait for
|
|
45
|
+
delivery to finish before treating an output URL as permanent.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
const image = await nexra.run("bytedance/image-enhancement", {
|
|
49
|
+
content: [{ type: "image", role: "source", source: "https://example.com/input.png" }],
|
|
50
|
+
resolution: "2k",
|
|
51
|
+
});
|
|
52
|
+
const video = await nexra.run("bytedance/video-super-resolution", {
|
|
53
|
+
content: [{ type: "video", role: "source", source: "https://example.com/input.mp4" }],
|
|
54
|
+
source_duration: 5, // Upper bound in seconds; checked before enhancement.
|
|
55
|
+
resolution: "1080p",
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Image upscale supports `144p`, `240p`, `360p`, `480p`, `540p`, `720p`,
|
|
60
|
+
`1080p`, and `2k` (default). Video upscale supports `720p`, `1080p` (default),
|
|
61
|
+
`2k`, and `4k`.
|
|
62
|
+
|
|
63
|
+
The migrated task input also accepts the existing image fields
|
|
64
|
+
`image_url`, `resolution_boundary`, `enable_hdr`, and `enable_wb`, or the video
|
|
65
|
+
fields `video_url`/`vid`, `config`, and `target.res`. Use one input contract per
|
|
66
|
+
request. Credentials, VOD space, and playback signing belong to the server channel.
|
|
67
|
+
|
|
40
68
|
## Dolphin Seedance
|
|
41
69
|
|
|
42
70
|
`0.1.0-alpha.41` adds the independently addressable models
|
package/dist/catalog.js
CHANGED
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
listModelSpecs,
|
|
10
10
|
projectMediaGeometry,
|
|
11
11
|
resolveNexraLanguageReasoning
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-QPUI7EN7.js";
|
|
13
|
+
import "./chunk-ESPUF2D4.js";
|
|
14
14
|
export {
|
|
15
15
|
CatalogClient,
|
|
16
16
|
applyMediaGeometry,
|
|
@@ -417,7 +417,8 @@ var NEXRA_PUBLISHED_MEDIA_OPERATIONS = [
|
|
|
417
417
|
"image.generate",
|
|
418
418
|
"video.generate",
|
|
419
419
|
"audio.generate",
|
|
420
|
-
"image.upscale"
|
|
420
|
+
"image.upscale",
|
|
421
|
+
"video.upscale"
|
|
421
422
|
];
|
|
422
423
|
var NEXRA_MEDIA_FEATURES = [
|
|
423
424
|
"text-to-image",
|
|
@@ -476,7 +477,7 @@ var NEXRA_MEDIA_OPERATION_DEFINITIONS = Object.freeze([
|
|
|
476
477
|
},
|
|
477
478
|
{
|
|
478
479
|
operation: "video.upscale",
|
|
479
|
-
status: "
|
|
480
|
+
status: "active",
|
|
480
481
|
outputKind: "video",
|
|
481
482
|
features: ["scale-factor", "target-resolution"],
|
|
482
483
|
parameterKeys: ["scale", "resolution", "output_format", "preserve_details"]
|
|
@@ -606,6 +607,17 @@ var NEXRA_MEDIA_INPUT_SCHEMAS = Object.freeze({
|
|
|
606
607
|
preserve_details: { type: "boolean", "x-ui": { order: 13, control: "switch" } }
|
|
607
608
|
},
|
|
608
609
|
{ minItems: 1, maxItems: 1 }
|
|
610
|
+
),
|
|
611
|
+
"video.upscale": inputSchema(
|
|
612
|
+
[mediaPartSchema("video", ["source"])],
|
|
613
|
+
{
|
|
614
|
+
source_duration: { type: "number", exclusiveMinimum: 0, "x-ui": { order: 9, control: "number" } },
|
|
615
|
+
scale: { type: "number", exclusiveMinimum: 1, "x-ui": { order: 10, control: "number" } },
|
|
616
|
+
resolution: { type: "string", minLength: 1, "x-ui": { order: 11 } },
|
|
617
|
+
output_format: { type: "string", minLength: 1, "x-ui": { order: 12 } },
|
|
618
|
+
preserve_details: { type: "boolean", "x-ui": { order: 13, control: "switch" } }
|
|
619
|
+
},
|
|
620
|
+
{ minItems: 1, maxItems: 1 }
|
|
609
621
|
)
|
|
610
622
|
});
|
|
611
623
|
function nexraMediaInputSchema(operation) {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
normalizePublicErrorInput,
|
|
3
3
|
pickPublicErrorFields,
|
|
4
4
|
sortRatioDisplayOrder
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ESPUF2D4.js";
|
|
6
6
|
|
|
7
7
|
// src/catalog/generated/audio.generated.json
|
|
8
8
|
var audio_generated_default = [
|
|
@@ -2799,6 +2799,137 @@ var audio_generated_default = [
|
|
|
2799
2799
|
|
|
2800
2800
|
// src/catalog/generated/image.generated.json
|
|
2801
2801
|
var image_generated_default = [
|
|
2802
|
+
{
|
|
2803
|
+
id: "bytedance/image-enhancement",
|
|
2804
|
+
contractVersion: 1,
|
|
2805
|
+
developer: "bytedance",
|
|
2806
|
+
displayName: "Volcengine Image Enhancement",
|
|
2807
|
+
summary: "Upscale an image with Volcengine CVProcess and save the output.",
|
|
2808
|
+
kind: "image",
|
|
2809
|
+
family: "Volcengine Upscale",
|
|
2810
|
+
aliases: [],
|
|
2811
|
+
capabilities: {
|
|
2812
|
+
inputModalities: [
|
|
2813
|
+
"image"
|
|
2814
|
+
],
|
|
2815
|
+
outputModalities: [
|
|
2816
|
+
"image"
|
|
2817
|
+
],
|
|
2818
|
+
inputModes: [],
|
|
2819
|
+
features: []
|
|
2820
|
+
},
|
|
2821
|
+
operations: [
|
|
2822
|
+
{
|
|
2823
|
+
operation: "image.upscale",
|
|
2824
|
+
inputModalities: [
|
|
2825
|
+
"image"
|
|
2826
|
+
],
|
|
2827
|
+
outputModalities: [
|
|
2828
|
+
"image"
|
|
2829
|
+
],
|
|
2830
|
+
inputSchema: {
|
|
2831
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
2832
|
+
type: "object",
|
|
2833
|
+
properties: {
|
|
2834
|
+
content: {
|
|
2835
|
+
type: "array",
|
|
2836
|
+
minItems: 1,
|
|
2837
|
+
maxItems: 1,
|
|
2838
|
+
items: {
|
|
2839
|
+
oneOf: [
|
|
2840
|
+
{
|
|
2841
|
+
type: "object",
|
|
2842
|
+
properties: {
|
|
2843
|
+
type: {
|
|
2844
|
+
const: "image"
|
|
2845
|
+
},
|
|
2846
|
+
source: {
|
|
2847
|
+
oneOf: [
|
|
2848
|
+
{
|
|
2849
|
+
type: "string",
|
|
2850
|
+
minLength: 1
|
|
2851
|
+
},
|
|
2852
|
+
{
|
|
2853
|
+
type: "object",
|
|
2854
|
+
properties: {
|
|
2855
|
+
assetId: {
|
|
2856
|
+
type: "string",
|
|
2857
|
+
minLength: 1
|
|
2858
|
+
}
|
|
2859
|
+
},
|
|
2860
|
+
required: [
|
|
2861
|
+
"assetId"
|
|
2862
|
+
],
|
|
2863
|
+
additionalProperties: false
|
|
2864
|
+
}
|
|
2865
|
+
]
|
|
2866
|
+
},
|
|
2867
|
+
role: {
|
|
2868
|
+
type: "string",
|
|
2869
|
+
enum: [
|
|
2870
|
+
"source"
|
|
2871
|
+
]
|
|
2872
|
+
}
|
|
2873
|
+
},
|
|
2874
|
+
required: [
|
|
2875
|
+
"type",
|
|
2876
|
+
"source"
|
|
2877
|
+
],
|
|
2878
|
+
additionalProperties: false
|
|
2879
|
+
}
|
|
2880
|
+
]
|
|
2881
|
+
},
|
|
2882
|
+
"x-ui": {
|
|
2883
|
+
control: "content-parts",
|
|
2884
|
+
order: 0
|
|
2885
|
+
}
|
|
2886
|
+
},
|
|
2887
|
+
resolution: {
|
|
2888
|
+
type: "string",
|
|
2889
|
+
enum: [
|
|
2890
|
+
"144p",
|
|
2891
|
+
"240p",
|
|
2892
|
+
"360p",
|
|
2893
|
+
"480p",
|
|
2894
|
+
"540p",
|
|
2895
|
+
"720p",
|
|
2896
|
+
"1080p",
|
|
2897
|
+
"2k"
|
|
2898
|
+
],
|
|
2899
|
+
default: "2k",
|
|
2900
|
+
"x-ui": {
|
|
2901
|
+
order: 11
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
},
|
|
2905
|
+
required: [
|
|
2906
|
+
"content"
|
|
2907
|
+
],
|
|
2908
|
+
additionalProperties: false
|
|
2909
|
+
},
|
|
2910
|
+
outputSchema: {},
|
|
2911
|
+
metering: {
|
|
2912
|
+
schemaVersion: 1,
|
|
2913
|
+
kind: "non_token",
|
|
2914
|
+
metrics: [
|
|
2915
|
+
{
|
|
2916
|
+
metric: "requests",
|
|
2917
|
+
requirement: "required"
|
|
2918
|
+
},
|
|
2919
|
+
{
|
|
2920
|
+
metric: "input_images",
|
|
2921
|
+
requirement: "required"
|
|
2922
|
+
},
|
|
2923
|
+
{
|
|
2924
|
+
metric: "output_images",
|
|
2925
|
+
requirement: "required"
|
|
2926
|
+
}
|
|
2927
|
+
]
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
],
|
|
2931
|
+
endpoints: []
|
|
2932
|
+
},
|
|
2802
2933
|
{
|
|
2803
2934
|
id: "google/gemini-nano-banana-2.1",
|
|
2804
2935
|
contractVersion: 1,
|
|
@@ -32592,6 +32723,136 @@ var language_generated_default = [
|
|
|
32592
32723
|
|
|
32593
32724
|
// src/catalog/generated/video.generated.json
|
|
32594
32725
|
var video_generated_default = [
|
|
32726
|
+
{
|
|
32727
|
+
id: "bytedance/video-super-resolution",
|
|
32728
|
+
contractVersion: 1,
|
|
32729
|
+
developer: "bytedance",
|
|
32730
|
+
displayName: "Volcengine Video Super Resolution",
|
|
32731
|
+
summary: "Upscale a video through Volcengine VOD and save the output.",
|
|
32732
|
+
kind: "video",
|
|
32733
|
+
family: "Volcengine Upscale",
|
|
32734
|
+
aliases: [],
|
|
32735
|
+
capabilities: {
|
|
32736
|
+
inputModalities: [
|
|
32737
|
+
"video"
|
|
32738
|
+
],
|
|
32739
|
+
outputModalities: [
|
|
32740
|
+
"video"
|
|
32741
|
+
],
|
|
32742
|
+
inputModes: [],
|
|
32743
|
+
features: []
|
|
32744
|
+
},
|
|
32745
|
+
operations: [
|
|
32746
|
+
{
|
|
32747
|
+
operation: "video.upscale",
|
|
32748
|
+
inputModalities: [
|
|
32749
|
+
"video"
|
|
32750
|
+
],
|
|
32751
|
+
outputModalities: [
|
|
32752
|
+
"video"
|
|
32753
|
+
],
|
|
32754
|
+
inputSchema: {
|
|
32755
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
32756
|
+
type: "object",
|
|
32757
|
+
properties: {
|
|
32758
|
+
content: {
|
|
32759
|
+
type: "array",
|
|
32760
|
+
minItems: 1,
|
|
32761
|
+
maxItems: 1,
|
|
32762
|
+
items: {
|
|
32763
|
+
oneOf: [
|
|
32764
|
+
{
|
|
32765
|
+
type: "object",
|
|
32766
|
+
properties: {
|
|
32767
|
+
type: {
|
|
32768
|
+
const: "video"
|
|
32769
|
+
},
|
|
32770
|
+
source: {
|
|
32771
|
+
oneOf: [
|
|
32772
|
+
{
|
|
32773
|
+
type: "string",
|
|
32774
|
+
minLength: 1
|
|
32775
|
+
},
|
|
32776
|
+
{
|
|
32777
|
+
type: "object",
|
|
32778
|
+
properties: {
|
|
32779
|
+
assetId: {
|
|
32780
|
+
type: "string",
|
|
32781
|
+
minLength: 1
|
|
32782
|
+
}
|
|
32783
|
+
},
|
|
32784
|
+
required: [
|
|
32785
|
+
"assetId"
|
|
32786
|
+
],
|
|
32787
|
+
additionalProperties: false
|
|
32788
|
+
}
|
|
32789
|
+
]
|
|
32790
|
+
},
|
|
32791
|
+
role: {
|
|
32792
|
+
type: "string",
|
|
32793
|
+
enum: [
|
|
32794
|
+
"source"
|
|
32795
|
+
]
|
|
32796
|
+
}
|
|
32797
|
+
},
|
|
32798
|
+
required: [
|
|
32799
|
+
"type",
|
|
32800
|
+
"source"
|
|
32801
|
+
],
|
|
32802
|
+
additionalProperties: false
|
|
32803
|
+
}
|
|
32804
|
+
]
|
|
32805
|
+
},
|
|
32806
|
+
"x-ui": {
|
|
32807
|
+
control: "content-parts",
|
|
32808
|
+
order: 0
|
|
32809
|
+
}
|
|
32810
|
+
},
|
|
32811
|
+
source_duration: {
|
|
32812
|
+
type: "number",
|
|
32813
|
+
exclusiveMinimum: 0,
|
|
32814
|
+
description: "Upper bound on source duration in seconds, verified before enhancement."
|
|
32815
|
+
},
|
|
32816
|
+
resolution: {
|
|
32817
|
+
type: "string",
|
|
32818
|
+
enum: [
|
|
32819
|
+
"720p",
|
|
32820
|
+
"1080p",
|
|
32821
|
+
"2k",
|
|
32822
|
+
"4k"
|
|
32823
|
+
],
|
|
32824
|
+
default: "1080p"
|
|
32825
|
+
}
|
|
32826
|
+
},
|
|
32827
|
+
required: [
|
|
32828
|
+
"content",
|
|
32829
|
+
"source_duration"
|
|
32830
|
+
],
|
|
32831
|
+
additionalProperties: false
|
|
32832
|
+
},
|
|
32833
|
+
outputSchema: {},
|
|
32834
|
+
metering: {
|
|
32835
|
+
schemaVersion: 1,
|
|
32836
|
+
kind: "non_token",
|
|
32837
|
+
metrics: [
|
|
32838
|
+
{
|
|
32839
|
+
metric: "requests",
|
|
32840
|
+
requirement: "required"
|
|
32841
|
+
},
|
|
32842
|
+
{
|
|
32843
|
+
metric: "input_video_seconds",
|
|
32844
|
+
requirement: "required"
|
|
32845
|
+
},
|
|
32846
|
+
{
|
|
32847
|
+
metric: "output_video_seconds",
|
|
32848
|
+
requirement: "required"
|
|
32849
|
+
}
|
|
32850
|
+
]
|
|
32851
|
+
}
|
|
32852
|
+
}
|
|
32853
|
+
],
|
|
32854
|
+
endpoints: []
|
|
32855
|
+
},
|
|
32595
32856
|
{
|
|
32596
32857
|
id: "dolphin/seedance-2-0",
|
|
32597
32858
|
contractVersion: 1,
|
|
@@ -54747,7 +55008,7 @@ var NexraWaitTimeoutError = class extends Error {
|
|
|
54747
55008
|
};
|
|
54748
55009
|
|
|
54749
55010
|
// src/generated/version.generated.ts
|
|
54750
|
-
var SDK_VERSION = "0.1.0-alpha.
|
|
55011
|
+
var SDK_VERSION = "0.1.0-alpha.42";
|
|
54751
55012
|
|
|
54752
55013
|
// src/transport.ts
|
|
54753
55014
|
var DEFAULT_BASE_URL = "https://api.nexra-ai.com/v1";
|
package/dist/index.js
CHANGED
|
@@ -20,14 +20,14 @@ import {
|
|
|
20
20
|
projectMediaGeometry,
|
|
21
21
|
queryString,
|
|
22
22
|
sleep
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-QPUI7EN7.js";
|
|
24
24
|
import {
|
|
25
25
|
MEDIA_KINDS,
|
|
26
26
|
TASK_STATUSES,
|
|
27
27
|
createTaskRequest,
|
|
28
28
|
extractUpstreamErrorMessage,
|
|
29
29
|
isTerminalTaskStatus
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-ESPUF2D4.js";
|
|
31
31
|
|
|
32
32
|
// src/assets.ts
|
|
33
33
|
var AssetsClient = class {
|
package/dist/language.js
CHANGED
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
jsonBody,
|
|
7
7
|
parseServerSentEvents,
|
|
8
8
|
resolveNexraLanguageReasoning
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QPUI7EN7.js";
|
|
10
10
|
import {
|
|
11
11
|
isPublicErrorCode,
|
|
12
12
|
publicErrorMessage,
|
|
13
13
|
resolvePublicErrorLocale
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ESPUF2D4.js";
|
|
15
15
|
|
|
16
16
|
// src/language/index.ts
|
|
17
17
|
import { createAnthropic } from "@ai-sdk/anthropic";
|
package/dist/media.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare const NEXRA_GENERATION_OPERATIONS: readonly ["text.generate", "image.gen
|
|
|
7
7
|
type NexraGenerationOperation = (typeof NEXRA_GENERATION_OPERATIONS)[number];
|
|
8
8
|
declare const NEXRA_MEDIA_OPERATIONS: readonly ["image.generate", "video.generate", "audio.generate", "image.upscale", "video.upscale"];
|
|
9
9
|
type NexraMediaOperation = (typeof NEXRA_MEDIA_OPERATIONS)[number];
|
|
10
|
-
declare const NEXRA_PUBLISHED_MEDIA_OPERATIONS: readonly ["image.generate", "video.generate", "audio.generate", "image.upscale"];
|
|
10
|
+
declare const NEXRA_PUBLISHED_MEDIA_OPERATIONS: readonly ["image.generate", "video.generate", "audio.generate", "image.upscale", "video.upscale"];
|
|
11
11
|
type NexraPublishedMediaOperation = (typeof NEXRA_PUBLISHED_MEDIA_OPERATIONS)[number];
|
|
12
12
|
declare const NEXRA_MEDIA_FEATURES: readonly ["text-to-image", "image-to-image", "image-reference", "image-edit", "image-inpaint", "image-control", "text-to-video", "first-frame", "first-last-frame", "image-to-video", "video-to-video", "audio-to-video", "avatar-video", "reference-image", "reference-video", "reference-audio", "omni-reference", "tts", "music", "sfx", "voice-reference", "voice-design", "scale-factor", "target-resolution"];
|
|
13
13
|
type NexraMediaFeature = (typeof NEXRA_MEDIA_FEATURES)[number];
|
|
@@ -105,6 +105,7 @@ type NexraImageUpscaleInput = Readonly<{
|
|
|
105
105
|
preserve_details?: boolean;
|
|
106
106
|
}>;
|
|
107
107
|
type NexraVideoUpscaleInput = Readonly<{
|
|
108
|
+
source_duration: number;
|
|
108
109
|
content: readonly [NexraVideoContentPart];
|
|
109
110
|
scale?: number;
|
|
110
111
|
resolution?: string;
|
|
@@ -198,7 +199,7 @@ declare const NEXRA_MEDIA_OPERATION_DEFINITIONS: readonly [{
|
|
|
198
199
|
readonly parameterKeys: readonly ["scale", "resolution", "output_format", "preserve_details"];
|
|
199
200
|
}, {
|
|
200
201
|
readonly operation: "video.upscale";
|
|
201
|
-
readonly status: "
|
|
202
|
+
readonly status: "active";
|
|
202
203
|
readonly outputKind: "video";
|
|
203
204
|
readonly features: readonly ["scale-factor", "target-resolution"];
|
|
204
205
|
readonly parameterKeys: readonly ["scale", "resolution", "output_format", "preserve_details"];
|
package/dist/media.js
CHANGED