Karpa Logo
Karpa
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.

VariableDefaultDescription
LM_STUDIO_URLhttp://localhost:1234/v1/chat/completionsLM Studio chat completions endpoint.
LM_STUDIO_MODELhy-mt1.5-7b/HY-MT1.5-7B-Q4_K_M.ggufModel identifier loaded in LM Studio.
LM_STUDIO_TEMPERATURE0.2Sampling temperature.

General Provider Variables

Server-side values used when the client doesn't provide per-request overrides.

VariableDefaultDescription
LLM_PROVIDERlmstudioProvider to use: lmstudio, ollama, openai, anthropic, gemini, openrouter, custom.
LLM_API_KEYAPI key for cloud providers (OpenAI, Anthropic, Gemini, OpenRouter).
LLM_MODELModel identifier (overrides per-provider default).
LLM_TEMPERATURE0.2Sampling temperature.

Provider-Specific URLs

VariableDefaultProvider
LM_STUDIO_API_URLhttp://localhost:1234LM Studio
OLLAMA_API_URLhttp://localhost:11434Ollama
CUSTOM_API_URLCustom 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.2

How 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.2 gives 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.

On this page