@tanstack/ai-cloudflare#
0.3.2#
Patch Changes#
0.3.1#
Patch Changes#
- Updated dependencies [
1d0f8f1,1d0f8f1,5f95dbd,3170517,3292bad,ee374b4,3170517,4298480,761a652,f68da51,85c2956,30fa651,1d0f8f1,3170517,3170517]:- @tanstack/ai@0.70.0
- @tanstack/openai-base@0.15.0
- @tanstack/ai-utils@0.5.0
0.3.0#
Minor Changes#
#1721
4069e0e- AddcloudflareBindingFetch({ binding, vendor, gateway }). It sends the requests of the Anthropic and OpenAI text adapters (createAnthropicChat,createOpenaiChat) through the Workers AI binding (env.AI.run) to the AI Gatewayanthropic/...andopenai/...models, so a Worker can use Claude and GPT with no provider key.vendor: 'anthropic'carries Anthropic Messages requests, andvendor: 'openai'carries OpenAI Responses requests.- The request body goes to
env.AI.run('<vendor>/<model>', body). Headers such asanthropic-betago along asextraHeaders, and the SDK's auth and transport headers are dropped. - A Cloudflare error body is rewrapped so the SDK reports its message.
#1739
a0150c2- Text adapters now set one stable code onRUN_ERRORwhen the input does not fit in the model's context window:code: 'context_overflow'.@tanstack/aiexports it asCONTEXT_OVERFLOW_CODE. The provider's own text stays inmessage.if (chunk.type === 'RUN_ERROR' && chunk.code === CONTEXT_OVERFLOW_CODE) { // shorten the messages, then call chat() again }These adapters set it: OpenAI and the other OpenAI-compatible adapters (from
code: 'context_length_exceeded'), Anthropic, Gemini, Bedrock (Converse, Chat Completions, and Responses), OpenRouter, Grok, Cloudflare Workers AI, and BytePlus.Changes to code that reads the old values:
- OpenAI-compatible adapters gave
code: 'context_length_exceeded'. They now give'context_overflow'.rawEventstill has the provider's code. - Anthropic, Grok, OpenRouter, and BytePlus gave the HTTP status or a general bad-request code for this error. Gemini and Bedrock Converse gave no code.
- The Anthropic adapter now sends
RUN_ERRORwith this code when the model stops withstop_reason: 'model_context_window_exceeded'. Before, it sentRUN_FINISHEDwithfinishReason: 'stop', so a cut-off answer looked complete.
- OpenAI-compatible adapters gave
#1692
7532b2b- Set reasoning withchat({ reasoning }).- The adapter sends
reasoning_effort, andnullforoff. - The reasoning data is in
utils/models.ts, keyed by model id.CloudflareModelReasoningByNameandCLOUDFLARE_MODEL_REASONINGcome from it. chat_template_kwargsstays inmodelOptions. It picks the output format, not the effort.
Breaking:
reasoning_effortis no longer inmodelOptions.// Before chat({ adapter: cloudflareText('@cf/zai-org/glm-5.3'), messages, modelOptions: { reasoning_effort: 'low' }, }) // After chat({ adapter: cloudflareText('@cf/zai-org/glm-5.3'), messages, reasoning: 'low', })- The adapter sends
Patch Changes#
- Updated dependencies [
1bfcee3,b881627,412b0fe,a0150c2,20954cc,b881627,fac0555,6774e80,5bd27f2,c20f7b0,cef1911,51f72fb,6f1e559,eb4eea0,cef1911,7532b2b,7532b2b,1bfcee3,78edeb2,44e3a0a,7532b2b,ce99a17,7a5c0d6,b881627]:- @tanstack/ai@0.69.0
- @tanstack/openai-base@0.14.0
- @tanstack/ai-utils@0.4.2
0.2.7#
Patch Changes#
0.2.6#
Patch Changes#
#1680
377262c- AddwrapFetchtochat(), to the middlewareonConfigconfig, and toTextOptions. A wrapper gets the next fetch and gives back a new fetch. Use it to change the URL, the headers, the request, or the response of a model call. The newFetchWrappertype names the wrapper.The engine chains the
chat()wrapper and the middleware wrappers into one function. A middleware wrapper runs inside thechat()wrapper and applies to one model call only.These text adapters send their requests through the wrapper: every adapter on
@tanstack/openai-base(OpenAI, the OpenAI-compatible adapters, Grok, Groq, BytePlus, LLM Gateway, Lovable, Vercel AI Gateway, Cloudflare, and the Bedrock Chat Completions and Responses APIs), Anthropic, Mistral, Ollama, and OpenRouter. The wrapper wraps the fetch of the adapter config, not the global fetch. An Anthropic or Ollama adapter with an injected client ignoreswrapFetch. In Cloudflare binding mode, the wrapper runs, but the binding does not send the URL or the headers. WithoutwrapFetch, the requests do not change.Updated dependencies [
7dbfaf6,88fd67c,3aa2e3d,c5ae415,13ba1b0,377262c]:- @tanstack/ai@0.67.0
- @tanstack/openai-base@0.13.0
0.2.5#
Patch Changes#
#1652
13a5c4c- Update theopenaiSDK dependency to^7.30.0.openai7 requires Node.js 22 or later.Updated dependencies [
13a5c4c]:- @tanstack/openai-base@0.12.6
0.2.4#
Patch Changes#
- Updated dependencies [
f687c54,e14a0f0,fb55bcb,077c96a,630ec86]:- @tanstack/ai@0.66.0
- @tanstack/openai-base@0.12.5
0.2.3#
Patch Changes#
- Updated dependencies [
7b6b1a9,592c72c,592c72c,592c72c,592c72c,82291b2,ff3a66e,560c76f,b414953,4b9dcb4,30254ad,40fdd22]:- @tanstack/ai@0.65.0
- @tanstack/openai-base@0.12.4
0.2.2#
Patch Changes#
- Updated dependencies [
3a09cf0,ee726f5,a5fce7f,94116ad]:- @tanstack/ai@0.64.0
- @tanstack/openai-base@0.12.2
0.2.1#
Patch Changes#
- Updated dependencies [
37b2826,8e8ee26,c5c1996,3e30cde,0eb8f0b,bb3bf30,f44b6b2,d632d41]:- @tanstack/ai@0.63.0
- @tanstack/openai-base@0.12.1
0.2.0#
Minor Changes#
- #1499
f822940- Warn in development when a tool is sent withstrict: falsebecause its schema cannot be strict. The warning names the tool and the reason, for exampletool "lookup_user" sent with strict: false: schema uses $ref, which strict mode does not support. It runs once per tool, never whenNODE_ENVisproduction, and you can turn it off withstrictFallbackWarning: falsein the adapter config.
Patch Changes#
- Updated dependencies [
a450d00,c54e20c,a56192e,740ae66,5099a32,a308fe9,489d610,7e21823,820429f,f822940,0abae97,8c68c2d]:- @tanstack/ai@0.62.0
- @tanstack/openai-base@0.12.0
0.1.8#
Patch Changes#
- Updated dependencies [
54d39d3,2d047c5,74b5823,790cb0a,abb0169,ed87986,a0f7c14]:- @tanstack/ai@0.61.0
- @tanstack/openai-base@0.11.1
0.1.7#
Patch Changes#
0.1.6#
Patch Changes#
0.1.5#
Patch Changes#
- Updated dependencies [
796f2b5]:- @tanstack/ai@0.58.0
- @tanstack/openai-base@0.10.15
0.1.4#
Patch Changes#
#1419
04bfd8c- Add decide() and TypeSafe Jev evaluate adapters.Callers await one decide({ adapter, state, questions }) call. Questions use choice(), score(), and boolean(). Answers sit on the result (value, probability, confidence). Usage sits on result.meta.
Jev transports:
- @tanstack/ai-typesafe (typesafeDecider)
- @tanstack/ai-openrouter (openRouterDecider)
- @tanstack/ai-vercel-gateway (vercelGatewayDecider)
- @tanstack/ai-cloudflare (cloudflareDecider)
Updated dependencies [
04bfd8c,254ab5f]:- @tanstack/ai@0.57.0
- @tanstack/openai-base@0.10.14
0.1.3#
Patch Changes#
0.1.2#
Patch Changes#
0.1.1#
Patch Changes#
0.1.0#
Minor Changes#
- #1309
21775ee- Add@tanstack/ai-cloudflare: a Cloudflare adapter for Workers AI chat, summarization, embeddings, image generation, text-to-speech, and transcription over theenv.AIbinding or the REST API, with AI Gateway routing (gatewayoption andcloudflareGateway()helper for other providers).@tanstack/ailearns thecloudflaremax-tokens key for summarize, letsdefineByokProviderdeclare companion credentials withwith, and addsgetByokKeys(request, { name: provider })to@tanstack/ai/byok/server.@tanstack/ai-client'sdefineByoktakesproviders: a send for a provider with companions (Cloudflare token plus account id) carries everyx-byok-*header and prompts for each missing value.
Patch Changes#
- Updated dependencies [
21775ee]:- @tanstack/ai@0.53.0
- @tanstack/openai-base@0.10.10