Credentials. The printed API key controls access to the public endpoint, so do not share it or commit it to a repo.
Who it is forA developer who wants to use Claude Code with an open model instead of a paid cloud API, and has a Kaggle account with TPU access.
The problemRunning a large open model usually needs a GPU or a cloud bill, and Claude Code expects an Anthropic-style endpoint.
The outcomeClaude Code answers from an open model served from a Kaggle TPU at a public URL that speaks the Anthropic API.
What you need first
- A Kaggle account with TPU access, verified under Settings (phone number, and for some accounts a Persona identity check)
- Kaggle's free TPU quota, around 20 TPU hours a week
- For the terminal route: Python 3.9+ and the Kaggle CLI
Steps
- Open the Qwen3.8-27B or GLM-5.3-Flash notebook linked in the model table of the README and click Run all.
- Wait for the last cell to print the public URL and an API key, then leave that cell running.
- Set the variables from the README in your shell:
ANTHROPIC_BASE_URL=<url> ANTHROPIC_AUTH_TOKEN=<key> ANTHROPIC_MODEL=<model>followed byclaude. (inferred, check the README) - Send a short test prompt in Claude Code and confirm a reply comes back from the endpoint.
- When the session ends (a little under nine hours), run the notebook again to get a new URL and key.
Prompt for your agent
In the ARahim3/kaggle-tpu-lab repo, open the Qwen3.8-27B notebook from the model table, run it on Kaggle, and copy the printed URL and API key into ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, with ANTHROPIC_MODEL set to <model>. Expected output: a Claude Code reply to a test prompt from the open model. Verify that the endpoint answers before reporting success.
Caveat. The endpoint lasts only until the Kaggle session limit, a little under nine hours, so you must restart the notebook to get a new URL.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for ARahim3/kaggle-tpu-lab and "Run a free open model as an endpoint for Claude Code"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer