diff --git a/apps/api/src/modules/nutriphi/routes.ts b/apps/api/src/modules/nutriphi/routes.ts index 8480d950b..ecfa155c7 100644 --- a/apps/api/src/modules/nutriphi/routes.ts +++ b/apps/api/src/modules/nutriphi/routes.ts @@ -32,11 +32,17 @@ import { import { logger, type AuthVariables } from '@mana/shared-hono'; const LLM_URL = process.env.MANA_LLM_URL || 'http://localhost:3025'; -const VISION_MODEL = process.env.VISION_MODEL || 'gemini-2.0-flash'; +// mana-llm parses model strings as `provider/model` (router.py:_parse_model). +// Without a prefix, it defaults to ollama/ which then falls back to Google +// only if auto_fallback_enabled + google_api_key are set. Be explicit. +const VISION_MODEL = process.env.VISION_MODEL || 'google/gemini-2.0-flash'; const llm = createOpenAICompatible({ name: 'mana-llm', - baseURL: `${LLM_URL}/api/v1`, + // mana-llm exposes /v1/chat/completions (see services/mana-llm/CLAUDE.md + + // src/main.py:125). The AI SDK's openai-compatible adapter appends + // /chat/completions to baseURL, so baseURL ends in /v1. + baseURL: `${LLM_URL}/v1`, }); const ANALYSIS_PROMPT = `Du bist ein Ernährungsexperte. Analysiere die Mahlzeit und gib strukturierte Nährwertdaten zurück. Schätze realistische Portionsgrößen und Kalorien. Antworte auf Deutsch.`; diff --git a/apps/api/src/modules/planta/routes.ts b/apps/api/src/modules/planta/routes.ts index 9b8de0f3d..1134ff463 100644 --- a/apps/api/src/modules/planta/routes.ts +++ b/apps/api/src/modules/planta/routes.ts @@ -21,11 +21,13 @@ import { import { logger, type AuthVariables } from '@mana/shared-hono'; const LLM_URL = process.env.MANA_LLM_URL || 'http://localhost:3025'; -const VISION_MODEL = process.env.VISION_MODEL || 'gemini-2.0-flash'; +// See nutriphi/routes.ts for the explanation of the model prefix and +// the /v1 suffix on the base URL. +const VISION_MODEL = process.env.VISION_MODEL || 'google/gemini-2.0-flash'; const llm = createOpenAICompatible({ name: 'mana-llm', - baseURL: `${LLM_URL}/api/v1`, + baseURL: `${LLM_URL}/v1`, }); const IDENTIFICATION_PROMPT = `Du bist ein Pflanzenexperte. Analysiere das Pflanzenfoto und liefere eine strukturierte Identifikation mit lateinischem Namen, deutschen Trivialnamen, Pflegehinweisen und einer Gesundheitseinschätzung. Antworte auf Deutsch.`;