@tanstack/ai 0.42.0 → 0.43.1
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 +15 -1
- package/dist/esm/activities/chat/adapter.js +23 -16
- package/dist/esm/activities/chat/adapter.js.map +1 -1
- package/dist/esm/activities/chat/agent-loop-strategies.d.ts +5 -36
- package/dist/esm/activities/chat/agent-loop-strategies.js +75 -21
- package/dist/esm/activities/chat/agent-loop-strategies.js.map +1 -1
- package/dist/esm/activities/chat/cancel.d.ts +40 -0
- package/dist/esm/activities/chat/cancel.js +54 -0
- package/dist/esm/activities/chat/cancel.js.map +1 -0
- package/dist/esm/activities/chat/index.d.ts +28 -21
- package/dist/esm/activities/chat/index.js +2100 -1813
- package/dist/esm/activities/chat/index.js.map +1 -1
- package/dist/esm/activities/chat/mcp/manager.d.ts +2 -2
- package/dist/esm/activities/chat/mcp/manager.js +90 -77
- package/dist/esm/activities/chat/mcp/manager.js.map +1 -1
- package/dist/esm/activities/chat/mcp/types.d.ts +2 -2
- package/dist/esm/activities/chat/messages.js +397 -346
- package/dist/esm/activities/chat/messages.js.map +1 -1
- package/dist/esm/activities/chat/middleware/builder.js +17 -15
- package/dist/esm/activities/chat/middleware/builder.js.map +1 -1
- package/dist/esm/activities/chat/middleware/capabilities.js +78 -43
- package/dist/esm/activities/chat/middleware/capabilities.js.map +1 -1
- package/dist/esm/activities/chat/middleware/compose.d.ts +94 -1
- package/dist/esm/activities/chat/middleware/compose.js +623 -531
- package/dist/esm/activities/chat/middleware/compose.js.map +1 -1
- package/dist/esm/activities/chat/middleware/define.js +12 -5
- package/dist/esm/activities/chat/middleware/define.js.map +1 -1
- package/dist/esm/activities/chat/middleware/index.d.ts +5 -1
- package/dist/esm/activities/chat/middleware/locks.d.ts +50 -0
- package/dist/esm/activities/chat/middleware/locks.js +71 -0
- package/dist/esm/activities/chat/middleware/locks.js.map +1 -0
- package/dist/esm/activities/chat/middleware/pending-turn.d.ts +15 -0
- package/dist/esm/activities/chat/middleware/pending-turn.js +35 -0
- package/dist/esm/activities/chat/middleware/pending-turn.js.map +1 -0
- package/dist/esm/activities/chat/middleware/run-disconnect.d.ts +23 -0
- package/dist/esm/activities/chat/middleware/run-disconnect.js +42 -0
- package/dist/esm/activities/chat/middleware/run-disconnect.js.map +1 -0
- package/dist/esm/activities/chat/middleware/run-store.d.ts +283 -0
- package/dist/esm/activities/chat/middleware/run-store.js +176 -0
- package/dist/esm/activities/chat/middleware/run-store.js.map +1 -0
- package/dist/esm/activities/chat/middleware/sandbox-runtime.js +14 -8
- package/dist/esm/activities/chat/middleware/sandbox-runtime.js.map +1 -1
- package/dist/esm/activities/chat/middleware/tool-cache-middleware.js +79 -70
- package/dist/esm/activities/chat/middleware/tool-cache-middleware.js.map +1 -1
- package/dist/esm/activities/chat/middleware/types.d.ts +59 -2
- package/dist/esm/activities/chat/middleware/validate.js +23 -28
- package/dist/esm/activities/chat/middleware/validate.js.map +1 -1
- package/dist/esm/activities/chat/stream/json-parser.js +39 -25
- package/dist/esm/activities/chat/stream/json-parser.js.map +1 -1
- package/dist/esm/activities/chat/stream/message-updaters.js +275 -234
- package/dist/esm/activities/chat/stream/message-updaters.js.map +1 -1
- package/dist/esm/activities/chat/stream/processor.d.ts +24 -4
- package/dist/esm/activities/chat/stream/processor.js +1341 -1542
- package/dist/esm/activities/chat/stream/processor.js.map +1 -1
- package/dist/esm/activities/chat/stream/strategies.js +69 -53
- package/dist/esm/activities/chat/stream/strategies.js.map +1 -1
- package/dist/esm/activities/chat/tools/approval-schema.d.ts +19 -0
- package/dist/esm/activities/chat/tools/approval-schema.js +117 -0
- package/dist/esm/activities/chat/tools/approval-schema.js.map +1 -0
- package/dist/esm/activities/chat/tools/lazy-tool-manager.js +164 -191
- package/dist/esm/activities/chat/tools/lazy-tool-manager.js.map +1 -1
- package/dist/esm/activities/chat/tools/lazy-tools.js +24 -12
- package/dist/esm/activities/chat/tools/lazy-tools.js.map +1 -1
- package/dist/esm/activities/chat/tools/schema-converter.js +293 -146
- package/dist/esm/activities/chat/tools/schema-converter.js.map +1 -1
- package/dist/esm/activities/chat/tools/tool-calls.d.ts +18 -2
- package/dist/esm/activities/chat/tools/tool-calls.js +522 -531
- package/dist/esm/activities/chat/tools/tool-calls.js.map +1 -1
- package/dist/esm/activities/chat/tools/tool-definition.d.ts +75 -16
- package/dist/esm/activities/chat/tools/tool-definition.js +95 -23
- package/dist/esm/activities/chat/tools/tool-definition.js.map +1 -1
- package/dist/esm/activities/error-payload.js +85 -47
- package/dist/esm/activities/error-payload.js.map +1 -1
- package/dist/esm/activities/generateAudio/adapter.js +22 -15
- package/dist/esm/activities/generateAudio/adapter.js.map +1 -1
- package/dist/esm/activities/generateAudio/index.d.ts +4 -0
- package/dist/esm/activities/generateAudio/index.js +141 -105
- package/dist/esm/activities/generateAudio/index.js.map +1 -1
- package/dist/esm/activities/generateImage/adapter.js +22 -15
- package/dist/esm/activities/generateImage/adapter.js.map +1 -1
- package/dist/esm/activities/generateImage/index.d.ts +4 -0
- package/dist/esm/activities/generateImage/index.js +155 -111
- package/dist/esm/activities/generateImage/index.js.map +1 -1
- package/dist/esm/activities/generateSpeech/adapter.js +22 -15
- package/dist/esm/activities/generateSpeech/adapter.js.map +1 -1
- package/dist/esm/activities/generateSpeech/index.d.ts +4 -0
- package/dist/esm/activities/generateSpeech/index.js +159 -110
- package/dist/esm/activities/generateSpeech/index.js.map +1 -1
- package/dist/esm/activities/generateTranscription/adapter.js +22 -15
- package/dist/esm/activities/generateTranscription/adapter.js.map +1 -1
- package/dist/esm/activities/generateTranscription/index.d.ts +4 -0
- package/dist/esm/activities/generateTranscription/index.js +159 -100
- package/dist/esm/activities/generateTranscription/index.js.map +1 -1
- package/dist/esm/activities/generateVideo/adapter.js +36 -29
- package/dist/esm/activities/generateVideo/adapter.js.map +1 -1
- package/dist/esm/activities/generateVideo/index.d.ts +143 -19
- package/dist/esm/activities/generateVideo/index.js +456 -279
- package/dist/esm/activities/generateVideo/index.js.map +1 -1
- package/dist/esm/activities/generateVideo/snap.js +60 -48
- package/dist/esm/activities/generateVideo/snap.js.map +1 -1
- package/dist/esm/activities/index.js +8 -34
- package/dist/esm/activities/middleware/index.d.ts +1 -1
- package/dist/esm/activities/middleware/run.d.ts +10 -0
- package/dist/esm/activities/middleware/run.js +53 -29
- package/dist/esm/activities/middleware/run.js.map +1 -1
- package/dist/esm/activities/middleware/types.d.ts +44 -6
- package/dist/esm/activities/stream-generation-result.d.ts +4 -1
- package/dist/esm/activities/stream-generation-result.js +79 -44
- package/dist/esm/activities/stream-generation-result.js.map +1 -1
- package/dist/esm/activities/summarize/adapter.js +22 -15
- package/dist/esm/activities/summarize/adapter.js.map +1 -1
- package/dist/esm/activities/summarize/chat-stream-summarize.js +252 -202
- package/dist/esm/activities/summarize/chat-stream-summarize.js.map +1 -1
- package/dist/esm/activities/summarize/index.d.ts +27 -0
- package/dist/esm/activities/summarize/index.js +268 -102
- package/dist/esm/activities/summarize/index.js.map +1 -1
- package/dist/esm/adapter-internals.d.ts +2 -1
- package/dist/esm/adapter-internals.js +4 -11
- package/dist/esm/client.d.ts +25 -3
- package/dist/esm/client.js +131 -64
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/custom-events.d.ts +76 -0
- package/dist/esm/custom-events.js +37 -0
- package/dist/esm/custom-events.js.map +1 -0
- package/dist/esm/delivery-detach.d.ts +50 -0
- package/dist/esm/delivery-detach.js +71 -0
- package/dist/esm/delivery-detach.js.map +1 -0
- package/dist/esm/delivery-disconnect.d.ts +62 -0
- package/dist/esm/delivery-disconnect.js +81 -0
- package/dist/esm/delivery-disconnect.js.map +1 -0
- package/dist/esm/extend-adapter.js +19 -17
- package/dist/esm/extend-adapter.js.map +1 -1
- package/dist/esm/index.d.ts +24 -6
- package/dist/esm/index.js +30 -98
- package/dist/esm/interrupt-resume.d.ts +71 -0
- package/dist/esm/interrupt-resume.js +438 -0
- package/dist/esm/interrupt-resume.js.map +1 -0
- package/dist/esm/interrupt-serialization.d.ts +12 -0
- package/dist/esm/interrupt-serialization.js +178 -0
- package/dist/esm/interrupt-serialization.js.map +1 -0
- package/dist/esm/interrupts.d.ts +84 -0
- package/dist/esm/interrupts.js +31 -0
- package/dist/esm/interrupts.js.map +1 -0
- package/dist/esm/locks.d.ts +10 -0
- package/dist/esm/locks.js +2 -0
- package/dist/esm/logger/console-logger.js +101 -78
- package/dist/esm/logger/console-logger.js.map +1 -1
- package/dist/esm/logger/internal-logger.js +104 -89
- package/dist/esm/logger/internal-logger.js.map +1 -1
- package/dist/esm/logger/resolve.js +54 -49
- package/dist/esm/logger/resolve.js.map +1 -1
- package/dist/esm/logger/types.d.ts +1 -1
- package/dist/esm/middlewares/content-guard.js +142 -148
- package/dist/esm/middlewares/content-guard.js.map +1 -1
- package/dist/esm/middlewares/index.js +2 -6
- package/dist/esm/middlewares/otel.d.ts +3 -1
- package/dist/esm/middlewares/otel.js +599 -732
- package/dist/esm/middlewares/otel.js.map +1 -1
- package/dist/esm/middlewares/usage-attributes.js +47 -40
- package/dist/esm/middlewares/usage-attributes.js.map +1 -1
- package/dist/esm/realtime/event-emitter.js +24 -25
- package/dist/esm/realtime/event-emitter.js.map +1 -1
- package/dist/esm/realtime/index.d.ts +5 -9
- package/dist/esm/realtime/index.js +29 -6
- package/dist/esm/realtime/index.js.map +1 -1
- package/dist/esm/scope.d.ts +47 -0
- package/dist/esm/stream-durability.d.ts +171 -0
- package/dist/esm/stream-durability.js +295 -0
- package/dist/esm/stream-durability.js.map +1 -0
- package/dist/esm/stream-to-response.d.ts +178 -13
- package/dist/esm/stream-to-response.js +663 -115
- package/dist/esm/stream-to-response.js.map +1 -1
- package/dist/esm/strip-to-spec-middleware.js +30 -16
- package/dist/esm/strip-to-spec-middleware.js.map +1 -1
- package/dist/esm/system-prompts.js +27 -21
- package/dist/esm/system-prompts.js.map +1 -1
- package/dist/esm/tool-registry.js +72 -45
- package/dist/esm/tool-registry.js.map +1 -1
- package/dist/esm/tools/provider-tool.js +14 -5
- package/dist/esm/tools/provider-tool.js.map +1 -1
- package/dist/esm/types.d.ts +321 -42
- package/dist/esm/types.js +2 -0
- package/dist/esm/utilities/ag-ui-wire.js +79 -93
- package/dist/esm/utilities/ag-ui-wire.js.map +1 -1
- package/dist/esm/utilities/chat-params.d.ts +26 -4
- package/dist/esm/utilities/chat-params.js +218 -92
- package/dist/esm/utilities/chat-params.js.map +1 -1
- package/dist/esm/utilities/errors.js +28 -18
- package/dist/esm/utilities/errors.js.map +1 -1
- package/dist/esm/utilities/media-prompt.js +46 -41
- package/dist/esm/utilities/media-prompt.js.map +1 -1
- package/dist/esm/utilities/numbers.js +13 -10
- package/dist/esm/utilities/numbers.js.map +1 -1
- package/dist/esm/utilities/provider-executed.js +20 -11
- package/dist/esm/utilities/provider-executed.js.map +1 -1
- package/dist/esm/utilities/sampling-keys.js +31 -19
- package/dist/esm/utilities/sampling-keys.js.map +1 -1
- package/dist/esm/utilities/tool-result.js +42 -30
- package/dist/esm/utilities/tool-result.js.map +1 -1
- package/dist/esm/utilities/usage.js +27 -9
- package/dist/esm/utilities/usage.js.map +1 -1
- package/dist/esm/utils.js +26 -18
- package/dist/esm/utils.js.map +1 -1
- package/package.json +10 -6
- package/skills/ai-core/SKILL.md +69 -18
- package/skills/ai-core/adapter-configuration/SKILL.md +44 -21
- package/skills/ai-core/adapter-configuration/references/anthropic-adapter.md +1 -3
- package/skills/ai-core/adapter-configuration/references/byteplus-adapter.md +148 -0
- package/skills/ai-core/adapter-configuration/references/gemini-adapter.md +2 -6
- package/skills/ai-core/adapter-configuration/references/groq-adapter.md +2 -6
- package/skills/ai-core/adapter-configuration/references/openai-adapter.md +1 -3
- package/skills/ai-core/ag-ui-protocol/SKILL.md +1 -1
- package/skills/ai-core/chat-experience/SKILL.md +98 -11
- package/skills/ai-core/client-persistence/SKILL.md +277 -0
- package/skills/ai-core/custom-backend-integration/SKILL.md +1 -1
- package/skills/ai-core/debug-logging/SKILL.md +1 -1
- package/skills/ai-core/locks/SKILL.md +143 -0
- package/skills/ai-core/media-generation/SKILL.md +144 -12
- package/skills/ai-core/middleware/SKILL.md +258 -33
- package/skills/ai-core/structured-outputs/SKILL.md +1 -1
- package/skills/ai-core/tool-calling/SKILL.md +54 -61
- package/src/activities/chat/agent-loop-strategies.ts +5 -39
- package/src/activities/chat/cancel.ts +81 -0
- package/src/activities/chat/index.ts +1091 -200
- package/src/activities/chat/mcp/manager.ts +4 -4
- package/src/activities/chat/mcp/types.ts +2 -2
- package/src/activities/chat/messages.ts +5 -3
- package/src/activities/chat/middleware/builder.ts +1 -1
- package/src/activities/chat/middleware/compose.ts +186 -9
- package/src/activities/chat/middleware/index.ts +26 -0
- package/src/activities/chat/middleware/locks.ts +102 -0
- package/src/activities/chat/middleware/pending-turn.ts +47 -0
- package/src/activities/chat/middleware/run-disconnect.ts +62 -0
- package/src/activities/chat/middleware/run-store.ts +412 -0
- package/src/activities/chat/middleware/types.ts +62 -1
- package/src/activities/chat/stream/processor.ts +189 -5
- package/src/activities/chat/tools/approval-schema.ts +205 -0
- package/src/activities/chat/tools/tool-calls.ts +106 -13
- package/src/activities/chat/tools/tool-definition.ts +210 -39
- package/src/activities/generateAudio/index.ts +20 -3
- package/src/activities/generateImage/index.ts +20 -3
- package/src/activities/generateSpeech/index.ts +25 -3
- package/src/activities/generateTranscription/index.ts +26 -3
- package/src/activities/generateVideo/index.ts +345 -82
- package/src/activities/middleware/index.ts +2 -0
- package/src/activities/middleware/run.ts +31 -0
- package/src/activities/middleware/types.ts +49 -5
- package/src/activities/stream-generation-result.ts +30 -2
- package/src/activities/summarize/chat-stream-summarize.ts +5 -0
- package/src/activities/summarize/index.ts +200 -10
- package/src/adapter-internals.ts +10 -1
- package/src/client.ts +244 -0
- package/src/custom-events.ts +107 -0
- package/src/delivery-detach.ts +72 -0
- package/src/delivery-disconnect.ts +84 -0
- package/src/index.ts +138 -1
- package/src/interrupt-resume.ts +824 -0
- package/src/interrupt-serialization.ts +183 -0
- package/src/interrupts.ts +146 -0
- package/src/locks.ts +17 -0
- package/src/logger/types.ts +1 -1
- package/src/middlewares/otel.ts +23 -5
- package/src/realtime/index.ts +5 -9
- package/src/scope.ts +47 -0
- package/src/stream-durability.ts +598 -0
- package/src/stream-to-response.ts +1051 -95
- package/src/strip-to-spec-middleware.ts +3 -3
- package/src/types.ts +405 -45
- package/src/utilities/chat-params.ts +245 -55
- package/dist/esm/activities/index.js.map +0 -1
- package/dist/esm/adapter-internals.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/middlewares/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.1",
|
|
4
4
|
"description": "Type-safe TypeScript AI SDK for streaming chat, tool calling, agents, structured outputs, and multimodal generation.",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"types": "./dist/esm/client.d.ts",
|
|
30
30
|
"import": "./dist/esm/client.js"
|
|
31
31
|
},
|
|
32
|
+
"./locks": {
|
|
33
|
+
"types": "./dist/esm/locks.d.ts",
|
|
34
|
+
"import": "./dist/esm/locks.js"
|
|
35
|
+
},
|
|
32
36
|
"./adapters": {
|
|
33
37
|
"types": "./dist/esm/activities/index.d.ts",
|
|
34
38
|
"import": "./dist/esm/activities/index.js"
|
|
@@ -73,11 +77,11 @@
|
|
|
73
77
|
"tanstack-intent"
|
|
74
78
|
],
|
|
75
79
|
"dependencies": {
|
|
76
|
-
"@ag-ui/core": "
|
|
80
|
+
"@ag-ui/core": "0.1.1-canary.beta.0",
|
|
77
81
|
"@standard-schema/spec": "^1.1.0",
|
|
78
82
|
"partial-json": "^0.1.7",
|
|
79
|
-
"@tanstack/ai-event-client": "0.
|
|
80
|
-
"@tanstack/ai-utils": "0.
|
|
83
|
+
"@tanstack/ai-event-client": "0.7.0",
|
|
84
|
+
"@tanstack/ai-utils": "0.4.0"
|
|
81
85
|
},
|
|
82
86
|
"peerDependencies": {
|
|
83
87
|
"@opentelemetry/api": ">=1.9.0"
|
|
@@ -96,11 +100,11 @@
|
|
|
96
100
|
"scripts": {
|
|
97
101
|
"build": "vite build",
|
|
98
102
|
"clean": "premove ./build ./dist",
|
|
99
|
-
"lint:fix": "
|
|
103
|
+
"lint:fix": "oxlint src --type-aware --fix",
|
|
100
104
|
"test:build": "publint --strict",
|
|
101
105
|
"test:coverage": "vitest run --coverage",
|
|
102
106
|
"test:coverage:watch": "vitest --coverage --watch",
|
|
103
|
-
"test:
|
|
107
|
+
"test:oxlint": "oxlint src --type-aware",
|
|
104
108
|
"test:lib": "vitest",
|
|
105
109
|
"test:lib:dev": "pnpm test:lib --watch",
|
|
106
110
|
"test:types": "tsc"
|
package/skills/ai-core/SKILL.md
CHANGED
|
@@ -3,12 +3,13 @@ name: ai-core
|
|
|
3
3
|
description: >
|
|
4
4
|
Entry point for TanStack AI skills. Routes to chat-experience, tool-calling,
|
|
5
5
|
media-generation, structured-outputs, adapter-configuration, ag-ui-protocol,
|
|
6
|
-
middleware, custom-backend-integration, and debug-logging
|
|
7
|
-
|
|
8
|
-
not
|
|
6
|
+
middleware, locks, custom-backend-integration, and debug-logging, plus the skills
|
|
7
|
+
shipped by companion packages (@tanstack/ai-persistence, @tanstack/ai-code-mode).
|
|
8
|
+
Use chat() not streamText(), openaiText() not createOpenAI(),
|
|
9
|
+
toServerSentEventsResponse() not manual SSE, middleware hooks not onEnd callbacks.
|
|
9
10
|
type: core
|
|
10
11
|
library: tanstack-ai
|
|
11
|
-
library_version: '0.
|
|
12
|
+
library_version: '0.42.0'
|
|
12
13
|
---
|
|
13
14
|
|
|
14
15
|
# TanStack AI — Core Concepts
|
|
@@ -21,18 +22,67 @@ Always import from the framework package on the client — never from
|
|
|
21
22
|
|
|
22
23
|
## Sub-Skills
|
|
23
24
|
|
|
24
|
-
| Need to... | Read
|
|
25
|
-
| ------------------------------------------------- |
|
|
26
|
-
| Build a chat UI with streaming | ai-core/chat-experience/SKILL.md
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
25
|
+
| Need to... | Read |
|
|
26
|
+
| ------------------------------------------------- | --------------------------------------------- |
|
|
27
|
+
| Build a chat UI with streaming | ai-core/chat-experience/SKILL.md |
|
|
28
|
+
| Survive a browser reload (no extra package) | ai-core/client-persistence/SKILL.md |
|
|
29
|
+
| Add tool calling (server, client, or both) | ai-core/tool-calling/SKILL.md |
|
|
30
|
+
| Generate images, video, speech, or transcriptions | ai-core/media-generation/SKILL.md |
|
|
31
|
+
| Get typed JSON responses from the LLM | ai-core/structured-outputs/SKILL.md |
|
|
32
|
+
| Choose and configure a provider adapter | ai-core/adapter-configuration/SKILL.md |
|
|
33
|
+
| Implement AG-UI streaming protocol server-side | ai-core/ag-ui-protocol/SKILL.md |
|
|
34
|
+
| Add analytics, logging, or lifecycle hooks | ai-core/middleware/SKILL.md |
|
|
35
|
+
| Coordinate multi-instance work with locks | ai-core/locks/SKILL.md |
|
|
36
|
+
| Connect to a non-TanStack-AI backend | ai-core/custom-backend-integration/SKILL.md |
|
|
37
|
+
| Turn on/off debug logging, pipe into pino/winston | ai-core/debug-logging/SKILL.md |
|
|
38
|
+
| Persist chats server-side (history, runs) | See `@tanstack/ai-persistence` package skills |
|
|
39
|
+
| Set up Code Mode (LLM code execution) | See `@tanstack/ai-code-mode` package skills |
|
|
40
|
+
|
|
41
|
+
## Companion packages
|
|
42
|
+
|
|
43
|
+
Some capabilities live in their own package and ship their own skills. Install
|
|
44
|
+
the package, then read its skills — do not guess the API from this file.
|
|
45
|
+
|
|
46
|
+
### `@tanstack/ai-persistence` — durable chat state
|
|
47
|
+
|
|
48
|
+
Makes a conversation survive a reload, a server restart, a second device, or a
|
|
49
|
+
paused tool approval. It ships the **store contracts** (`MessageStore`,
|
|
50
|
+
`RunStore`, `InterruptStore`, `MetadataStore`), the `withPersistence` /
|
|
51
|
+
`withGenerationPersistence` middleware, `reconstructChat` for server-side
|
|
52
|
+
hydrate, an in-memory reference backend, and a conformance testkit. Multi-instance
|
|
53
|
+
locks are **not** in this package — `LockStore` / `withLocks` ship in
|
|
54
|
+
`@tanstack/ai/locks`; see ai-core/locks. The `runs` store contract is typed
|
|
55
|
+
against run lifecycle types (`RunStatus`, `RunRecord`, `RunStore`,
|
|
56
|
+
`defineRunStore`, `InMemoryRunStore`), which ship in `@tanstack/ai` itself;
|
|
57
|
+
see ai-core/middleware.
|
|
58
|
+
|
|
59
|
+
It does **not** ship a backend for your database — you implement the stores
|
|
60
|
+
against Postgres, SQLite, D1, Mongo, or whatever you run, and the package's
|
|
61
|
+
skills walk you through it (including Drizzle, Prisma, and Cloudflare recipes).
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pnpm add @tanstack/ai-persistence
|
|
65
|
+
npx @tanstack/intent@latest install
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The skills ship **inside** the package, so they only exist on disk once it is
|
|
69
|
+
installed — the second command re-scans `node_modules` and wires them into the
|
|
70
|
+
agent config. Until then the paths below resolve to nothing.
|
|
71
|
+
|
|
72
|
+
Entry point: `node_modules/@tanstack/ai-persistence/skills/ai-persistence/SKILL.md`
|
|
73
|
+
|
|
74
|
+
| Need to... | Read |
|
|
75
|
+
| ----------------------------------------------- | --------------------------------------- |
|
|
76
|
+
| Wire server-side chat history, runs, interrupts | ai-persistence/server/SKILL.md |
|
|
77
|
+
| Implement the store interfaces for your DB | ai-persistence/stores/SKILL.md |
|
|
78
|
+
| Write the adapter for the DB your app runs | ai-persistence/build-*-adapter/SKILL.md |
|
|
79
|
+
|
|
80
|
+
Browser-side persistence is **not** in this package — it ships with the
|
|
81
|
+
framework packages, so read **ai-core/client-persistence** instead.
|
|
82
|
+
|
|
83
|
+
### `@tanstack/ai-code-mode` — LLM code execution
|
|
84
|
+
|
|
85
|
+
See the `ai-code-mode` skill in that package.
|
|
36
86
|
|
|
37
87
|
## Quick Decision Tree
|
|
38
88
|
|
|
@@ -43,6 +93,7 @@ Always import from the framework package on the client — never from
|
|
|
43
93
|
- Choosing/configuring a provider? → ai-core/adapter-configuration
|
|
44
94
|
- Building a server-only AG-UI backend? → ai-core/ag-ui-protocol
|
|
45
95
|
- Adding analytics or post-stream events? → ai-core/middleware
|
|
96
|
+
- Surviving reloads / multi-device / durable approvals? → `@tanstack/ai-persistence` skills
|
|
46
97
|
- Connecting to a custom backend? → ai-core/custom-backend-integration
|
|
47
98
|
- Turning on debug logging to trace chunks/tools/middleware? → ai-core/debug-logging
|
|
48
99
|
- Debugging mistakes? → Check Common Mistakes in the relevant sub-skill
|
|
@@ -54,8 +105,8 @@ Always import from the framework package on the client — never from
|
|
|
54
105
|
3. **Use `toServerSentEventsResponse()`** to convert streams to HTTP responses. Never implement SSE manually.
|
|
55
106
|
4. **Use middleware for lifecycle events.** No `onEnd`/`onFinish` callbacks on `chat()` — use `middleware: [{ onFinish: ... }]`.
|
|
56
107
|
5. **Ask the user which adapter and model** they want. Suggest the latest model. Also ask if they want Code Mode.
|
|
57
|
-
6. **Tools must be passed to both server and client.** Server gets the tool in `chat({ tools })
|
|
108
|
+
6. **Tools must be passed to both server and client.** Server gets the tool in `chat({ tools })`; the client passes the `.client()` implementation through the `clientTools()` helper into the **`tools`** option — `useChat({ tools: clientTools(myTool.client(...)) })`. There is no `clientTools` option. See ai-core/tool-calling.
|
|
58
109
|
|
|
59
110
|
## Version
|
|
60
111
|
|
|
61
|
-
Targets TanStack AI v0.
|
|
112
|
+
Targets TanStack AI v0.42.0.
|
|
@@ -3,16 +3,19 @@ name: ai-core/adapter-configuration
|
|
|
3
3
|
description: >
|
|
4
4
|
Provider adapter selection and configuration: openaiText, anthropicText,
|
|
5
5
|
geminiText, ollamaText, grokText, groqText, openRouterText, bedrockText,
|
|
6
|
-
openaiCompatible. Per-model type safety with modelOptions,
|
|
6
|
+
byteplusText, openaiCompatible. Per-model type safety with modelOptions,
|
|
7
|
+
reasoning/thinking configuration,
|
|
7
8
|
runtime adapter switching, extendAdapter() for custom models, createModel().
|
|
8
9
|
Generic OpenAI-compatible providers (DeepSeek, Together, Fireworks, etc.) via
|
|
9
10
|
openaiCompatible({ baseURL, apiKey, models }) from @tanstack/ai-openai/compatible.
|
|
10
11
|
API key env vars: OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY/GEMINI_API_KEY,
|
|
11
12
|
XAI_API_KEY, GROQ_API_KEY, OPENROUTER_API_KEY, OLLAMA_HOST,
|
|
12
|
-
BEDROCK_API_KEY (or AWS_BEARER_TOKEN_BEDROCK).
|
|
13
|
+
BEDROCK_API_KEY (or AWS_BEARER_TOKEN_BEDROCK). BytePlus needs TWO keys:
|
|
14
|
+
ARK_API_KEY (ModelArk — chat/video/image) and BYTEPLUS_VOICE_API_KEY
|
|
15
|
+
(Seed Speech — TTS/transcription); neither is a fallback for the other.
|
|
13
16
|
type: sub-skill
|
|
14
17
|
library: tanstack-ai
|
|
15
|
-
library_version: '0.
|
|
18
|
+
library_version: '0.42.0'
|
|
16
19
|
sources:
|
|
17
20
|
- 'TanStack/ai:docs/adapters/openai.md'
|
|
18
21
|
- 'TanStack/ai:docs/adapters/anthropic.md'
|
|
@@ -80,8 +83,15 @@ The text adapter is the primary one for chat/completions:
|
|
|
80
83
|
| OpenRouter | `@tanstack/ai-openrouter` | `openRouterText` | `OPENROUTER_API_KEY` |
|
|
81
84
|
| Ollama | `@tanstack/ai-ollama` | `ollamaText` | `OLLAMA_HOST` (default: `http://localhost:11434`) |
|
|
82
85
|
| Bedrock | `@tanstack/ai-bedrock` | `bedrockText` | `BEDROCK_API_KEY` or `AWS_BEARER_TOKEN_BEDROCK` |
|
|
86
|
+
| BytePlus | `@tanstack/ai-byteplus` | `byteplusText` | `ARK_API_KEY` (falls back to `BYTEPLUS_API_KEY`) |
|
|
83
87
|
| OpenAI-compatible | `@tanstack/ai-openai/compatible` | `openaiCompatible` / `openaiCompatibleText` | provider-specific (passed via `apiKey`) |
|
|
84
88
|
|
|
89
|
+
> **BytePlus uses two keys.** `byteplusText` / `byteplusVideo` /
|
|
90
|
+
> `byteplusImage` read `ARK_API_KEY` (ModelArk, `Authorization: Bearer`), but
|
|
91
|
+
> `byteplusSpeech` / `byteplusTranscription` are a separate product and read
|
|
92
|
+
> **`BYTEPLUS_VOICE_API_KEY`** (Seed Speech, `X-Api-Key`). Ark keys are also
|
|
93
|
+
> region-isolated — the default base URL is the ap-southeast endpoint.
|
|
94
|
+
|
|
85
95
|
```typescript
|
|
86
96
|
// Each factory takes model as first arg, optional config as second
|
|
87
97
|
import { openaiText } from '@tanstack/ai-openai'
|
|
@@ -92,6 +102,7 @@ import { groqText } from '@tanstack/ai-groq'
|
|
|
92
102
|
import { openRouterText } from '@tanstack/ai-openrouter'
|
|
93
103
|
import { ollamaText } from '@tanstack/ai-ollama'
|
|
94
104
|
import { bedrockText } from '@tanstack/ai-bedrock'
|
|
105
|
+
import { byteplusText } from '@tanstack/ai-byteplus'
|
|
95
106
|
|
|
96
107
|
// Model string is passed to the factory, NOT to chat()
|
|
97
108
|
const adapter = openaiText('gpt-5.2')
|
|
@@ -102,6 +113,7 @@ const adapter5 = groqText('llama-3.3-70b-versatile')
|
|
|
102
113
|
const adapter6 = openRouterText('anthropic/claude-sonnet-4')
|
|
103
114
|
const adapter7 = ollamaText('llama3.3')
|
|
104
115
|
const adapter8 = bedrockText('us.anthropic.claude-3-7-sonnet-20250219-v1:0')
|
|
116
|
+
const adapter9 = byteplusText('seed-2-0-lite-260428')
|
|
105
117
|
|
|
106
118
|
// Optional: pass explicit API key
|
|
107
119
|
const adapterWithKey = openaiText('gpt-5.2', {
|
|
@@ -283,15 +295,16 @@ chat({
|
|
|
283
295
|
|
|
284
296
|
Per-provider sampling keys (all live inside `modelOptions`):
|
|
285
297
|
|
|
286
|
-
| Provider | Temperature | Nucleus | Max output tokens
|
|
287
|
-
| ----------------- | ------------- | ------- |
|
|
288
|
-
| OpenAI | `temperature` | `top_p` | `max_output_tokens`
|
|
289
|
-
| Anthropic | `temperature` | `top_p` | `max_tokens`
|
|
290
|
-
| Gemini | `temperature` | `topP` | `maxOutputTokens`
|
|
291
|
-
| Grok (xAI) | `temperature` | `top_p` | `max_tokens`
|
|
292
|
-
| Groq | `temperature` | `top_p` | `max_completion_tokens`
|
|
293
|
-
| OpenRouter (chat) | `temperature` | `topP` | `maxCompletionTokens`
|
|
294
|
-
| Ollama | `temperature` | `top_p` | `num_predict` (nested in `options`)
|
|
298
|
+
| Provider | Temperature | Nucleus | Max output tokens |
|
|
299
|
+
| ----------------- | ------------- | ------- | ----------------------------------------- |
|
|
300
|
+
| OpenAI | `temperature` | `top_p` | `max_output_tokens` |
|
|
301
|
+
| Anthropic | `temperature` | `top_p` | `max_tokens` |
|
|
302
|
+
| Gemini | `temperature` | `topP` | `maxOutputTokens` |
|
|
303
|
+
| Grok (xAI) | `temperature` | `top_p` | `max_tokens` |
|
|
304
|
+
| Groq | `temperature` | `top_p` | `max_completion_tokens` |
|
|
305
|
+
| OpenRouter (chat) | `temperature` | `topP` | `maxCompletionTokens` |
|
|
306
|
+
| Ollama | `temperature` | `top_p` | `num_predict` (nested in `options`) |
|
|
307
|
+
| BytePlus | `temperature` | `top_p` | `max_tokens` (or `max_completion_tokens`) |
|
|
295
308
|
|
|
296
309
|
`temperature` is the one key every provider names identically; token limits and
|
|
297
310
|
some sampling options use provider-native names. Ollama nests all sampling under
|
|
@@ -324,20 +337,29 @@ runs.
|
|
|
324
337
|
|
|
325
338
|
Current per-adapter status (#605):
|
|
326
339
|
|
|
327
|
-
| Adapter | Returns
|
|
328
|
-
| -------------------------------------------- |
|
|
329
|
-
| `openaiText` / `openaiChatCompletions` | `true` (all supported models)
|
|
330
|
-
| `anthropicText` | `true` for Claude 4.5+ (gated by `ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS`), `false` otherwise
|
|
331
|
-
| `geminiText` | `true` for Gemini 3.x (gated by `GEMINI_COMBINED_TOOLS_AND_SCHEMA_MODELS`), `false` otherwise
|
|
332
|
-
| `grokText` | `true` for Grok 4 family (gated by `GROK_COMBINED_TOOLS_AND_SCHEMA_MODELS`), `false` otherwise
|
|
333
|
-
| `groqText` | `false` (Groq API rejects schema + tools + stream)
|
|
334
|
-
| `openRouterText` / `openRouterResponsesText` | `false` (per-call resolution is a follow-up)
|
|
335
|
-
| `ollamaText` | `false` (constrained-decoding vs tool-call grammar conflict)
|
|
340
|
+
| Adapter | Returns |
|
|
341
|
+
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
342
|
+
| `openaiText` / `openaiChatCompletions` | `true` (all supported models) |
|
|
343
|
+
| `anthropicText` | `true` for Claude 4.5+ (gated by `ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS`), `false` otherwise |
|
|
344
|
+
| `geminiText` | `true` for Gemini 3.x (gated by `GEMINI_COMBINED_TOOLS_AND_SCHEMA_MODELS`), `false` otherwise |
|
|
345
|
+
| `grokText` | `true` for Grok 4 family (gated by `GROK_COMBINED_TOOLS_AND_SCHEMA_MODELS`), `false` otherwise |
|
|
346
|
+
| `groqText` | `false` (Groq API rejects schema + tools + stream) |
|
|
347
|
+
| `openRouterText` / `openRouterResponsesText` | `false` (per-call resolution is a follow-up) |
|
|
348
|
+
| `ollamaText` | `false` (constrained-decoding vs tool-call grammar conflict) |
|
|
349
|
+
| `byteplusText` | Per model — `true` only for the 10 ids in `BYTEPLUS_STRUCTURED_OUTPUT_CHAT_MODELS`, `false` otherwise |
|
|
336
350
|
|
|
337
351
|
Subclasses can override to narrow the capability. When extending an
|
|
338
352
|
adapter for a custom model that doesn't support the combination, return
|
|
339
353
|
`false` explicitly.
|
|
340
354
|
|
|
355
|
+
> **BytePlus has no JSON-mode fallback.** On the 8 chat models outside
|
|
356
|
+
> `BYTEPLUS_STRUCTURED_OUTPUT_CHAT_MODELS`, Ark rejects `json_schema` _and_
|
|
357
|
+
> `json_object`, so `false` here does not buy a degraded path — it only keeps
|
|
358
|
+
> `response_format` out of the streaming chat request. `structuredOutput()`
|
|
359
|
+
> throws and `structuredOutputStream()` emits `RUN_ERROR` on those models.
|
|
360
|
+
> Note `seed-2-0-lite-260428` (the obvious default) is one of them; use
|
|
361
|
+
> `seed-2-0-lite-260228` or `dola-seed-2-1-turbo-260628` for typed output.
|
|
362
|
+
|
|
341
363
|
### 6. OpenAI-Compatible Providers
|
|
342
364
|
|
|
343
365
|
Any provider that implements the OpenAI **Chat Completions** API (DeepSeek,
|
|
@@ -443,6 +465,7 @@ Detailed per-adapter reference files:
|
|
|
443
465
|
- [Grok Adapter](references/grok-adapter.md)
|
|
444
466
|
- [Groq Adapter](references/groq-adapter.md)
|
|
445
467
|
- [OpenRouter Adapter](references/openrouter-adapter.md)
|
|
468
|
+
- [BytePlus Adapter](references/byteplus-adapter.md)
|
|
446
469
|
|
|
447
470
|
## Tension
|
|
448
471
|
|
|
@@ -67,9 +67,7 @@ chat({
|
|
|
67
67
|
// Tool choice
|
|
68
68
|
tool_choice: { type: 'auto' },
|
|
69
69
|
// Context management
|
|
70
|
-
context_management: {
|
|
71
|
-
/* BetaContextManagementConfig */
|
|
72
|
-
},
|
|
70
|
+
context_management: {/* BetaContextManagementConfig */},
|
|
73
71
|
// MCP servers (max 20)
|
|
74
72
|
mcp_servers: [
|
|
75
73
|
{
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# BytePlus Adapter Reference
|
|
2
|
+
|
|
3
|
+
## Package
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
@tanstack/ai-byteplus
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Adapter Factories
|
|
10
|
+
|
|
11
|
+
| Factory | Type | Description |
|
|
12
|
+
| ----------------------- | ------------- | -------------------------- |
|
|
13
|
+
| `byteplusText` | Text/Chat | ModelArk chat completions |
|
|
14
|
+
| `byteplusVideo` | Video | Seedance async task API |
|
|
15
|
+
| `byteplusImage` | Image | Seedream image generation |
|
|
16
|
+
| `byteplusSpeech` | TTS | Seed Speech text-to-speech |
|
|
17
|
+
| `byteplusTranscription` | Transcription | Seed Speech ASR |
|
|
18
|
+
|
|
19
|
+
Each has a `createBytePlus*(model, apiKey, config?)` sibling that takes an
|
|
20
|
+
explicit key instead of reading the environment.
|
|
21
|
+
|
|
22
|
+
## Import
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import {
|
|
26
|
+
byteplusText,
|
|
27
|
+
byteplusVideo,
|
|
28
|
+
byteplusImage,
|
|
29
|
+
} from '@tanstack/ai-byteplus'
|
|
30
|
+
import { byteplusSpeech, byteplusTranscription } from '@tanstack/ai-byteplus'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Key Chat Models
|
|
34
|
+
|
|
35
|
+
| Model | Context | Notes |
|
|
36
|
+
| ---------------------------- | ------- | ------------------------------------------------------------------ |
|
|
37
|
+
| `dola-seed-2-1-turbo-260628` | 256K | Flagship; text/image/video in; structured output; thinking summary |
|
|
38
|
+
| `seed-2-0-lite-260428` | 256K | Good default; audio in; **no** structured output |
|
|
39
|
+
| `seed-2-0-mini-260428` | 256K | Smallest 2.0; audio in; **no** structured output |
|
|
40
|
+
| `seed-2-0-pro-260328` | 256K | Structured output; thinking summary |
|
|
41
|
+
| `seed-2-0-lite-260228` | 256K | Structured output — use instead of `-260428` for typed output |
|
|
42
|
+
| `seed-1-6-flash-250715` | 256K | Fast/cheap; structured output |
|
|
43
|
+
| `glm-5-2-260617` | 1024K | Structured output; `reasoning_effort` incl. `none`/`xhigh`/`max` |
|
|
44
|
+
| `deepseek-v4-pro-260425` | 1024K | 384K output; no structured output |
|
|
45
|
+
| `deepseek-v3-2-251201` | 128K | Reasoning defaults **off**; no structured output |
|
|
46
|
+
| `gpt-oss-120b-250805` | 128K | Only model accepting `thinking: { type: 'auto' }` |
|
|
47
|
+
|
|
48
|
+
`BYTEPLUS_CHAT_MODELS` is the full list of 18 (also
|
|
49
|
+
`seed-2-0-mini-260215`, `seed-2-0-code-preview-260328`, `seed-1-8-251228`,
|
|
50
|
+
`seed-1-6-250915`, `seed-1-6-250615`, `seed-1-6-flash-250615`,
|
|
51
|
+
`glm-4-7-251222`, `deepseek-v4-flash-260425`).
|
|
52
|
+
|
|
53
|
+
Media models: `BYTEPLUS_VIDEO_MODELS` (Seedance —
|
|
54
|
+
`dreamina-seedance-2-0-260128` / `-fast-260128` / `-mini-260615`,
|
|
55
|
+
`seedance-1-5-pro-251215`, `seedance-1-0-pro-250528`,
|
|
56
|
+
`seedance-1-0-pro-fast-251015`), `BYTEPLUS_IMAGE_MODELS` (Seedream —
|
|
57
|
+
`dola-seedream-5-0-pro-260628`, `seedream-5-0-260128`,
|
|
58
|
+
`seedream-5-0-lite-260128`, `seedream-4-5-251128`, `seedream-4-0-250828`),
|
|
59
|
+
`BYTEPLUS_TTS_MODELS` (`seed-audio-1.0`) and
|
|
60
|
+
`BYTEPLUS_TRANSCRIPTION_MODELS` (`seed-asr`).
|
|
61
|
+
|
|
62
|
+
## Provider-Specific modelOptions
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
chat({
|
|
66
|
+
adapter: byteplusText('dola-seed-2-1-turbo-260628'),
|
|
67
|
+
messages,
|
|
68
|
+
modelOptions: {
|
|
69
|
+
// Ark-only
|
|
70
|
+
thinking: { type: 'enabled' }, // 'enabled' | 'disabled' | 'auto' ('auto': gpt-oss-120b only)
|
|
71
|
+
reasoning_effort: 'medium', // 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'
|
|
72
|
+
repetition_penalty: 1.1,
|
|
73
|
+
service_tier: 'default', // 'default' | 'flex' (flex = cheaper offline batch queue)
|
|
74
|
+
// Sampling (OpenAI-compatible names)
|
|
75
|
+
temperature: 0.7,
|
|
76
|
+
top_p: 0.9,
|
|
77
|
+
top_k: 40,
|
|
78
|
+
frequency_penalty: 0.5,
|
|
79
|
+
presence_penalty: 0.5,
|
|
80
|
+
seed: 42,
|
|
81
|
+
stop: ['\n\n'],
|
|
82
|
+
// Token limits — mutually exclusive
|
|
83
|
+
max_tokens: 2048,
|
|
84
|
+
// max_completion_tokens: 2048,
|
|
85
|
+
// Tool calling
|
|
86
|
+
tool_choice: 'auto',
|
|
87
|
+
parallel_tool_calls: true,
|
|
88
|
+
// Logging / attribution
|
|
89
|
+
logprobs: true,
|
|
90
|
+
top_logprobs: 5,
|
|
91
|
+
user: 'user-123',
|
|
92
|
+
},
|
|
93
|
+
})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`response_format` is deliberately **not** a provider option — the chat
|
|
97
|
+
activity owns it via `outputSchema`.
|
|
98
|
+
|
|
99
|
+
## Environment Variables
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
ARK_API_KEY # chat, video, image (falls back to BYTEPLUS_API_KEY)
|
|
103
|
+
BYTEPLUS_VOICE_API_KEY # TTS + transcription — a DIFFERENT product key
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Gotchas
|
|
107
|
+
|
|
108
|
+
- **Two products, two keys.** ModelArk uses `Authorization: Bearer $ARK_API_KEY`
|
|
109
|
+
at `ark.ap-southeast.bytepluses.com`; Seed Speech uses
|
|
110
|
+
`X-Api-Key: $BYTEPLUS_VOICE_API_KEY` at `voice.ap-southeast-1.bytepluses.com`.
|
|
111
|
+
An Ark key on the voice host fails with `45000010 Invalid X-Api-Key`.
|
|
112
|
+
- **Ark keys are region-isolated.** The default base URL is ap-southeast; the EU
|
|
113
|
+
endpoint serves chat and image only (no Seedance). Override with
|
|
114
|
+
`config.baseURL`.
|
|
115
|
+
- **Structured output is per model and fails loud.** Only the 10 ids in
|
|
116
|
+
`BYTEPLUS_STRUCTURED_OUTPUT_CHAT_MODELS` accept `json_schema`; the other 8
|
|
117
|
+
reject `json_object` too, so there is no JSON-mode fallback. `glm-4-7-251222`
|
|
118
|
+
is excluded deliberately — it accepts the schema with `200` and then answers
|
|
119
|
+
in prose. `seed-2-0-lite-260428` is _not_ on the list.
|
|
120
|
+
- **`reasoning_effort` + `thinking: { type: 'disabled' }` is a 400.** So is
|
|
121
|
+
sending both `max_tokens` and `max_completion_tokens`.
|
|
122
|
+
- **`reasoning_effort` values are gated per model.** `minimal` / `low` /
|
|
123
|
+
`medium` / `high` are general; `none` and `xhigh` are accepted only by
|
|
124
|
+
`glm-5-2-260617`; `max` only by `glm-5-2-260617` and the two
|
|
125
|
+
`deepseek-v4-*-260425` models. `thinking: { type: 'auto' }` is
|
|
126
|
+
`gpt-oss-120b-250805` only.
|
|
127
|
+
- **Reasoning is on by default** on every model except `deepseek-v3-2-251201`.
|
|
128
|
+
- **`encrypted_content` round-trip.** The four thinking-summary models
|
|
129
|
+
(`dola-seed-2-1-turbo-260628`, `seed-2-0-lite-260428`,
|
|
130
|
+
`seed-2-0-mini-260428`, `seed-2-0-pro-260328`) emit an opaque signature over
|
|
131
|
+
the reasoning trace that BytePlus asks for back on the next turn. The adapter
|
|
132
|
+
round-trips it automatically over the same seam Anthropic thinking signatures
|
|
133
|
+
use: it is captured onto `STEP_FINISHED.signature`, which lands on the
|
|
134
|
+
thinking part as `ModelMessage.thinking[].signature` and is echoed back on the
|
|
135
|
+
following request. Code that persists and replays history by hand must **keep
|
|
136
|
+
the thinking part's `signature`** — not "message metadata", which is a
|
|
137
|
+
different field and carries nothing here. Losing it costs a reasoning-cache
|
|
138
|
+
hit, not the request: a live probe confirmed Ark accepts a turn whose
|
|
139
|
+
assistant message omits `encrypted_content`. A structured-output turn doesn't
|
|
140
|
+
capture the blob at all, for the same reason.
|
|
141
|
+
- **Model ids are dated and retired aggressively.** Only ids verified against a
|
|
142
|
+
live request are exported; the published BytePlus lists include dead ones.
|
|
143
|
+
Bare ids mostly don't resolve — the `dola-` prefix is required on
|
|
144
|
+
`dola-seed-2-1-turbo-260628` and the `dreamina-` prefix on the Seedance 2.0
|
|
145
|
+
family, but adding `dola-` to an older id 404s.
|
|
146
|
+
- **Media option applicability is per model and enforced server-side** — Ark
|
|
147
|
+
400s on an inapplicable Seedance field instead of ignoring it. See the
|
|
148
|
+
media-generation skill.
|
|
@@ -59,14 +59,10 @@ chat({
|
|
|
59
59
|
},
|
|
60
60
|
],
|
|
61
61
|
// Tool config
|
|
62
|
-
toolConfig: {
|
|
63
|
-
/* ToolConfig */
|
|
64
|
-
},
|
|
62
|
+
toolConfig: {/* ToolConfig */},
|
|
65
63
|
// Structured output
|
|
66
64
|
responseMimeType: 'application/json',
|
|
67
|
-
responseSchema: {
|
|
68
|
-
/* Schema */
|
|
69
|
-
},
|
|
65
|
+
responseSchema: {/* Schema */},
|
|
70
66
|
// Cached content
|
|
71
67
|
cachedContent: 'cachedContents/abc123',
|
|
72
68
|
// Response modalities
|
|
@@ -49,9 +49,7 @@ chat({
|
|
|
49
49
|
// Response format
|
|
50
50
|
response_format: {
|
|
51
51
|
type: 'json_schema',
|
|
52
|
-
json_schema: {
|
|
53
|
-
/* ... */
|
|
54
|
-
},
|
|
52
|
+
json_schema: {/* ... */},
|
|
55
53
|
},
|
|
56
54
|
// Sampling
|
|
57
55
|
temperature: 0.7,
|
|
@@ -71,9 +69,7 @@ chat({
|
|
|
71
69
|
// Documents for context
|
|
72
70
|
documents: [{ text: '...' }],
|
|
73
71
|
// Search settings (for web search tool)
|
|
74
|
-
search_settings: {
|
|
75
|
-
/* SearchSettings */
|
|
76
|
-
},
|
|
72
|
+
search_settings: {/* SearchSettings */},
|
|
77
73
|
// Service tier
|
|
78
74
|
service_tier: 'auto', // 'auto' | 'on_demand' | 'flex' | 'performance'
|
|
79
75
|
// Metadata
|
|
@@ -64,9 +64,7 @@ chat({
|
|
|
64
64
|
parallel_tool_calls: true,
|
|
65
65
|
tool_choice: 'auto', // 'auto' | 'none' | 'required'
|
|
66
66
|
// Structured output
|
|
67
|
-
text: {
|
|
68
|
-
/* ResponseTextConfig */
|
|
69
|
-
},
|
|
67
|
+
text: {/* ResponseTextConfig */},
|
|
70
68
|
// Metadata (max 16 key-value pairs)
|
|
71
69
|
metadata: { session_id: 'abc' },
|
|
72
70
|
// Streaming
|
|
@@ -8,7 +8,7 @@ description: >
|
|
|
8
8
|
NDJSON format. For backends serving AG-UI events without client packages.
|
|
9
9
|
type: sub-skill
|
|
10
10
|
library: tanstack-ai
|
|
11
|
-
library_version: '0.
|
|
11
|
+
library_version: '0.42.0'
|
|
12
12
|
sources:
|
|
13
13
|
- 'TanStack/ai:docs/protocol/chunk-definitions.md'
|
|
14
14
|
- 'TanStack/ai:docs/protocol/sse-protocol.md'
|