@byte_fluffy/nexra-sdk 0.1.0-alpha.28 → 0.1.0-alpha.29
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 +71 -0
- package/dist/catalog.d.ts +24 -4
- package/dist/catalog.js +7 -3
- package/dist/{chunk-ECF5MLSM.js → chunk-ESV6ODRA.js} +10943 -1522
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -5
- package/dist/language.d.ts +16 -0
- package/dist/language.js +529 -0
- package/dist/{media-geometry-BoxkWQlj.d.ts → media-geometry-nJ7I7ohO.d.ts} +3 -1
- package/dist/{types-BYmoc0n8.d.ts → types-B3Xee2AJ.d.ts} +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +24 -1
package/README.md
CHANGED
|
@@ -171,6 +171,77 @@ const flashResult = await nexra.run("agnes/agnes-video-2-5-flash", flashInput, {
|
|
|
171
171
|
});
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
+
## Native language models
|
|
175
|
+
|
|
176
|
+
The optional `@byte_fluffy/nexra-sdk/language` entrypoint returns AI SDK
|
|
177
|
+
`LanguageModelV4` models. Install its optional provider peers when using this
|
|
178
|
+
entrypoint; the core SDK and media entrypoints do not load them. These provider
|
|
179
|
+
versions require Node.js 22 or a supported Bun runtime:
|
|
180
|
+
|
|
181
|
+
```sh
|
|
182
|
+
npm install @ai-sdk/provider@^4.0.2 @ai-sdk/provider-utils@^5.0.21 \
|
|
183
|
+
@ai-sdk/openai@^4.0.11 @ai-sdk/anthropic@^4.0.30 @ai-sdk/google@^4.0.12 ai@^7
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
import { generateText, streamText } from "ai";
|
|
188
|
+
import { getLanguageModelBinding } from "@byte_fluffy/nexra-sdk/catalog";
|
|
189
|
+
import { createNexraLanguageModel } from "@byte_fluffy/nexra-sdk/language";
|
|
190
|
+
|
|
191
|
+
const modelId = "openai/gpt-6-sol";
|
|
192
|
+
const binding = getLanguageModelBinding(modelId);
|
|
193
|
+
const model = createNexraLanguageModel(modelId, {
|
|
194
|
+
apiKey: process.env.NEXRA_API_KEY!,
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
if (binding.supportsStreaming) {
|
|
198
|
+
const result = streamText({ model, prompt: "Explain a paper boat", maxRetries: 0 });
|
|
199
|
+
for await (const text of result.textStream) process.stdout.write(text);
|
|
200
|
+
} else {
|
|
201
|
+
const result = await generateText({ model, prompt: "Explain a paper boat", maxRetries: 0 });
|
|
202
|
+
console.log(result.text);
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The binding selects a declared native endpoint, preferring Gemini, Responses,
|
|
207
|
+
Chat Completions, then Messages. Pass `protocol` to choose another endpoint
|
|
208
|
+
declared by that model. Native endpoint `inputSchema` and `outputSchema` describe
|
|
209
|
+
wire parameters; language operation schemas may describe Playground inputs.
|
|
210
|
+
`binding.maxOutputTokens` is the lower of the model capability and selected
|
|
211
|
+
native endpoint limit. Messages requests validate the combined visible and
|
|
212
|
+
thinking token budget before sending; explicit budgets are never clamped.
|
|
213
|
+
The SDK does not wrap text requests in media Tasks or retry generations.
|
|
214
|
+
|
|
215
|
+
Messages, tool history and ordered content parts use the AI SDK prompt contract.
|
|
216
|
+
Chat Completions supports declared image/video/audio URLs and inline MP3, WAV,
|
|
217
|
+
AAC and M4A audio without downloading URLs or changing codecs. Native model results and stream finish events retain `usage.raw`, including
|
|
218
|
+
cache and modality details. With AI SDK 7, read `result.finalStep.usage.raw`
|
|
219
|
+
or each step callback's usage. Aggregate `result.usage` and `totalUsage` do not
|
|
220
|
+
retain raw records.
|
|
221
|
+
|
|
222
|
+
Chat native extension fields are passed under `providerOptions.nexra`;
|
|
223
|
+
Responses uses `openai`, Messages uses `anthropic`, and Gemini uses `google`.
|
|
224
|
+
Explicit provider options are preserved. Model identity and prompt/stream
|
|
225
|
+
fields stay owned by the SDK. Kimi K2.5 currently declares synchronous Chat
|
|
226
|
+
Completions only, so use `generateText` for that model.
|
|
227
|
+
|
|
228
|
+
Responses defaults to `store: false` in this SDK so each request replays the full
|
|
229
|
+
conversation and encrypted reasoning instead of relying on stored item IDs.
|
|
230
|
+
Pass `providerOptions.openai.store: true` explicitly for a stored conversation.
|
|
231
|
+
The current Responses provider cannot preserve sampling parameters alongside
|
|
232
|
+
reasoning for canonical Nexra IDs. Explicit `temperature` or `topP` therefore
|
|
233
|
+
fails before sending instead of being silently discarded. A caller may select
|
|
234
|
+
`forceReasoning: false` for sampling without explicit reasoning controls.
|
|
235
|
+
The documented provider version floors are tested; Anthropic budget validation
|
|
236
|
+
uses its exported capability helper and the shared provider budget mapper.
|
|
237
|
+
|
|
238
|
+
Use `resolveNexraLanguageReasoning(modelId, { enabled: false })` from `/catalog`
|
|
239
|
+
for a quiet generation policy. Its `providerOptions` select a declared off mode
|
|
240
|
+
or the model's minimum reasoning effort; `canDisable` distinguishes those cases.
|
|
241
|
+
An explicit AI SDK `reasoning: "none"` is rejected when the native model requires
|
|
242
|
+
reasoning, rather than being changed silently. Explicit provider options take
|
|
243
|
+
precedence over shared reasoning defaults.
|
|
244
|
+
|
|
174
245
|
GPT-6 Sol and GPT-6 Luna are included in the language model catalog. Sale prices
|
|
175
246
|
are not bundled into the SDK; use the current prices published by the selected
|
|
176
247
|
Nexra environment:
|
package/dist/catalog.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { J as JsonObject } from './json-Drjj1OKl.js';
|
|
2
|
+
import { H as HttpTransport, N as NexraCatalogChangeParams, a as NexraCatalogChangePage, b as NexraCatalogModelState, c as NexraSalePriceList, C as CreateNexraQuoteRequest, d as NexraQuote, e as CreateNexraDisplayQuoteBatchRequest, f as NexraDisplayQuoteBatch, g as NexraCatalogRevision, h as NexraModelSpec, i as NexraModelEndpointSpec, j as NexraModelSpecFilter } from './media-geometry-nJ7I7ohO.js';
|
|
3
|
+
export { M as MediaGeometryField, k as MediaGeometryProjection, l as NexraBillingCurrency, m as NexraCatalogModelIdentity, n as NexraModelOperation, o as NexraSalePrice, p as NexraSettlement, U as UnifiedMediaGeometry, q as applyMediaGeometry, r as decodeMediaGeometry, s as encodeMediaGeometry, t as projectMediaGeometry } from './media-geometry-nJ7I7ohO.js';
|
|
4
4
|
|
|
5
5
|
declare function formatModelDisplayName(displayName: string): string;
|
|
6
6
|
|
|
@@ -20,5 +20,25 @@ declare class CatalogClient {
|
|
|
20
20
|
}
|
|
21
21
|
declare function getModelSpec(modelId: string): NexraModelSpec | undefined;
|
|
22
22
|
declare function listModelSpecs(filter?: NexraModelSpecFilter): readonly NexraModelSpec[];
|
|
23
|
+
type NexraLanguageProtocol = "gemini-generate-content" | "openai-responses" | "openai-chat-completions" | "anthropic-messages";
|
|
24
|
+
type NexraLanguageModelBinding = Readonly<{
|
|
25
|
+
spec: NexraModelSpec;
|
|
26
|
+
endpoint: NexraModelEndpointSpec & {
|
|
27
|
+
protocol: NexraLanguageProtocol;
|
|
28
|
+
};
|
|
29
|
+
supportsStreaming: boolean;
|
|
30
|
+
maxOutputTokens?: number;
|
|
31
|
+
}>;
|
|
32
|
+
declare function getLanguageModelBinding(modelId: string, options?: {
|
|
33
|
+
protocol?: NexraLanguageProtocol;
|
|
34
|
+
}): NexraLanguageModelBinding;
|
|
35
|
+
type NexraLanguageReasoning = Readonly<{
|
|
36
|
+
providerOptions: Record<string, JsonObject>;
|
|
37
|
+
canDisable: boolean;
|
|
38
|
+
}>;
|
|
39
|
+
declare function resolveNexraLanguageReasoning(modelId: string, options: {
|
|
40
|
+
enabled: boolean;
|
|
41
|
+
protocol?: NexraLanguageProtocol;
|
|
42
|
+
}): NexraLanguageReasoning;
|
|
23
43
|
|
|
24
|
-
export { CatalogClient, CreateNexraDisplayQuoteBatchRequest, CreateNexraQuoteRequest, NexraCatalogChangePage, NexraCatalogChangeParams, NexraCatalogModelState, NexraCatalogRevision, NexraDisplayQuoteBatch, NexraModelSpec, NexraModelSpecFilter, NexraQuote, NexraSalePriceList, formatModelDisplayName, getModelSpec, listModelSpecs };
|
|
44
|
+
export { CatalogClient, CreateNexraDisplayQuoteBatchRequest, CreateNexraQuoteRequest, NexraCatalogChangePage, NexraCatalogChangeParams, NexraCatalogModelState, NexraCatalogRevision, NexraDisplayQuoteBatch, type NexraLanguageModelBinding, type NexraLanguageProtocol, type NexraLanguageReasoning, NexraModelEndpointSpec, NexraModelSpec, NexraModelSpecFilter, NexraQuote, NexraSalePriceList, formatModelDisplayName, getLanguageModelBinding, getModelSpec, listModelSpecs, resolveNexraLanguageReasoning };
|
package/dist/catalog.js
CHANGED
|
@@ -4,10 +4,12 @@ import {
|
|
|
4
4
|
decodeMediaGeometry,
|
|
5
5
|
encodeMediaGeometry,
|
|
6
6
|
formatModelDisplayName,
|
|
7
|
+
getLanguageModelBinding,
|
|
7
8
|
getModelSpec,
|
|
8
9
|
listModelSpecs,
|
|
9
|
-
projectMediaGeometry
|
|
10
|
-
|
|
10
|
+
projectMediaGeometry,
|
|
11
|
+
resolveNexraLanguageReasoning
|
|
12
|
+
} from "./chunk-ESV6ODRA.js";
|
|
11
13
|
import "./chunk-IEBCNRT4.js";
|
|
12
14
|
export {
|
|
13
15
|
CatalogClient,
|
|
@@ -15,7 +17,9 @@ export {
|
|
|
15
17
|
decodeMediaGeometry,
|
|
16
18
|
encodeMediaGeometry,
|
|
17
19
|
formatModelDisplayName,
|
|
20
|
+
getLanguageModelBinding,
|
|
18
21
|
getModelSpec,
|
|
19
22
|
listModelSpecs,
|
|
20
|
-
projectMediaGeometry
|
|
23
|
+
projectMediaGeometry,
|
|
24
|
+
resolveNexraLanguageReasoning
|
|
21
25
|
};
|