@byte_fluffy/nexra-sdk 0.1.0-alpha.46.1 → 0.1.0-alpha.48

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
@@ -439,6 +439,92 @@ const gpt6Prices = prices.filter(({ modelId }) =>
439
439
  );
440
440
  ```
441
441
 
442
+ ## Ark web search (Responses)
443
+
444
+ Available since SDK `0.1.0-alpha.47` (`npm install @byte_fluffy/nexra-sdk@next`).
445
+
446
+ DeepSeek V4.1 Flash (`deepseek/deepseek-v4-1-flash`), GLM 5.3 Flash
447
+ (`z-ai/glm-5-3-flash`), Doubao Seed 2.1 Lite
448
+ (`bytedance/doubao-seed-2-1-lite-260915`), and Kimi K3.1 Pro
449
+ (`moonshot-ai/kimi-k3-1-pro`) support the Ark online content plugin through
450
+ `/v1/responses`. The default SDK binding selects this endpoint. All four retain
451
+ explicit Chat Completions bindings; DeepSeek also retains Messages.
452
+ Search is a provider-executed tool, rather than a Chat `web_search_options` flag.
453
+
454
+ ```ts
455
+ import { generateText } from "ai";
456
+ import { openai } from "@ai-sdk/openai";
457
+ import { createNexraLanguageModel } from "@byte_fluffy/nexra-sdk/language";
458
+
459
+ const result = await generateText({
460
+ model: createNexraLanguageModel("deepseek/deepseek-v4-1-flash", {
461
+ apiKey: process.env.NEXRA_API_KEY!,
462
+ baseUrl: "https://vip-api.nexra-ai.com/v1",
463
+ }),
464
+ prompt: "Search for the official DeepSeek website and cite its URL.",
465
+ tools: { web_search: openai.tools.webSearch() },
466
+ providerOptions: {
467
+ openai: { maxToolCalls: 1 },
468
+ nexra: { web_search: { sources: ["search_engine"], max_keyword: 1, limit: 3 } },
469
+ },
470
+ maxOutputTokens: 512,
471
+ maxRetries: 0,
472
+ });
473
+ console.log(result.text, result.sources);
474
+ ```
475
+
476
+ `providerOptions.nexra.web_search` preserves native tool fields such as `sources`,
477
+ `max_keyword`, `limit`, and `user_location`; it requires the `web_search` tool.
478
+ The same options work with `streamText`. Unpositioned native citations become
479
+ URL sources; original Native bodies, raw stream events, and
480
+ `finalStep.usage.raw.tool_usage_details.web_search` remain available.
481
+
482
+ VIP configured search prices (CNY, checked 2026-11-01):
483
+
484
+ | Content source | Channel cost / 1,000 uses | Nexra sale / 1,000 uses |
485
+ | --- | ---: | ---: |
486
+ | `search_engine` (default) | ¥4 | **¥4.4** |
487
+ | `toutiao`, `douyin`, `moji` (each additional source) | ¥6 | ¥6.6 |
488
+
489
+ A use is an actual upstream content-source search, **not an HTTP request or a
490
+ returned result**. Multiple rounds, keywords, or content sources can incur
491
+ multiple uses. Token charges are additional, including retrieved context.
492
+ Declaring a tool does not itself incur a search fee if the model does not use
493
+ it. Preauthorization reserves the configured search ceiling and settles the
494
+ actual evidenced usage; set `maxToolCalls` and `max_keyword` to control that
495
+ ceiling. Missing search evidence is not treated as free search.
496
+
497
+ Current VIP token sale prices per million tokens:
498
+
499
+ | Model | Input | Cached input | Output |
500
+ | --- | ---: | ---: | ---: |
501
+ | DeepSeek V4.1 Flash | ¥2.2 | ¥0.044 | ¥8.8 |
502
+ | GLM 5.3 Flash | ¥0.88 | ¥0.253 | ¥3.08 |
503
+ | Kimi K3.1 Pro | ¥14.3 | ¥1.43 | ¥74.8 |
504
+ | Doubao Seed 2.1 Lite (non-audio input) | ¥0.88 | ¥0.176 | ¥2.97 |
505
+
506
+ Seed audio input is ¥13.2/million tokens; cached audio input is ¥2.64/million.
507
+ For Ark audio/video prompts in the AI SDK adapter, select
508
+ `protocol: "openai-chat-completions"`; its native media parts retain their order. Kimi media requires bytes or Base64
509
+ data URLs; the Chat binding derives URL support from the Native schema.
510
+ The Responses search example above uses text. Native Responses media fields
511
+ remain documented by each model's selected endpoint schema.
512
+
513
+ GLM and Kimi K3.1 Pro thinking is always on. Use `reasoning: "low"` for minimum effort;
514
+ `reasoning: "none"` fails locally. Native `none`/`minimal` effort aliases do not
515
+ mean that these models can turn thinking off. Kimi does not use a `thinking`
516
+ parameter. Its Responses endpoint permits `toolChoice: "auto"` (default) or
517
+ `"none"`; forcing a particular tool or requiring a tool is rejected before
518
+ fetch. With auto selection, search is billed only when actually used.
519
+
520
+ These are the configured channel prices;
521
+ the SDK does not dynamically apply upstream off-peak discounts. Provider account
522
+ free quotas do not automatically make Nexra requests free. The selected plugin
523
+ is separate from Doubao Search Custom; no Custom search service is used here.
524
+ Always read the selected environment's live catalog prices before estimating
525
+ charges. Official references: [online content plugin pricing](https://ark.volcengine.com/region:cn-beijing/docs/online-content-plugin-pricing)
526
+ and [model pricing](https://console.volcengine.com/ark/region:cn-beijing/docs/model-pricing).
527
+
442
528
  ## Directory layout
443
529
 
444
530
  ```
package/dist/catalog.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  listModelSpecs,
10
10
  projectMediaGeometry,
11
11
  resolveNexraLanguageReasoning
12
- } from "./chunk-JK6LUGM5.js";
12
+ } from "./chunk-2IWCEEDI.js";
13
13
  import "./chunk-NR4EWD3X.js";
14
14
  export {
15
15
  CatalogClient,