[GH-ISSUE #1471] [BUG]: 'max_tokens' is String in Generic OpenAI, but the api requires Integer. #941

Closed
opened 2026-02-22 18:22:19 -05:00 by yindo · 2 comments
Owner

Originally created by @buptsad on GitHub (May 21, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1471

How are you running AnythingLLM?

AnythingLLM desktop app

What happened?

I try to set the qwen-long model, which is the model in Issue #1308
However after setting up using Generic OpenAI setting max_tokens to 1024, it returns 400 'max_tokens' is must be Integer.

Are there known steps to reproduce?

No response

Originally created by @buptsad on GitHub (May 21, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1471 ### How are you running AnythingLLM? AnythingLLM desktop app ### What happened? I try to set the qwen-long model, which is the model in Issue #1308 However after setting up using Generic OpenAI setting max_tokens to 1024, it returns `400 'max_tokens' is must be Integer`. ### Are there known steps to reproduce? _No response_
yindo added the possible bug label 2026-02-22 18:22:19 -05:00
yindo closed this issue 2026-02-22 18:22:19 -05:00
Author
Owner

@timothycarambat commented on GitHub (May 21, 2024):

This has been fixed already but is not in the desktop app and will be in the next version. If you need this urgently edit the file in
/Users/<usr>/Library/Application Support/anythingllm-desktop/storage/.env on Mac
/Users/<usr>/AppData/Roaming/anythingllm-desktop/storage/.env on Windows

edit GENERIC_OPEN_AI_MAX_TOKENS to be a number - no quotations and save. Restart App.

@timothycarambat commented on GitHub (May 21, 2024): This has been fixed already but is not in the desktop app and will be in the next version. If you need this urgently edit the file in `/Users/<usr>/Library/Application Support/anythingllm-desktop/storage/.env` on Mac `/Users/<usr>/AppData/Roaming/anythingllm-desktop/storage/.env` on Windows edit `GENERIC_OPEN_AI_MAX_TOKENS` to be a number - no quotations and save. Restart App.
Author
Owner

@lchyn commented on GitHub (Jun 10, 2024):

change /Users//AppData/Roaming/anythingllm-desktop/storage/.env, it doesn't work. (version 1.5.5 ,WIN 11)

Found a temporary solution that worked:
\Users***\AppData\Local\Programs\anythingllm-desktop\resources\backend\server.js
at line 9060: this.maxTokens = process.env.GENERIC_OPEN_AI_MAX_TOKENS ?? 1024;
change to : this.maxTokens = 1024;

restart application.

@lchyn commented on GitHub (Jun 10, 2024): change /Users/<usr>/AppData/Roaming/anythingllm-desktop/storage/.env, it doesn't work. (version 1.5.5 ,WIN 11) Found a temporary solution that worked: \Users\***\AppData\Local\Programs\anythingllm-desktop\resources\backend\server.js at line 9060: this.maxTokens = process.env.GENERIC_OPEN_AI_MAX_TOKENS ?? 1024; change to : this.maxTokens = 1024; restart application.
yindo changed title from [BUG]: 'max_tokens' is String in Generic OpenAI, but the api requires Integer. to [GH-ISSUE #1471] [BUG]: 'max_tokens' is String in Generic OpenAI, but the api requires Integer. 2026-06-05 14:38:04 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#941