@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 +11 -12
- package/dist/catalog.d.ts +2 -3
- package/dist/catalog.js +1 -2
- package/dist/{chunk-WU62FGYW.js → chunk-2DKVYO26.js} +16414 -11152
- package/dist/index.d.ts +5 -8
- package/dist/index.js +23 -16
- package/dist/{media-geometry-Bo6ukeIQ.d.ts → media-geometry-Ckr1-Mh3.d.ts} +21 -34
- package/dist/{types-DPLgTh8D.d.ts → types-CcYROaH1.d.ts} +76 -29
- package/dist/types.d.ts +2 -4
- package/package.json +1 -5
- package/dist/assets-dUJMQNJD.d.ts +0 -61
- package/dist/chunk-TA3YGQQY.js +0 -386
- package/dist/json-Drjj1OKl.d.ts +0 -11
- package/dist/media.d.ts +0 -200
- package/dist/media.js +0 -26
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,
|
|
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
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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,
|
|
31
|
+
const result = await nexra.run(spec!.id, { input, quoteToken: quote.quoteToken });
|
|
28
32
|
```
|
|
29
33
|
|
|
30
|
-
|
|
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-
|
|
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-
|
|
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;
|