Skip to main content

Make AI endpoint timeouts configurable via environment variables

When using a local Ollama model through an OpenAI-compatible endpoint, MoneyMatter periodically marks the AI connection as invalid with the following error:

Your custom AI endpoint did not respond. Check that the server is running and reachable, then reconnect it in AI Settings.

The endpoint is reachable, but local LLMs running on CPU can take several minutes to process requests.

Currently, the following timeouts are hardcoded:

  • CUSTOM_ENDPOINT_CALL_TIMEOUT_MS — 5 minutes (ai-call-guards.ts)

  • VALIDATION_TIMEOUT_MS — 15 seconds (connection-validation.ts)

  • MODEL_LIST_TIMEOUT_MS — 5 seconds (connection-validation.ts)

Requested changes:

Please make these timeouts configurable through environment variables, for example:

AI_CUSTOM_ENDPOINT_CALL_TIMEOUT_MS=1200000 AI_VALIDATION_TIMEOUT_MS=180000 AI_MODEL_LIST_TIMEOUT_MS=30000

The existing values should remain as defaults for backward compatibility.

Additionally, please consider preventing temporary timeouts or connection failures from permanently marking an AI model as invalid and requiring manual reconnection.

This would significantly improve compatibility with self-hosted LLMs, especially CPU-based Ollama deployments.

1 comment

Log in to comment and vote

Comments1

  • Vakhtang Gvenetadze

    •

    Oct 22

    Confirmed timeout issue during AI category mapping

    I reproduced the issue when calling POST /api/v1/import/ai-map-categories.

    The request runs for exactly 5 minutes and then fails with HTTP 422 and the message:

    Your custom AI endpoint did not respond.

    This matches the hardcoded CUSTOM_ENDPOINT_CALL_TIMEOUT_MS = 300000 in ai-call-guards.ts.

    Please make this timeout configurable via an environment variable and avoid permanently invalidating custom AI connections after a single request timeout.

    Local CPU-based LLMs may legitimately require more than 5 minutes to process large prompts.