@byte_fluffy/nexra-sdk 0.1.0-alpha.3 → 0.1.0-alpha.4
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
|
@@ -33,3 +33,31 @@ The default API base URL is `https://api.nexra-ai.com/v1`. When overriding
|
|
|
33
33
|
Static catalog APIs are also available from `@byte_fluffy/nexra-sdk/catalog`.
|
|
34
34
|
Exact non-negative decimal helpers are available from
|
|
35
35
|
`@byte_fluffy/nexra-sdk/decimal`.
|
|
36
|
+
|
|
37
|
+
## Directory layout
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
src/
|
|
41
|
+
index.ts Public entry; re-exports the catalog, client, etc.
|
|
42
|
+
catalog/
|
|
43
|
+
index.ts CatalogClient, getModelSpec, listModelSpecs
|
|
44
|
+
generated/ Generated artifacts (committed; required to publish)
|
|
45
|
+
image.generated.json One file per model kind (image, video, audio, ...)
|
|
46
|
+
index.ts Imports every kind JSON and exports the merged array
|
|
47
|
+
generated/
|
|
48
|
+
version.generated.ts SDK_VERSION used by the transport
|
|
49
|
+
... client, tasks, assets, input, sse, webhooks, errors, ...
|
|
50
|
+
scripts/
|
|
51
|
+
generate-public-catalog.ts Projects models from @nexra/models and writes
|
|
52
|
+
src/catalog/generated/*
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Adding a new public model
|
|
56
|
+
|
|
57
|
+
1. Add its ID to `PUBLIC_MODEL_IDS` in `scripts/generate-public-catalog.ts`.
|
|
58
|
+
2. Run `bun run generate` (from `packages/sdk`).
|
|
59
|
+
3. The script groups projected models by `model.kind`, writes one
|
|
60
|
+
`src/catalog/generated/<kind>.generated.json` per kind (new kinds appear
|
|
61
|
+
automatically), regenerates the merging `index.ts`, and bumps
|
|
62
|
+
`src/generated/version.generated.ts`. No hand-written code changes.
|
|
63
|
+
|
package/dist/catalog.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { d as CatalogClient, h as CreateNexraQuoteRequest, u as NexraBillingCurrency, v as NexraModelOperation, w as NexraModelSpec, x as NexraModelSpecFilter, y as NexraQuote, z as NexraSalePrice, N as NexraSettlement, R as getModelSpec, V as listModelSpecs } from './
|
|
1
|
+
export { d as CatalogClient, h as CreateNexraQuoteRequest, u as NexraBillingCurrency, v as NexraModelOperation, w as NexraModelSpec, x as NexraModelSpecFilter, y as NexraQuote, z as NexraSalePrice, N as NexraSettlement, R as getModelSpec, V as listModelSpecs } from './index-mytCeh5t.js';
|
package/dist/catalog.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// src/generated/
|
|
2
|
-
var
|
|
1
|
+
// src/catalog/generated/image.generated.json
|
|
2
|
+
var image_generated_default = [
|
|
3
3
|
{
|
|
4
4
|
id: "openai/gpt-image-2.5-flare",
|
|
5
5
|
contractVersion: 2,
|
|
@@ -6023,6 +6023,11 @@ var public_catalog_generated_default = [
|
|
|
6023
6023
|
}
|
|
6024
6024
|
];
|
|
6025
6025
|
|
|
6026
|
+
// src/catalog/generated/index.ts
|
|
6027
|
+
var generatedCatalog = Object.freeze([
|
|
6028
|
+
...image_generated_default
|
|
6029
|
+
]);
|
|
6030
|
+
|
|
6026
6031
|
// src/errors.ts
|
|
6027
6032
|
var NexraApiError = class extends Error {
|
|
6028
6033
|
status;
|
|
@@ -6060,7 +6065,7 @@ var NexraWaitTimeoutError = class extends Error {
|
|
|
6060
6065
|
};
|
|
6061
6066
|
|
|
6062
6067
|
// src/generated/version.generated.ts
|
|
6063
|
-
var SDK_VERSION = "0.1.0-alpha.
|
|
6068
|
+
var SDK_VERSION = "0.1.0-alpha.4";
|
|
6064
6069
|
|
|
6065
6070
|
// src/transport.ts
|
|
6066
6071
|
var DEFAULT_BASE_URL = "https://api.nexra-ai.com/v1";
|
|
@@ -6182,8 +6187,8 @@ async function waitForRetry(response, attempt, signal) {
|
|
|
6182
6187
|
await sleep(Number.isFinite(seconds) ? seconds * 1e3 : 200 * 2 ** attempt, signal);
|
|
6183
6188
|
}
|
|
6184
6189
|
|
|
6185
|
-
// src/catalog.ts
|
|
6186
|
-
var modelSpecs = deepFreeze(structuredClone(
|
|
6190
|
+
// src/catalog/index.ts
|
|
6191
|
+
var modelSpecs = deepFreeze(structuredClone(generatedCatalog));
|
|
6187
6192
|
var byIdentifier = /* @__PURE__ */ new Map();
|
|
6188
6193
|
for (const model of modelSpecs) {
|
|
6189
6194
|
for (const identifier of [model.id, ...model.aliases]) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { J as JsonObject, B as BillingMetric, a as JsonValue, N as NexraSettlement, C as CursorPage, H as HttpTransport, M as ModelSearchParams, T as TaskModelSummary, b as TaskModel, c as ModelSchema, d as CatalogClient, e as NexraClientOptions } from './
|
|
2
|
-
export { f as BILLING_EXPORT_DIMENSIONS, g as BILLING_METRICS, h as CreateNexraQuoteRequest, F as FetchLike, i as JsonPrimitive, j as MeteredPriceRate, k as MeteredPriceRuleV1, l as MeteredUsageComponent, m as MeteringContract, n as MeteringKind, o as ModelCapabilitySummary, p as ModelDateVersion, q as ModelEndpointSummary, r as ModelModality, s as ModelResourceList, t as ModelResourceOption, u as NexraBillingCurrency, v as NexraModelOperation, w as NexraModelSpec, x as NexraModelSpecFilter, y as NexraQuote, z as NexraSalePrice, A as NormalizedUsageV1, P as PriceEvaluation, D as PriceEvaluationIssue, E as PriceEvaluationLine, G as PriceRule, U as UsageComponentEvidence, I as UsageEvidenceAssessment, K as UsageEvidenceStatus, L as allocateDiscountedPriceLines, O as assessUsageEvidence, Q as evaluatePriceRule, R as getModelSpec, S as jsonBody, V as listModelSpecs, W as queryString, X as sleep, Y as validateMeteringContract, Z as validateNormalizedUsage, _ as validatePriceRule } from './
|
|
1
|
+
import { J as JsonObject, B as BillingMetric, a as JsonValue, N as NexraSettlement, C as CursorPage, H as HttpTransport, M as ModelSearchParams, T as TaskModelSummary, b as TaskModel, c as ModelSchema, d as CatalogClient, e as NexraClientOptions } from './index-mytCeh5t.js';
|
|
2
|
+
export { f as BILLING_EXPORT_DIMENSIONS, g as BILLING_METRICS, h as CreateNexraQuoteRequest, F as FetchLike, i as JsonPrimitive, j as MeteredPriceRate, k as MeteredPriceRuleV1, l as MeteredUsageComponent, m as MeteringContract, n as MeteringKind, o as ModelCapabilitySummary, p as ModelDateVersion, q as ModelEndpointSummary, r as ModelModality, s as ModelResourceList, t as ModelResourceOption, u as NexraBillingCurrency, v as NexraModelOperation, w as NexraModelSpec, x as NexraModelSpecFilter, y as NexraQuote, z as NexraSalePrice, A as NormalizedUsageV1, P as PriceEvaluation, D as PriceEvaluationIssue, E as PriceEvaluationLine, G as PriceRule, U as UsageComponentEvidence, I as UsageEvidenceAssessment, K as UsageEvidenceStatus, L as allocateDiscountedPriceLines, O as assessUsageEvidence, Q as evaluatePriceRule, R as getModelSpec, S as jsonBody, V as listModelSpecs, W as queryString, X as sleep, Y as validateMeteringContract, Z as validateNormalizedUsage, _ as validatePriceRule } from './index-mytCeh5t.js';
|
|
3
3
|
export { ceilDecimal, multiplyDecimal } from './decimal.js';
|
|
4
4
|
|
|
5
5
|
declare const MEDIA_KINDS: readonly ["image", "video", "audio", "document", "archive", "other"];
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byte_fluffy/nexra-sdk",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"generate": "bun scripts/generate-public-catalog.ts",
|
|
35
|
-
"build": "bun run generate && tsup
|
|
35
|
+
"build": "bun run generate && tsup",
|
|
36
36
|
"test": "vitest run --root ../.. packages/sdk/tests",
|
|
37
37
|
"prepack": "bun run build"
|
|
38
38
|
},
|
|
File without changes
|