Skip to content

Added 2 custom settings to Custom OpenAI to set context size and max output per model#1197

Merged
carlrobertoh merged 2 commits intocarlrobertoh:masterfrom
sapphirepro:master
Mar 17, 2026
Merged

Added 2 custom settings to Custom OpenAI to set context size and max output per model#1197
carlrobertoh merged 2 commits intocarlrobertoh:masterfrom
sapphirepro:master

Conversation

@sapphirepro
Copy link
Copy Markdown
Contributor

Added 2 fields in settings per model below API key to set context windows size of model and max output tokens to calculate correct remaining % of context windows in Agent mode.

Patch is lightweight and from my end works fine. Review still recommended.

изображение Screenshot_20260315_012440

Useful for custom models, especially for strong models with huge context to avoid trim on low context specs. Users sets values manually, liability for correct data relies on user.

Added fields in settings to manually set max overall context and max output context for calculation  in agent mode. Default values were too low and didn't count specific model specs. Now it's solved
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 15, 2026

@sapphirepro is attempting to deploy a commit to the carlrobertohgmailcom's projects Team on Vercel.

A member of the Team first needs to authorize it.

@carlrobertoh
Copy link
Copy Markdown
Owner

Let's add only one extra additional field "Context length" and take the max_completion_tokens or max_tokens from the request body. I think there's no need to have it as a separate input.

@sapphirepro
Copy link
Copy Markdown
Contributor Author

sapphirepro commented Mar 15, 2026

Let's add only one extra additional field "Context length" and take the max_completion_tokens or max_tokens from the request body. I think there's no need to have it as a separate input.

Could be done so, yeah, but the problem is, that in model params max token size param name differs depending on protocol, even completions and responses api are different param name. So I did this way to avoid breaking up the rest of the code. If you have solution to get that param correctly independent from protocol, maybe you could patch yourself. I do not feel confident here to implement your idea, even it sounds actually logical and was my first thought.

Also technically I have myself access to completions from OpenAI vendor and responses. But there is ollama, azure , some not known to me "Groq" etc, which I am technically unable to test if it would work at all.

@carlrobertoh carlrobertoh merged commit 0d83e32 into carlrobertoh:master Mar 17, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants