[GH-ISSUE #4269] [FET]: MistralAI Codestral support #2717

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

Originally created by @yoyomaster73 on GitHub (Aug 10, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4269

How are you running AnythingLLM?

Docker (local)

What happened?

Codestral is a specific model with API "Chat Endpoint" (https://codestral.mistral.ai/v1/chat/completions) and "Completion Endpoint" (https://codestral.mistral.ai/v1/fim/completions).

For a specific workspace in AnythingLLM then in "Chat Settings" I can select "Mistral" in "Workspace LLM Provider" : a window popup asks for the API Key, when we fill the field it the field "Chat Model Selection" changes from "-- waiting for AKI key" to "-- loading available models --" but nothing can be selected.
Logically it should indicate this: "codestral-latest".
The AnythingLLM UI does not allow to fill manually nor a specific model to use neither a specific URL to use to communicate with the API.

I think this is because, in the Mistral user console, this specific API key does not appear in "Workspace > Your API keys" section.
The API key appears in a specific section "Codestral > Codestral" section.

To check that I made the following cURL tests.

This query does not work:
curl -X POST https://api.mistral.ai/v1/chat/completions -H "Authorization: Bearer <my_codestral_api_key>" -H "Content-Type: application/json" -d '{ "model": "codestral-latest", "messages": [{"role": "user", "content": "Hello, just answer by OK or NOT OK"}] }'

This returns:
{"detail":"Unauthorized"}%

If I test this cURL command:
curl -X POST https://codestral.mistral.ai/v1/chat/completions -H "Authorization: Bearer <my_codestral_api_key>" -H "Content-Type: application/json" -d '{ "model": "codestral-latest", "messages": [{"role": "user", "content": "Hello, just answer by OK or NOT OK"}] }'

This returns a correct answer:
{"id":"f4381e6b87b0dfdfdffdffd8744","created":1754838091,"model":"codestral-latest","usage":{"prompt_tokens":12,"total_tokens":14,"completion_toke ns":2},"object":"chat.completion","choices":[{"index":0,"finish_reason":"stop","message":{"role":"assistant","tool_calls":null,"content":"OK"}}]}%

I tried to work around it by manually editing the SQLITE3:anythingllm.db file
sqlite> PRAGMA table_info(workspaces); 0|id|INTEGER|1||1 1|name|TEXT|1||0 2|slug|TEXT|1||0 3|vectorTag|TEXT|0||0 4|createdAt|DATETIME|1|CURRENT_TIMESTAMP|0 5|openAiTemp|REAL|0||0 6|openAiHistory|INTEGER|1|20|0 7|lastUpdatedAt|DATETIME|1|CURRENT_TIMESTAMP|0 8|openAiPrompt|TEXT|0||0 9|similarityThreshold|REAL|0|0.25|0 10|chatModel|TEXT|0||0 11|topN|INTEGER|0|4|0 12|chatMode|TEXT|0|'chat'|0 13|pfpFilename|TEXT|0||0 14|chatProvider|TEXT|0||0 15|agentModel|TEXT|0||0 16|agentProvider|TEXT|0||0 17|queryRefusalResponse|TEXT|0||0 18|vectorSearchMode|TEXT|0|'default'|0 sqlite> SELECT * FROM workspaces; 1|Codestral|codestral||1754837526229||20|1754837526229||0.25||4|chat||||||default sqlite> UPDATE workspaces SET chatProvider = 'mistral', chatModel = 'codestral-latest' WHERE name = 'Codestral'; sqlite> SELECT * FROM workspaces; 1|Codestral|codestral||1754837526229||20|1754837526229||0.25|codestral-latest|4|chat||mistral||||default sqlite> .quit
But when I start AnythingLLM, the field "Workspace Chat model" is still empty.

How can I use the specific "codestral" API with AnythingLLM?

Are there known steps to reproduce?

Image
Originally created by @yoyomaster73 on GitHub (Aug 10, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4269 ### How are you running AnythingLLM? Docker (local) ### What happened? Codestral is a specific model with API "Chat Endpoint" (https://codestral.mistral.ai/v1/chat/completions) and "Completion Endpoint" (https://codestral.mistral.ai/v1/fim/completions). For a specific workspace in AnythingLLM then in "Chat Settings" I can select "Mistral" in "Workspace LLM Provider" : a window popup asks for the API Key, when we fill the field it the field "Chat Model Selection" changes from "-- waiting for AKI key" to "-- loading available models --" but nothing can be selected. Logically it should indicate this: "codestral-latest". The AnythingLLM UI does not allow to fill manually nor a specific model to use neither a specific URL to use to communicate with the API. I think this is because, in the Mistral user console, this specific API key does not appear in "Workspace > Your API keys" section. The API key appears in a specific section "Codestral > Codestral" section. To check that I made the following cURL tests. This query does not work: ` curl -X POST https://api.mistral.ai/v1/chat/completions -H "Authorization: Bearer <my_codestral_api_key>" -H "Content-Type: application/json" -d '{ "model": "codestral-latest", "messages": [{"role": "user", "content": "Hello, just answer by OK or NOT OK"}] }' ` This returns: ` {"detail":"Unauthorized"}% ` If I test this cURL command: ` curl -X POST https://codestral.mistral.ai/v1/chat/completions -H "Authorization: Bearer <my_codestral_api_key>" -H "Content-Type: application/json" -d '{ "model": "codestral-latest", "messages": [{"role": "user", "content": "Hello, just answer by OK or NOT OK"}] }' ` This returns a correct answer: ` {"id":"f4381e6b87b0dfdfdffdffd8744","created":1754838091,"model":"codestral-latest","usage":{"prompt_tokens":12,"total_tokens":14,"completion_toke ns":2},"object":"chat.completion","choices":[{"index":0,"finish_reason":"stop","message":{"role":"assistant","tool_calls":null,"content":"OK"}}]}% ` I tried to work around it by manually editing the SQLITE3:anythingllm.db file ` sqlite> PRAGMA table_info(workspaces); 0|id|INTEGER|1||1 1|name|TEXT|1||0 2|slug|TEXT|1||0 3|vectorTag|TEXT|0||0 4|createdAt|DATETIME|1|CURRENT_TIMESTAMP|0 5|openAiTemp|REAL|0||0 6|openAiHistory|INTEGER|1|20|0 7|lastUpdatedAt|DATETIME|1|CURRENT_TIMESTAMP|0 8|openAiPrompt|TEXT|0||0 9|similarityThreshold|REAL|0|0.25|0 10|chatModel|TEXT|0||0 11|topN|INTEGER|0|4|0 12|chatMode|TEXT|0|'chat'|0 13|pfpFilename|TEXT|0||0 14|chatProvider|TEXT|0||0 15|agentModel|TEXT|0||0 16|agentProvider|TEXT|0||0 17|queryRefusalResponse|TEXT|0||0 18|vectorSearchMode|TEXT|0|'default'|0 sqlite> SELECT * FROM workspaces; 1|Codestral|codestral||1754837526229||20|1754837526229||0.25||4|chat||||||default sqlite> UPDATE workspaces SET chatProvider = 'mistral', chatModel = 'codestral-latest' WHERE name = 'Codestral'; sqlite> SELECT * FROM workspaces; 1|Codestral|codestral||1754837526229||20|1754837526229||0.25|codestral-latest|4|chat||mistral||||default sqlite> .quit ` But when I start AnythingLLM, the field "Workspace Chat model" is still empty. How can I use the specific "codestral" API with AnythingLLM? ### Are there known steps to reproduce? <img width="1413" height="757" alt="Image" src="https://github.com/user-attachments/assets/5312675b-8645-450d-bb5e-6078e69af331" />
yindo added the enhancementIntegration Requestfeature request labels 2026-02-22 18:30:56 -05:00
yindo closed this issue 2026-02-22 18:30:56 -05:00
Author
Owner

@timothycarambat commented on GitHub (Aug 11, 2025):

So Codestral is an entirely different product offering with it's own endpoint (not the normal mistral endpoint!) - this is a new integration then or a case to handle in Mistral, not a bug.

We just need to handle using this very specific part of Mistrals cloud offering then.

@timothycarambat commented on GitHub (Aug 11, 2025): So Codestral is an entirely different product offering with it's own endpoint (not the normal mistral endpoint!) - this is a new integration then or a case to handle in Mistral, not a bug. We just need to handle using this very specific part of Mistrals cloud offering then.
Author
Owner

@yoyomaster73 commented on GitHub (Aug 11, 2025):

Thank you for your answer.
I have just found a way to make it work with AnythingLLM.
I used "Generic OpenAI" as Workspace LLM Provider.
Then:
"https://codestral.mistral.ai/v1" as Base URL
"codestral-latest" as Chat Model Name.
I send a screenshot attached to my message.

Image
@yoyomaster73 commented on GitHub (Aug 11, 2025): Thank you for your answer. I have just found a way to make it work with AnythingLLM. I used "Generic OpenAI" as Workspace LLM Provider. Then: "https://codestral.mistral.ai/v1" as Base URL "codestral-latest" as Chat Model Name. I send a screenshot attached to my message. <img width="670" height="617" alt="Image" src="https://github.com/user-attachments/assets/3e807285-b3b5-4a86-82fa-d50e035fc1eb" />
yindo changed title from [FET]: MistralAI Codestral support to [GH-ISSUE #4269] [FET]: MistralAI Codestral support 2026-06-05 14:48:09 -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#2717