[GH-ISSUE #2956] [BUG]: "/api/v1/openai/chat/completion" is missing fields #1885

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

Originally created by @nesretep-anp1 on GitHub (Jan 9, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2956

How are you running AnythingLLM?

Docker (local)

What happened?

The results of the API endpoint "/api/v1/openai/chat/completion" do not contain the following fields:

.choices[i].index
.usage

This leads to some OpenAI API consumers having fail the evaluation of the responses.

Are there known steps to reproduce?

Simply use the mentioned endpoint with curl or something else.

Originally created by @nesretep-anp1 on GitHub (Jan 9, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2956 ### How are you running AnythingLLM? Docker (local) ### What happened? The results of the API endpoint "/api/v1/openai/chat/completion" do not contain the following fields: .choices[i].index .usage This leads to some OpenAI API consumers having fail the evaluation of the responses. ### Are there known steps to reproduce? Simply use the mentioned endpoint with curl or something else.
yindo added the possible bug label 2026-02-22 18:27:00 -05:00
yindo closed this issue 2026-02-22 18:27:00 -05:00
Author
Owner

@timothycarambat commented on GitHub (Jan 9, 2025):

This is the code that converts all openai compatible responses via the API into their proper format.
https://github.com/Mintplex-Labs/anything-llm/blob/be886f7d61296a30d5b8a095ca8329f58a0c5a0a/server/utils/chats/openaiCompatible.js#L473-L496

As you can see, all the fields are there so whatever you are getting you should post so that it can be reproduced under the same conditions. Closing until repro.

Please lmk the:

  • LLM Provider being used
  • image SHA for docker you are on
@timothycarambat commented on GitHub (Jan 9, 2025): This is the code that converts all openai compatible responses via the API into their proper format. https://github.com/Mintplex-Labs/anything-llm/blob/be886f7d61296a30d5b8a095ca8329f58a0c5a0a/server/utils/chats/openaiCompatible.js#L473-L496 As you can see, all the fields are there so whatever you are getting you should post so that it can be reproduced under the same conditions. Closing until repro. Please lmk the: - LLM Provider being used - image SHA for docker you are on
Author
Owner

@nesretep-anp1 commented on GitHub (Jan 14, 2025):

Oh, sorry; I did not want to bother you! 🤔

Beside that, ...

your code snippet would have been the answer already.

Like said, ...

.choices[i].index
.usage

... are missing. Today I found out, that usage is not missing always. But it would certainly explainable with your code snippet if usage is given but NULL.

choices[i].index is missing always - and like one could see, it is not given in your code snippet as well.

@nesretep-anp1 commented on GitHub (Jan 14, 2025): Oh, sorry; I did not want to bother you! :thinking: Beside that, ... your code snippet would have been the answer already. Like said, ... ``` .choices[i].index .usage ``` ... are missing. Today I found out, that `usage` is not missing always. But it would certainly explainable with your code snippet if `usage` is given but `NULL`. `choices[i].index` is missing always - and like one could see, it is not given in your code snippet as well.
Author
Owner

@timothycarambat commented on GitHub (Jan 14, 2025):

Just added it 👍

@timothycarambat commented on GitHub (Jan 14, 2025): Just added it 👍
yindo changed title from [BUG]: "/api/v1/openai/chat/completion" is missing fields to [GH-ISSUE #2956] [BUG]: "/api/v1/openai/chat/completion" is missing fields 2026-06-05 14:43:15 -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#1885