@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 CHANGED
@@ -9,18 +9,14 @@ npm install @byte_fluffy/nexra-sdk@next
9
9
  ```
10
10
 
11
11
  ```ts
12
- import { createNexra, getModelSpec, projectMediaGeometry } from "@byte_fluffy/nexra-sdk";
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 geometry = projectMediaGeometry(spec!.operations[0]!.inputSchema);
17
- // geometry.resolution.options → ["1K","2K","4K"]; geometry.ratio.options → ["1:1", ...]
18
-
19
- const input = {
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, { input, quoteToken: quote.quoteToken });
27
+ const result = await nexra.run(spec!.id, input, { quoteToken: quote.quoteToken });
32
28
  ```
33
29
 
34
- Apps should send the unified geometry (`resolution` + `ratio` + `quality`). Quote and `run`/`create` map those fields onto the model's native catalog parameters (GPT Image `size: 1024x1024`, Seedream `size: 2K`, Grok `resolution: 1k` + `aspect_ratio`, …). `encodeMediaGeometry` / `decodeMediaGeometry` expose the same mapping without making a request. Native `size` already in the body is left unchanged.
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-Ckr1-Mh3.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-Ckr1-Mh3.js';
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;
package/dist/catalog.js CHANGED
@@ -6,7 +6,8 @@ import {
6
6
  getModelSpec,
7
7
  listModelSpecs,
8
8
  projectMediaGeometry
9
- } from "./chunk-2DKVYO26.js";
9
+ } from "./chunk-7V2P2UQD.js";
10
+ import "./chunk-TA3YGQQY.js";
10
11
  export {
11
12
  CatalogClient,
12
13
  applyMediaGeometry,