Configuring LLM Providers
Relevant source files
The following files were used as context for generating this wiki page:
The Resume Matcher application leverages Large Language Models (LLMs) for its core AI features, such as resume parsing, tailoring, and content generation. The system is designed with multi-provider support, allowing users to connect to various cloud-based LLM services or run models locally using Ollama. This flexibility is managed through a centralized configuration system accessible via both the user interface and environment variables.
Configuration is critical for all AI-powered workflows. The backend uses LiteLLM as a wrapper to provide a unified interface for different providers, ensuring that API keys are handled securely in asynchronous contexts by passing them directly to completion calls rather than using global environment variables.
Sources: AGENTS.md:LLM & AI Workflow Notes, SETUP.md:Configuring Your AI Provider
Supported LLM Providers
The application supports a range of popular LLM providers, giving users the choice between paid cloud services and free, local models.
| Provider | LLM_PROVIDER Value | Default Model | Requires API Key |
|---|---|---|---|
| OpenAI | openai | gpt-4o-mini | Yes |
| Anthropic | anthropic | claude-3-5-sonnet-20241022 | Yes |
| OpenRouter | openrouter | anthropic/claude-3.5-sonnet | Yes |
| Google Gemini | gemini | gemini-1.5-flash | Yes |
| DeepSeek | deepseek | deepseek-chat | Yes |
| Ollama | ollama | llama3.2 | No |
Sources: SETUP.md:Option A: Cloud Providers, INSTALL.md:Supported LLM Providers, apps/frontend/app/(default)/settings/page.tsx:41-48, 480-494
Configuration Methods
There are two primary methods for configuring the LLM provider: through the frontend settings page or by setting backend environment variables. The UI-based method is recommended for most users, especially when using Docker.
UI-Based Configuration (Settings Page)
The primary method for configuration is the /settings page in the frontend application. This interface allows users to select a provider, specify a model, and enter an API key and base URL (if applicable) without restarting the application.
Sources: apps/frontend/app/(default)/settings/page.tsx, SETUP.md:Accessing the Application
UI Components
The settings page is composed of several key interactive elements:
- Provider Selection: A grid of buttons allows the user to select from the list of supported providers.
- Model Input: A text field for specifying the exact model name (e.g.,
gpt-4o-mini). - API Key Input: A password field for securely entering the provider's API key. This field is disabled for providers like Ollama that do not require a key.
- Ollama Server URL: An input field that appears only when 'ollama' is selected, pre-filled with the default
http://localhost:11434. - Action Buttons: "Save" and "Test Connection" buttons to persist the configuration and verify connectivity.
This diagram shows the component structure of the LLM configuration section on the settings page.
Data Flow: Saving Configuration
When a user clicks "Save", the frontend initiates a sequence of events to update the backend configuration.
The sequence diagram below illustrates the process of saving the LLM configuration from the user interface.
Environment Variable Configuration
For local development or environments where UI-based configuration is not desired, the backend can be configured directly using a .env file located in apps/backend/.
The following variables are used:
| Variable | Description | Example |
|---|---|---|
LLM_PROVIDER | The name of the provider to use. | openai |
LLM_MODEL | The specific model name. | gpt-4o-mini |
LLM_API_KEY | The API key for the selected provider. | sk-your-api-key-here |
LLM_API_BASE | The base URL for the API endpoint. Primarily for Ollama or custom endpoints. | http://localhost:11434 |
Note: The .env file is loaded by pydantic-settings in the backend. This method is ideal for initial setup.
Sources: SETUP.md:Backend Setup, INSTALL.md:Backend Environment Variables
Backend API
The backend exposes several endpoints under /api/v1/config/ to manage LLM settings. These endpoints are consumed by the frontend settings page.
| Method | Endpoint | Description |
|---|---|---|
GET /api/v1/config/llm | Fetches the current LLM configuration. The API key is masked. | |
PUT /api/v1/config/llm | Updates the LLM configuration. | |
POST /api/v1/config/test-llm-connection | Performs a health check using the currently saved configuration to validate connectivity with the LLM provider. |
Sources: apps/frontend/app/(default)/settings/page.tsx:16-21, 100, 203, REPORT.md:Incorrect Docker Health Check Path
The "Test Connection" flow provides immediate feedback to the user about their configuration.
This sequence diagram shows the "Test Connection" flow.
Language Configuration
The settings page also manages language preferences, which directly impacts LLM-generated content.
- UI Language: Changes the language of the user interface (buttons, labels, etc.). This is a frontend-only setting stored in
localStorage. - Content Language: Determines the language for all AI-generated text, such as tailored resume descriptions and cover letters. This setting is passed to the backend and inserted into LLM prompts via an
{output_language}variable.
The supported languages for both UI and content are English, Spanish, Chinese, and Japanese.
This diagram illustrates how language settings are applied.