Configuration
Environment Variables
Configure Karpa and your AI provider via environment variables.
Create a .env.local file in the project root to override the defaults. All
variables are optional — you can configure everything from the in-app
Settings.
Legacy Variables (LM Studio)
These are the original variables. They still work but are superseded by the general provider variables below.
| Variable | Default | Description |
|---|---|---|
LM_STUDIO_URL | http://localhost:1234/v1/chat/completions | LM Studio chat completions endpoint. |
LM_STUDIO_MODEL | hy-mt1.5-7b/HY-MT1.5-7B-Q4_K_M.gguf | Model identifier loaded in LM Studio. |
LM_STUDIO_TEMPERATURE | 0.2 | Sampling temperature. |
General Provider Variables
Server-side values used when the client doesn't provide per-request overrides.
| Variable | Default | Description |
|---|---|---|
LLM_PROVIDER | lmstudio | Provider to use: lmstudio, ollama, openai, anthropic, gemini, openrouter, custom. |
LLM_API_KEY | — | API key for cloud providers (OpenAI, Anthropic, Gemini, OpenRouter). |
LLM_MODEL | — | Model identifier (overrides per-provider default). |
LLM_TEMPERATURE | 0.2 | Sampling temperature. |
Provider-Specific URLs
| Variable | Default | Provider |
|---|---|---|
LM_STUDIO_API_URL | http://localhost:1234 | LM Studio |
OLLAMA_API_URL | http://localhost:11434 | Ollama |
CUSTOM_API_URL | — | Custom OpenAI-compatible |
Example
# Local with LM Studio
LLM_PROVIDER=lmstudio
# Or cloud with OpenAI
# LLM_PROVIDER=openai
# LLM_API_KEY=sk-...
# LLM_MODEL=gpt-4o-mini
# Shared settings
LLM_TEMPERATURE=0.2How environment variables work
The server-side API routes (/api/translate, /api/models, /api/test-connection)
read these env vars as defaults. When a user configures their provider through
the in-app Settings page, those values are stored in localStorage /
sessionStorage and sent as per-request overrides — taking precedence over
env vars.
Tips
- URLs for LM Studio and Ollama should point to the server root
(e.g.
http://localhost:1234— no/v1/...). The app builds the correct endpoint path automatically per provider. - Model must match the name shown in your provider exactly. Typos are the #1 cause of connection failures.
- Temperature:
0.2gives faithful translations. Bump it up for more creative outputs (at the cost of accuracy). - For runtime tweaks without file edits, use the in-app Settings.
