@byte_fluffy/nexra-sdk 0.1.0-alpha.21 → 0.1.0-alpha.22

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,14 +9,18 @@ npm install @byte_fluffy/nexra-sdk@next
9
9
  ```
10
10
 
11
11
  ```ts
12
- import { createNexra, getModelSpec, type NexraImageGenerateInput } from "@byte_fluffy/nexra-sdk";
12
+ import { createNexra, getModelSpec, projectMediaGeometry } 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 input: NexraImageGenerateInput = {
17
- content: [{ type: "text", text: "A paper boat on a blue table", role: "prompt" }],
18
- resolution: "1k",
19
- aspect_ratio: "1:1",
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",
20
24
  quality: "medium",
21
25
  };
22
26
  const quote = await nexra.catalog.quote({
@@ -24,15 +28,10 @@ const quote = await nexra.catalog.quote({
24
28
  operation: "image.generate",
25
29
  input,
26
30
  });
27
- const result = await nexra.run(spec!.id, input, { quoteToken: quote.quoteToken });
31
+ const result = await nexra.run(spec!.id, { input, quoteToken: quote.quoteToken });
28
32
  ```
29
33
 
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`.
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.
36
35
 
37
36
  The default API base URL is `https://api.nexra-ai.com/v1`. When overriding
38
37
  `baseUrl`, include the `/v1` API prefix.
package/dist/catalog.d.ts CHANGED
@@ -1,6 +1,5 @@
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';
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';
4
3
 
5
4
  declare class CatalogClient {
6
5
  private readonly transport;
package/dist/catalog.js CHANGED
@@ -6,8 +6,7 @@ import {
6
6
  getModelSpec,
7
7
  listModelSpecs,
8
8
  projectMediaGeometry
9
- } from "./chunk-WU62FGYW.js";
10
- import "./chunk-TA3YGQQY.js";
9
+ } from "./chunk-2DKVYO26.js";
11
10
  export {
12
11
  CatalogClient,
13
12
  applyMediaGeometry,