Skip to content

Run Workers AI models without an API Key in Tanstack AI#398

Merged
threepointone merged 6 commits intomainfrom
fix-tanstack-workers-ai
Mar 18, 2026
Merged

Run Workers AI models without an API Key in Tanstack AI#398
threepointone merged 6 commits intomainfrom
fix-tanstack-workers-ai

Conversation

@vaibhavshn
Copy link
Collaborator

@vaibhavshn vaibhavshn commented Feb 12, 2026

Updated tanstack ai workers-ai adapter to make sure that when using gateway, you don't need to pass in an workers ai token.

@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2026

🦋 Changeset detected

Latest commit: e25d215

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/tanstack-ai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 12, 2026

Open in StackBlitz

npx https://pkg.pr.new/cloudflare/ai/ai-gateway-provider@398
npx https://pkg.pr.new/cloudflare/ai/@cloudflare/tanstack-ai@398
npx https://pkg.pr.new/cloudflare/ai/workers-ai-provider@398

commit: e25d215

@vaibhavshn vaibhavshn force-pushed the fix-tanstack-workers-ai branch from 802fbf2 to 3b43181 Compare February 13, 2026 10:08
@vaibhavshn vaibhavshn changed the title Include WORKERS_AI_API_KEY in Tanstack AI example Run Workers AI models without an API Key Feb 13, 2026
@vaibhavshn vaibhavshn changed the title Run Workers AI models without an API Key Run Workers AI models without an API Key in Tanstack AI Feb 13, 2026

if (provider === "workers-ai") {
request.endpoint = query.model as string;
request.endpoint = `run/${query.model}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably check if query.model already starts with run/ and add it only if it doesn't

also will the ai gateway team commit to always having this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to. check what ai-gateway-provider is doing here as well

@threepointone
Copy link
Collaborator

wanna add some tests for the changes you made?

@vaibhavshn
Copy link
Collaborator Author

wanna add some tests for the changes you made?

Yes, adding!

@vaibhavshn
Copy link
Collaborator Author

Added tests!

vaibhavshn and others added 6 commits March 18, 2026 20:58
also updated the example to use the config properly
Update changelog to note adding `run/` prefix to workers-ai gateway endpoint and making API key optional for gateway bindings. Adjust test: rename to clarify it should not double-prefix `run/`, ensure model is sent without the `run/` prefix, and assert that `request.query.model` is undefined.
@threepointone threepointone force-pushed the fix-tanstack-workers-ai branch from 694255d to e25d215 Compare March 18, 2026 21:09
@threepointone threepointone merged commit 64858b5 into main Mar 18, 2026
3 checks passed
@threepointone threepointone deleted the fix-tanstack-workers-ai branch March 18, 2026 21:13
@github-actions github-actions bot mentioned this pull request Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants