@byte_fluffy/nexra-sdk 0.1.0-alpha.22 → 0.1.0-alpha.24
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 +12 -11
- package/dist/assets-dUJMQNJD.d.ts +61 -0
- package/dist/catalog.d.ts +3 -2
- package/dist/catalog.js +2 -1
- package/dist/{chunk-2DKVYO26.js → chunk-7V2P2UQD.js} +11268 -16548
- package/dist/chunk-TA3YGQQY.js +386 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.js +16 -23
- package/dist/json-Drjj1OKl.d.ts +11 -0
- package/dist/{media-geometry-Ckr1-Mh3.d.ts → media-geometry-Bo6ukeIQ.d.ts} +34 -21
- package/dist/media.d.ts +200 -0
- package/dist/media.js +26 -0
- package/dist/{types-CcYROaH1.d.ts → types-DPLgTh8D.d.ts} +29 -76
- package/dist/types.d.ts +4 -2
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -9,18 +9,14 @@ npm install @byte_fluffy/nexra-sdk@next
|
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
|
-
import { createNexra, getModelSpec,
|
|
12
|
+
import { createNexra, getModelSpec, type NexraImageGenerateInput } from "@byte_fluffy/nexra-sdk";
|
|
13
13
|
|
|
14
14
|
const nexra = createNexra({ apiKey: process.env.NEXRA_API_KEY });
|
|
15
15
|
const spec = getModelSpec("openai/gpt-image-2");
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
model: spec!.id,
|
|
21
|
-
prompt: "A paper boat on a blue table",
|
|
22
|
-
resolution: "1K",
|
|
23
|
-
ratio: "1:1",
|
|
16
|
+
const input: NexraImageGenerateInput = {
|
|
17
|
+
content: [{ type: "text", text: "A paper boat on a blue table", role: "prompt" }],
|
|
18
|
+
resolution: "1k",
|
|
19
|
+
aspect_ratio: "1:1",
|
|
24
20
|
quality: "medium",
|
|
25
21
|
};
|
|
26
22
|
const quote = await nexra.catalog.quote({
|
|
@@ -28,10 +24,15 @@ const quote = await nexra.catalog.quote({
|
|
|
28
24
|
operation: "image.generate",
|
|
29
25
|
input,
|
|
30
26
|
});
|
|
31
|
-
const result = await nexra.run(spec!.id,
|
|
27
|
+
const result = await nexra.run(spec!.id, input, { quoteToken: quote.quoteToken });
|
|
32
28
|
```
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
Media apps send the versioned Nexra category contract: ordered `content` parts plus
|
|
31
|
+
the common parameters for `image.generate`, `video.generate`, `audio.generate` or
|
|
32
|
+
`image.upscale`. The server resolves the selected model component and explicitly
|
|
33
|
+
adapts that input to the channel Provider. The SDK does not expose or emulate
|
|
34
|
+
Provider-native endpoints. Protocol constants, schemas and types are also
|
|
35
|
+
available from `@byte_fluffy/nexra-sdk/media`.
|
|
35
36
|
|
|
36
37
|
The default API base URL is `https://api.nexra-ai.com/v1`. When overriding
|
|
37
38
|
`baseUrl`, include the `/v1` API prefix.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { J as JsonObject } from './json-Drjj1OKl.js';
|
|
2
|
+
|
|
3
|
+
declare const MEDIA_KINDS: readonly ["image", "video", "audio", "document", "archive", "other"];
|
|
4
|
+
type MediaKind = (typeof MEDIA_KINDS)[number];
|
|
5
|
+
type MediaAssetStatus = "pending" | "ready" | "failed" | "deleted";
|
|
6
|
+
interface MediaAsset {
|
|
7
|
+
id: string;
|
|
8
|
+
kind: MediaKind;
|
|
9
|
+
status: MediaAssetStatus;
|
|
10
|
+
source: "upload" | "generated" | "provider" | "imported";
|
|
11
|
+
name?: string;
|
|
12
|
+
mimeType?: string;
|
|
13
|
+
sizeBytes?: number;
|
|
14
|
+
width?: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
durationMs?: number;
|
|
17
|
+
checksumSha256?: string;
|
|
18
|
+
url?: string;
|
|
19
|
+
downloadUrl?: string;
|
|
20
|
+
expiresAt?: string;
|
|
21
|
+
metadata?: JsonObject;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
}
|
|
24
|
+
interface AssetReference {
|
|
25
|
+
assetId: string;
|
|
26
|
+
}
|
|
27
|
+
type AssetInput = AssetReference | Blob | File | MediaAsset | string | URL;
|
|
28
|
+
interface AssetUploadOptions {
|
|
29
|
+
kind?: MediaKind;
|
|
30
|
+
name?: string;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
}
|
|
33
|
+
interface AssetImportRequest {
|
|
34
|
+
url: string;
|
|
35
|
+
kind?: MediaKind;
|
|
36
|
+
name?: string;
|
|
37
|
+
}
|
|
38
|
+
type AssetCertificationProvider = "seedance";
|
|
39
|
+
type AssetCertificationStatus = "processing" | "ready" | "failed";
|
|
40
|
+
interface AssetCertification {
|
|
41
|
+
assetId: string;
|
|
42
|
+
provider: AssetCertificationProvider;
|
|
43
|
+
status: AssetCertificationStatus;
|
|
44
|
+
providerAssetId?: string;
|
|
45
|
+
assetUri?: string;
|
|
46
|
+
groupId?: string;
|
|
47
|
+
library: "general" | "liveness";
|
|
48
|
+
error?: string;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
updatedAt: string;
|
|
51
|
+
}
|
|
52
|
+
interface AssetCertificationRequest {
|
|
53
|
+
library?: "general" | "liveness";
|
|
54
|
+
}
|
|
55
|
+
interface AssetCertificationWaitOptions {
|
|
56
|
+
pollIntervalMs?: number;
|
|
57
|
+
timeoutMs?: number;
|
|
58
|
+
signal?: AbortSignal;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { type AssetReference as A, MEDIA_KINDS as M, type AssetImportRequest as a, type AssetInput as b, type AssetUploadOptions as c, type MediaAsset as d, type MediaAssetStatus as e, type MediaKind as f, type AssetCertificationRequest as g, type AssetCertification as h, type AssetCertificationWaitOptions as i };
|
package/dist/catalog.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { H as HttpTransport, N as NexraSalePriceList, C as CreateNexraQuoteRequest, a as NexraQuote, b as CreateNexraDisplayQuoteBatchRequest, c as NexraDisplayQuoteBatch, d as NexraCatalogRevision, e as NexraModelSpec, f as NexraModelSpecFilter } from './media-geometry-
|
|
2
|
-
export { M as MediaGeometryField, g as MediaGeometryProjection, h as NexraBillingCurrency, i as NexraModelEndpointSpec, j as NexraModelOperation, k as NexraSalePrice, l as NexraSettlement, U as UnifiedMediaGeometry, m as applyMediaGeometry, n as decodeMediaGeometry, o as encodeMediaGeometry, p as projectMediaGeometry } from './media-geometry-
|
|
1
|
+
import { H as HttpTransport, N as NexraSalePriceList, C as CreateNexraQuoteRequest, a as NexraQuote, b as CreateNexraDisplayQuoteBatchRequest, c as NexraDisplayQuoteBatch, d as NexraCatalogRevision, e as NexraModelSpec, f as NexraModelSpecFilter } from './media-geometry-Bo6ukeIQ.js';
|
|
2
|
+
export { M as MediaGeometryField, g as MediaGeometryProjection, h as NexraBillingCurrency, i as NexraModelEndpointSpec, j as NexraModelOperation, k as NexraSalePrice, l as NexraSettlement, U as UnifiedMediaGeometry, m as applyMediaGeometry, n as decodeMediaGeometry, o as encodeMediaGeometry, p as projectMediaGeometry } from './media-geometry-Bo6ukeIQ.js';
|
|
3
|
+
import './json-Drjj1OKl.js';
|
|
3
4
|
|
|
4
5
|
declare class CatalogClient {
|
|
5
6
|
private readonly transport;
|