[FEATURE]:allow setting the context size for local models #4186

Open
opened 2026-02-16 17:42:57 -05:00 by yindo · 2 comments
Owner

Originally created by @iplayfast on GitHub (Jan 4, 2026).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

An example of getting a response and setting the context length.

curl http://localhost:11434/api/generate -d '{
"model": "llama3.2",
"prompt": "Why is the sky blue?",
"options": {
"num_ctx": 4096
}
}'

It would be good to be able to specify either in the parameter file the num_ctx to send to the model or allow an overwrite of the context. if using ollama then send the option for num_ctx.

Originally created by @iplayfast on GitHub (Jan 4, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request An example of getting a response and setting the context length. curl http://localhost:11434/api/generate -d '{ "model": "llama3.2", "prompt": "Why is the sky blue?", "options": { "num_ctx": 4096 } }' It would be good to be able to specify either in the parameter file the num_ctx to send to the model or allow an overwrite of the context. if using ollama then send the option for num_ctx.
yindo added the discussion label 2026-02-16 17:42:57 -05:00
Author
Owner

@Material-Scientist commented on GitHub (Jan 8, 2026):

I'm not sure what I'm doing wrong. I've set limits via limit param (according to docs):

"models": {
        "gpt-oss-120b-GGUF": {
          "id": "gpt-oss-120b-GGUF",
          "name": "gpt-oss-120b-GGUF",
          "tool_call": true,
          "reasoning": true,
          "limit": {
            "context": 128000,
            "output": 65536
          }
        },
				"Qwen3-8B-128k-GGUF": {
          "id": "Qwen3-8B-128k-GGUF",
          "name": "Qwen3-8B-128k-GGUF",
          "tool_call": true,
          "reasoning": false,
          "limit": {
            "context": 128000,
            "output": 65536
          }
        }

But I'm still getting "request (32936 tokens) exceeds the available context size of (32512 tokens), try increasing it". My local models have a 128k context limit.

@Material-Scientist commented on GitHub (Jan 8, 2026): I'm not sure what I'm doing wrong. I've set limits via `limit` param (according to [docs](https://opencode.ai/docs/providers/#llamacpp)): ```json "models": { "gpt-oss-120b-GGUF": { "id": "gpt-oss-120b-GGUF", "name": "gpt-oss-120b-GGUF", "tool_call": true, "reasoning": true, "limit": { "context": 128000, "output": 65536 } }, "Qwen3-8B-128k-GGUF": { "id": "Qwen3-8B-128k-GGUF", "name": "Qwen3-8B-128k-GGUF", "tool_call": true, "reasoning": false, "limit": { "context": 128000, "output": 65536 } } ``` But I'm still getting "request (32936 tokens) exceeds the available context size of (32512 tokens), try increasing it". My local models have a 128k context limit.
Author
Owner

@FDT2k commented on GitHub (Feb 4, 2026):

if you're using llama.cpp It's because of --parallel. It divides the context by this value

@FDT2k commented on GitHub (Feb 4, 2026): if you're using llama.cpp It's because of --parallel. It divides the context by this value
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4186