How to lower Claude Code costs on a Roblox game
Why Claude Code's cost does not follow its token count one-to-one, and the changes that lowered the cost of script work on a Roblox game in a measured test.
Short answer
Claude Code's cost depends on which tokens it uses, not only how many. Tokens read from the prompt cache are billed at about a tenth of the normal input price, while output tokens cost several times the input price. So the cost falls most when the model reads less new material and writes less, keeps its cache warm and runs at an effort level that fits the task. In our benchmark on a Roblox game, working on synced script files instead of through the Studio MCP alone cut tokens by 67% but estimated cost by 28%.
How the cost is made up
With an API key, Claude Code is billed at Anthropic's API prices per million tokens, in four kinds:
| Kind | What it is | Price relative to input |
|---|---|---|
| Input | New text the model has not seen in this cache, such as a file it just read | 1× |
| Cache write | Input stored in the prompt cache for the next turns | a little more than 1× |
| Cache read | Input the model already saw, served from the cache: tool definitions, earlier turns | about 0.1× |
| Output | What the model writes, including tool calls and edits | several times input |
For example, Anthropic lists Claude Sonnet 5.5 at $2 per million input tokens, $10 per million output tokens and $0.10 per million cache-read tokens. Prices change; check Anthropic's pricing page for current ones. On a Claude subscription you pay a flat fee instead, but the same tokens count towards your usage limits.
Because every turn sends the whole conversation again, most tokens in a long session are cache reads. That is why a session can use millions of tokens and still cost a few dollars, and why cutting tokens does not cut cost by the same share.
What we measured
In our benchmark, five script tasks on a Roblox game of 220 scripts were run three times in each setup with Claude Sonnet 5.5 at medium effort.
| Setup | Tokens, per-task medians summed | Estimated cost, all 15 runs |
|---|---|---|
| Studio MCP alone | 697,387 | $1.09 |
| Synced files alone | 232,465 | $0.79 |
| Studio MCP and synced files | 570,579 | $0.88 |
Files used 67% fewer tokens but only 28% less money. Most of the tokens saved were the Studio MCP's tool definitions, sent again on every turn as cache reads, and those are cheap.
On one task the cheaper-in-tokens setup cost more. Renaming a function across seven scripts took 17 turns with files against 6 through the Studio MCP, and about three times the output tokens, because each file was edited separately. It cost $0.079 a run against $0.029.
Ways to lower the cost
- Cut what the model reads fresh. A search that returns ten matching lines costs less than reading the whole script. Keeping scripts as files on disk makes that possible; see how to reduce AI token usage on a Roblox project.
- Cut what the model writes. Output is the most expensive kind. Ask for the change, not an explanation of it, and prefer targeted edits over rewritten scripts.
- Keep the cache warm. The prompt cache matches the start of each request exactly. Connecting or disconnecting an MCP server, or editing
CLAUDE.md, mid-session changes that start and the next turn is billed as new input. Set up your tools before you start. - Connect fewer MCP servers. Each server's tool definitions are paid on every turn, cheaply when cached but never for free. In our test, adding the Studio MCP to file tools added about 19,000 tokens to every request.
- Match the model and effort to the task. In Claude Code,
/modelswitches model. A smaller model or a lower effort level is often enough for a one-line change; keep the stronger settings for design work and hard bugs, and measure on your own tasks before changing defaults. - Keep sessions short and focused.
/clearbetween unrelated tasks stops old context from being re-sent;/compactsummarises a long session. - Use each tool where it is cheap. Batch renames across many scripts may cost less through the Studio MCP; everyday edits cost less on files.
Questions
Is the Roblox Studio MCP expensive to keep connected?
In our setup its tool definitions added 16,000 to 19,000 tokens to every request. Most of that is billed as cache reads, so the money cost is modest per turn, but it never goes away while the server is connected. Claude Code can defer MCP tool definitions behind a tool search in some setups, which lowers that fixed cost; our benchmark did not use that.
Does RoPhons charge per token?
No. RoPhons does not see or bill your AI tokens; your AI provider does. RoPhons plans count the calls your AI tools make to RoPhons's own MCP server per day: 150 on Free and 2,000 on Pro. Editing the synced files does not count as a call. See pricing.
How do I check what a Claude Code run cost?
In headless mode, claude -p --output-format json returns the token counts and total_cost_usd, Claude Code's estimate at API prices. In an interactive session, /context shows what fills the context.
Read next
- Benchmark: token use with the Roblox Studio MCP and with synced script files
- How to reduce AI token usage on a Roblox project
- Roblox Studio MCP or synced files: which should your AI use?
- How to sync Roblox scripts between Studio and your code editor
- How to give AI coding tools persistent context for a Roblox game