Skip to content

Mistral AI API key no longer works, resulted in a 401 Unauthorized response #332

@davodego

Description

@davodego

Which version of integration_openai are you using?

3.10.0

Which version of Nextcloud are you using?

32.0.5

Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.

FireDragon 12.7.0-1

Describe the Bug

I used the Mistral API and everything worked fine. But now, for some reason I don't know, I can no longer log in with the API key. I get an error message:
Models could not be loaded: Error in API request: Invalid API key/basic authentication:Client error: 'GET https://api.mistral.ai/v1/models' resulted in a '401 Unauthorized' response: {"detail":"Unauthorized"}

The same API key works very well with the SailCat app for the Mistral API and list models from curl path with api-key works too. I don't understand.
Here is the nextcloud.log:
{"reqId":"aXUiqers-DxLCxwfinFofQAABwY","level":2,"time":"2026-01-24T19:51:05+00:00","remoteAddr":"IP","user":"USER","app":"integration_openai","method":"GET","url":"/wolke/index.php/apps/integration_openai/models","scriptName":"/wolke/index.php","message":"API request error : Client error: GET https://api.mistral.ai/v1/models` resulted in a 401 Unauthorized response:\n{"detail":"Unauthorized"}\n","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:146.0) Gecko/20100101 Firefox/146.0","version":"32.0.5.0","exception":{"Exception":"GuzzleHttp\Exception\ClientException","Message":"Client error: GET https://api.mistral.ai/v1/models resulted in a 401 Unauthorized response:\n{"detail":"Unauthorized"}\n","Code":401,"Trace":[{"file":"/var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":72,"function":"create","class":"GuzzleHttp\Exception\RequestException","type":"::","args":["*** sensitive parameters replaced "]},{"file":"/var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php","line":209,"function":"GuzzleHttp\{closure}","class":"GuzzleHttp\Middleware","type":"::","args":[" sensitive parameters replaced "]},{"file":"/var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php","line":158,"function":"callHandler","class":"GuzzleHttp\Promise\Promise","type":"::"},{"file":"/var/www/nextcloud/3rdparty/guzzlehttp/promises/src/TaskQueue.php","line":52,"function":"GuzzleHttp\Promise\{closure}","class":"GuzzleHttp\Promise\Promise","type":"::","args":[" sensitive parameters replaced "]},{"file":"/var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php","line":251,"function":"run","class":"GuzzleHttp\Promise\TaskQueue","type":"->"},{"file":"/var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php","line":227,"function":"invokeWaitFn","class":"GuzzleHttp\Promise\Promise","type":"->"},{"file":"/var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php","line":272,"function":"waitIfPending","class":"GuzzleHttp\Promise\Promise","type":"->"},{"file":"/var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php","line":229,"function":"invokeWaitList","class":"GuzzleHttp\Promise\Promise","type":"->"},{"file":"/var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php","line":69,"function":"waitIfPending","class":"GuzzleHttp\Promise\Promise","type":"->"},{"file":"/var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php","line":189,"function":"wait","class":"GuzzleHttp\Promise\Promise","type":"->"},{"file":"/var/www/nextcloud/lib/private/Http/Client/Client.php","line":206,"function":"request","class":"GuzzleHttp\Client","type":"->"},{"file":"/var/www/nextcloud/apps/integration_openai/lib/Service/OpenAiAPIService.php","line":1042,"function":"get","class":"OC\Http\Client\Client","type":"->","args":[" sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/integration_openai/lib/Service/OpenAiAPIService.php","line":180,"function":"request","class":"OCA\OpenAi\Service\OpenAiAPIService","type":"->"},{"file":"/var/www/nextcloud/apps/integration_openai/lib/Controller/OpenAiAPIController.php","line":34,"function":"getModels","class":"OCA\OpenAi\Service\OpenAiAPIService","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":204,"function":"getModels","class":"OCA\OpenAi\Controller\OpenAiAPIController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":118,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":153,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1061,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":25,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Exception/RequestException.php","Line":111,"message":"API request error : Client error: GET https://api.mistral.ai/v1/models resulted in a 401 Unauthorized response:\n{"detail":"Unauthorized"}\n","response_body":{},"exception":{},"CustomMessage":"API request error : Client error: GET https://api.mistral.ai/v1/models resulted in a 401 Unauthorized response:\n{"detail":"Unauthorized"}\n"}}
{"reqId":"aXUiqers-DxLCxwfinFofQAABwY","level":2,"time":"2026-01-24T19:51:05+00:00","remoteAddr":"IP","user":"USER","app":"integration_openai","method":"GET","url":"/wolke/index.php/apps/integration_openai/models","scriptName":"/wolke/index.php","message":"Error retrieving models (exc): Fehler bei der API-Anfrage:Ung\u00fcltiger API-Schl\u00fcssel/Basisauthentifizierung:Client error: GET https://api.mistral.ai/v1/models resulted in a 401 Unauthorized response:\n{"detail":"Unauthorized"}\n","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:146.0) Gecko/20100101 Firefox/146.0","version":"32.0.5.0","data":{"app":"integration_openai"}}`

Expected Behavior

I can login to Mistral API with the created key.

To Reproduce

Set Mistral api: https://api.mistral.ai/v1
Set created mistral.ai api key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions