@byte_fluffy/nexra-sdk 0.1.0-alpha.4 → 0.1.0-alpha.5
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 +9 -3
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.js +11 -3
- package/dist/{chunk-AV3GN4TV.js → chunk-2C2ZZKUC.js} +572 -87
- package/dist/{index-mytCeh5t.d.ts → index-FyUOK0F-.d.ts} +32 -1
- package/dist/index.d.ts +91 -3
- package/dist/index.js +246 -10
- package/package.json +1 -1
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 } 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
|
-
const spec = getModelSpec("gpt-image-2");
|
|
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
|
+
|
|
16
19
|
const input = {
|
|
17
20
|
model: spec!.id,
|
|
18
21
|
prompt: "A paper boat on a blue table",
|
|
19
|
-
|
|
22
|
+
resolution: "1K",
|
|
23
|
+
ratio: "1:1",
|
|
20
24
|
quality: "medium",
|
|
21
25
|
};
|
|
22
26
|
const quote = await nexra.catalog.quote({
|
|
@@ -27,6 +31,8 @@ const quote = await nexra.catalog.quote({
|
|
|
27
31
|
const result = await nexra.run(spec!.id, { input, quoteToken: quote.quoteToken });
|
|
28
32
|
```
|
|
29
33
|
|
|
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.
|
|
35
|
+
|
|
30
36
|
The default API base URL is `https://api.nexra-ai.com/v1`. When overriding
|
|
31
37
|
`baseUrl`, include the `/v1` API prefix.
|
|
32
38
|
|
package/dist/catalog.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { d as CatalogClient, h as CreateNexraQuoteRequest,
|
|
1
|
+
export { d as CatalogClient, h as CreateNexraQuoteRequest, j as MediaGeometryField, k as MediaGeometryProjection, w as NexraBillingCurrency, x as NexraModelOperation, y as NexraModelSpec, z as NexraModelSpecFilter, A as NexraQuote, D as NexraSalePrice, N as NexraSettlement, U as UnifiedMediaGeometry, S as applyMediaGeometry, W as decodeMediaGeometry, X as encodeMediaGeometry, Z as getModelSpec, $ as listModelSpecs, a0 as projectMediaGeometry } from './index-FyUOK0F-.js';
|
package/dist/catalog.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CatalogClient,
|
|
3
|
+
applyMediaGeometry,
|
|
4
|
+
decodeMediaGeometry,
|
|
5
|
+
encodeMediaGeometry,
|
|
3
6
|
getModelSpec,
|
|
4
|
-
listModelSpecs
|
|
5
|
-
|
|
7
|
+
listModelSpecs,
|
|
8
|
+
projectMediaGeometry
|
|
9
|
+
} from "./chunk-2C2ZZKUC.js";
|
|
6
10
|
export {
|
|
7
11
|
CatalogClient,
|
|
12
|
+
applyMediaGeometry,
|
|
13
|
+
decodeMediaGeometry,
|
|
14
|
+
encodeMediaGeometry,
|
|
8
15
|
getModelSpec,
|
|
9
|
-
listModelSpecs
|
|
16
|
+
listModelSpecs,
|
|
17
|
+
projectMediaGeometry
|
|
10
18
|
};
|