> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arakun.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Workers AI

> Run Cloudflare Workers AI models as an agent in Arakun. Nothing to install; give it an API token, then pick a model.

For Cloudflare Workers AI there is no outside CLI. Arakun runs the tool loop itself against the Workers AI API, so there is nothing to install.

## Sign in

You need a Cloudflare API token with Workers AI access, and your account id. Give them to Arakun in one of two ways:

* Set `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` in the environment Arakun starts in.
* Or run `opencode auth login`, pick Cloudflare Workers AI and paste the token. This needs the [OpenCode](https://docs.arakun.dev/opencode.md) CLI. If the account id is not saved with it, put it in `~/.config/opencode/cf-account-id`.

Workers AI has no section in Settings. When a session is not signed in, the error has a **Sign in in a terminal** button that runs `opencode auth login`. The token goes only to api.cloudflare.com.

## Pick a model

| Model | Price per million tokens, in / out | Context |
| - | - | - |
| DeepSeek V4.1 Flash (the default) | $0.30 / $1.20 | 1M |
| GLM 5.3 | $1.40 / $4.40 | 1M |
| GPT-OSS 120B | $0.35 / $0.75 | 128K |
| Claude Sonnet 5.5 | $2.00 / $10.00 | 1M |

Pick the model and the reasoning level in the composer. Switching models sets the reasoning level back to that model's default. The session shows its tokens and cost as it goes, worked out from these prices.

> [!NOTE]
>
> **Claude Sonnet 5.5 is not a Workers AI model**
>
> Arakun sends it to Anthropic's API, so it needs an Anthropic API key (pay per use). Put the key in `~/.config/arakun/anthropic-key`, one line, or set `ARAKUN_ANTHROPIC_KEY`. Arakun ignores `ANTHROPIC_API_KEY`.

## What it can do

The agent can run shell commands, read, write and edit files, search the code, fetch and search the web, and load skills. It asks before each shell command and each edit: **Allow**, **Always allow commands** (or **edits**), or **Deny**, which stops the turn. It reads the project's `AGENTS.md`, or `CLAUDE.md` if there is none.

Web fetch stops when a site refuses it with a 401, 403, 429, 451 or 503, or a bot check. Web search, which reads DuckDuckGo, stops when DuckDuckGo answers with a bot check. The agent gets the reason, and neither tries another way around. Web fetch asks the site directly first and uses [Browser Run](https://docs.arakun.dev/fetch-web-pages.md) only for a page that needs JavaScript, when a Browser Run token is set up.

Sessions are saved, so you can resume one after a restart. [Headless agents](https://docs.arakun.dev/headless-agents.md) use Workers AI models too, and `arakun agent new --model workers-ai/<model> <prompt>` starts a session from a terminal.

## Skills

A skill is a folder with a `SKILL.md`. Workers AI finds them in:

* `~/.claude/skills` and `~/.agents/skills`
* the project's `.claude/skills` and `.agents/skills`
* the Claude Code plugins you turned on

The system prompt lists each skill's name and description. The agent loads a skill's instructions when a task matches it, or when you type `/<name>`. A skill in your home folder wins over a project skill with the same name. Discover › Skills in the Marketplace installs skills from [skills.sh](https://skills.sh) into `~/.claude/skills`.

## See what uses the tokens

Each turn logs what each tool's results added to the context. Add them up, largest first:

```sh theme={"dark"}
arakun usage tools --days 7
```

Shell commands are split by the program they run, such as `bash cargo` and `bash git`. Add `--json` for JSON.

## What does not work yet

* No MCP servers and no plan mode.
* The Workers AI models can't see images. Arakun has a vision model describe each attached photo and passes the description on. Claude Sonnet 5.5 sees photos itself.
* Sessions are not compacted. When the next request would not fit in the model's context, the session stops; start a new one to go on.
* The Usage tab doesn't show Workers AI.
* Workers AI sessions can't be sandboxed yet, and a headless session's sandbox only sees the project's skills.
* A turn makes at most 200 model calls.

## Rate limits

Arakun keeps to 20 requests a minute per model, across all sessions; GPT-OSS 120B allows 300. Set `ARAKUN_WORKERS_AI_RPM` to change the limit. When Cloudflare answers 429, Arakun waits and retries, up to 8 tries.

## Common errors

> [accordion] Workers AI is not signed in
>
> Arakun found no token, or Cloudflare refused it. Set `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID`, or run `opencode auth login` and paste a token with Workers AI access. Then retry.

> [accordion] Anthropic has no API key
>
> You picked Claude Sonnet 5.5 without an Anthropic key. See the note under "Pick a model".

> [accordion] Workers AI: rate limited (429) … gave up after 8 tries
>
> Cloudflare kept refusing requests. Wait a minute, or lower `ARAKUN_WORKERS_AI_RPM` if several sessions run at once.

> [accordion] Stopped: the next request would not fit in the model's context
>
> Start a new session. GPT-OSS 120B fills up first, at 128K tokens.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.