Failed to load models | LocalAI | Nextcloud AIO v9.8.0

Hi! Hopefully somone could help me with the following issue:

  • Nextcloud Server version:
    • 30.0.2 AIO v9.8.0
  • Operating system and version:
    • Ubuntu 24.04
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • it never worked
  • Installation method
    • AIO
  • Are you using Cloudflare, mod_security, or similar?
    • No

Summary of the issue you are facing:

I always get a “Failed to load models” error in OpenAI and LocalAI integration when I enter the URL http://localhost:8081/v1 under “Artificial Intelligence” in the Admin Settings. On the Host System I can Curl the models List:

~ # curl http://localhost:8081/v1/models
{"object":"list","data":[{"id":"gpt-4","object":"model"},{"id":"text-embedding-ada-002","object":"model"},{"id":"whisper-1","object":"model"},{"id":"stablediffusion","object":"model"},{"id":"gpt-4o","object":"model"},{"id":"tts-1","object":"model"},{"id":"jina-reranker-v1-base-en","object":"model"},{"id":"bakllava-mmproj.gguf","object":"model"}]}

Steps to replicate it (hint: details matter!):

  1. run the localai/localai:latest-aio-cpu image with Port 8081:8080
  2. add the container to the nextcloud-aio network
  3. enter the URL http://localhost:8081/v1 in OpenAI and LocalAI integration under “Artificial Intelligence” in the Admin Settings

Log entries

Nextcloud

There is no Log entry for this error

Web Browser

q {message: 'Request failed with status code 400', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …}
code
: 
"ERR_BAD_REQUEST"
config
: 
{transitional: {…}, adapter: Array(3), transformRequest: Array(1), transformResponse: Array(1), timeout: 0, …}
message
: 
"Request failed with status code 400"
name
: 
"AxiosError"
request
: 
XMLHttpRequest {onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …}
response
: 
{data: {…}, status: 400, statusText: 'Bad Request', headers: je, config: {…}, …}
status
: 
400
stack
: 
"AxiosError: Request failed with status code 400\n    at Id (https://mydomain.de/custom_apps/integration_openai/js/index-5eSiAu3S.chunk.mjs:15:1031)\n    at XMLHttpRequest.S (https://mydomain.de/custom_apps/integration_openai/js/index-5eSiAu3S.chunk.mjs:15:6057)\n    at us.request (https://mydomain.de/custom_apps/integration_openai/js/index-5eSiAu3S.chunk.mjs:17:1956)"
[[Prototype]]
: 
Error

Web server / Reverse Proxy

No Error in Apache Log

Configuration

Nextcloud

<?php
$CONFIG = array (
  'one-click-instance' => true,
  'one-click-instance.user-limit' => 100,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'check_data_directory_permissions' => false,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'nextcloud-aio-redis',
    'password' => '',
    'port' => 6379,
  ),
  'overwritehost' => 'mydomain.de',
  'overwriteprotocol' => 'https',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'mydomain.de',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '30.0.2.2',
  'overwrite.cli.url' => 'https://mydomain.de/',
  'dbname' => 'nextcloud_database',
  'dbhost' => 'nextcloud-aio-database:5432',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_nextcloud',
  'dbpassword' => '',
  'installed' => true,
  'instanceid' => 'oc***REDACTED***',
  'maintenance' => false,
  'updatedirectory' => '/nc-updater',
  'loglevel' => 3,
  'app_install_overwrite' =>
  array (
    0 => 'nextcloud-aio',
  ),
  'log_type' => 'file',
  'logfile' => '/var/www/html/data/nextcloud.log',
  'log_rotate_size' => 10485760,
  'log.condition' =>
  array (
    'apps' =>
    array (
      0 => 'admin_audit',
    ),
  ),
  'preview_max_x' => 2048,
  'preview_max_y' => 2048,
  'jpeg_quality' => 60,
  'enabledPreviewProviders' =>
  array (
    1 => 'OC\\Preview\\Image',
    2 => 'OC\\Preview\\MarkDown',
    3 => 'OC\\Preview\\MP3',
    4 => 'OC\\Preview\\TXT',
    5 => 'OC\\Preview\\OpenDocument',
    6 => 'OC\\Preview\\Movie',
    7 => 'OC\\Preview\\Krita',
    0 => 'OC\\Preview\\Imaginary',
  ),
  'enable_previews' => true,
  'upgrade.disable-web' => true,
  'mail_smtpmode' => 'smtp',
  'trashbin_retention_obligation' => 'auto, 30',
  'versions_retention_obligation' => 'auto, 30',
  'activity_expire_days' => 30,
  'simpleSignUpLink.shown' => false,
  'share_folder' => '/Shared',
  'one-click-instance.link' => 'https://nextcloud.com/all-in-one/',
  'upgrade.cli-upgrade-link' => 'https://github.com/nextcloud/all-in-one/discussions/2726',
  'maintenance_window_start' => 100,
  'allow_local_remote_servers' => true,
  'davstorage.request_timeout' => 14400,
  'htaccess.RewriteBase' => '/',
  'dbpersistent' => false,
  'auth.bruteforce.protection.enabled' => true,
  'ratelimit.protection.enabled' => true,
  'files_external_allow_create_new_local' => false,
  'trusted_proxies' =>
  array (
    0 => '127.0.0.1',
    1 => '::1',
    10 => '172.18.0.0/16',
  ),
  'preview_imaginary_url' => 'http://nextcloud-aio-imaginary:9000',
  'preview_imaginary_key' => '***REDACTED***',
  'default_phone_region' => 'DE',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'nextcloud',