# Ollama with Claude Code keeps hitting output token maximum. — retained record

> Retained reddit record from reddit:ollama.

Canonical: https://highsignal.app/data/records/127cc642046cc391

[← sources](https://highsignal.app/data)


source: [reddit](https://highsignal.app/data/reddit) (reddit:ollama)  published 2026-10-13 01:57 ingested 2026-10-14 02:42

[original source ↗](https://www.reddit.com/r/ollama/comments/1x4kd2a/ollama_with_claude_code_keeps_hitting_output/)

## retained text



```
   >API Error: Claude's response exceeded the 128000 output token maximum. To configure this behavior, set the CLAUDE_CODE_MAX_OUTPUT_TOKENS environment variable.    

I've been getting this error constantly while trying to use Ollama with Claude. Everywhere I look, I'm just told to change the CLAUDE_CODE_MAX_OUTPUT_TOKENS. But I've tried it big and I've tried it small but it still gets overrun when I try to do any kind of coding.

Does anyone familiar with using Claude with Ollama know how to workaround this issue?

I'm currently using "gpt-oss:20b" model but this has occurred with every model I've tried so far.
```



document fetched 2026-10-14 00:41 · canonical https://reddit.com/r/ollama/comments/1x4kd2a/ollama_with_claude_code_keeps_hitting_output
