[GH-ISSUE #3046] [BUG]: Can't change the output token limit with novita ai #1949

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

Originally created by @nidupb on GitHub (Jan 28, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3046

Originally assigned to: @shatfield4 on GitHub.

How are you running AnythingLLM?

Docker (local)

What happened?

When experimenting with deepseek, Novita seems to limit the token output to 2048 when it should go up to 8196.

Novita provide an example of API implementation with the base limit :

from openai import OpenAI
  
client = OpenAI(
    base_url="https://api.novita.ai/v3/openai",
    api_key="<YOUR Novita AI API Key>",
)

model = "deepseek/deepseek-r1"
stream = True # or False
max_tokens = 2048
system_content = """Be a helpful assistant"""
temperature = 1
top_p = 1
min_p = 0
top_k = 50
presence_penalty = 0
frequency_penalty = 0
repetition_penalty = 1
response_format = { "type": "text" }

chat_completion_res = client.chat.completions.create(
    model=model,
    messages=[
        {
            "role": "system",
            "content": system_content,
        },
        {
            "role": "user",
            "content": "Hi there!",
        }
    ],
    stream=stream,
    max_tokens=max_tokens,
    temperature=temperature,
    top_p=top_p,
    presence_penalty=presence_penalty,
    frequency_penalty=frequency_penalty,
    response_format=response_format,
    extra_body={
      "top_k": top_k,
      "repetition_penalty": repetition_penalty,
      "min_p": min_p
    }
  )

if stream:
    for chunk in chat_completion_res:
        print(chunk.choices[0].delta.content or "", end="")
else:
    print(chat_completion_res.choices[0].message.content)
  

Are there known steps to reproduce?

Ask any complex issue that'll likely prompt an output above 2048 tokens

Originally created by @nidupb on GitHub (Jan 28, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3046 Originally assigned to: @shatfield4 on GitHub. ### How are you running AnythingLLM? Docker (local) ### What happened? When experimenting with deepseek, Novita seems to limit the token output to 2048 when it should go up to 8196. Novita provide an example of API implementation with the base limit : ``` from openai import OpenAI client = OpenAI( base_url="https://api.novita.ai/v3/openai", api_key="<YOUR Novita AI API Key>", ) model = "deepseek/deepseek-r1" stream = True # or False max_tokens = 2048 system_content = """Be a helpful assistant""" temperature = 1 top_p = 1 min_p = 0 top_k = 50 presence_penalty = 0 frequency_penalty = 0 repetition_penalty = 1 response_format = { "type": "text" } chat_completion_res = client.chat.completions.create( model=model, messages=[ { "role": "system", "content": system_content, }, { "role": "user", "content": "Hi there!", } ], stream=stream, max_tokens=max_tokens, temperature=temperature, top_p=top_p, presence_penalty=presence_penalty, frequency_penalty=frequency_penalty, response_format=response_format, extra_body={ "top_k": top_k, "repetition_penalty": repetition_penalty, "min_p": min_p } ) if stream: for chunk in chat_completion_res: print(chunk.choices[0].delta.content or "", end="") else: print(chat_completion_res.choices[0].message.content) ``` ### Are there known steps to reproduce? Ask any complex issue that'll likely prompt an output above 2048 tokens
yindo added the possible buginvestigating labels 2026-02-22 18:27:23 -05:00
yindo closed this issue 2026-02-22 18:27:23 -05:00
Author
Owner

@Karasowl commented on GitHub (Feb 4, 2025):

I wanted to report that I reproduced the issue using the standard AnythingLLM setup (not running in Docker) with the deepseek model via Novita AI. The response is still truncated.

Image

@Karasowl commented on GitHub (Feb 4, 2025): I wanted to report that I reproduced the issue using the standard AnythingLLM setup (not running in Docker) with the deepseek model via Novita AI. **The response is still truncated**. ![Image](https://github.com/user-attachments/assets/4e1b2ba3-185c-4cb9-a3a2-5a8ba919dda3)
Author
Owner

@shatfield4 commented on GitHub (Feb 13, 2025):

This seems that it could have been an issue with their API but as of today, I have just tested this using Deepseek models from Novita and I am able to get a response of close to 8000 tokens without being truncated. If you can provide more steps on how to replicate this we would be happy to reopen and create a fix for it.

@shatfield4 commented on GitHub (Feb 13, 2025): This seems that it could have been an issue with their API but as of today, I have just tested this using Deepseek models from Novita and I am able to get a response of close to 8000 tokens without being truncated. If you can provide more steps on how to replicate this we would be happy to reopen and create a fix for it.
yindo changed title from [BUG]: Can't change the output token limit with novita ai to [GH-ISSUE #3046] [BUG]: Can't change the output token limit with novita ai 2026-06-05 14:43:38 -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#1949