LLM Setup
Connect an AI provider to enable template generation, people generation, and persona creation.
LLM Setup
HypLab uses large language models (LLMs) to generate templates, create synthetic people, and build personas. This page shows you how to connect an AI provider.
HypLab supports multiple providers through LiteLLM:
- Google Gemini -- recommended for getting started
- OpenAI (GPT-4, GPT-3.5, etc.)
- Ollama -- run models locally, no API key needed
- Any OpenAI-compatible service (OpenRouter, Anthropic via proxy, etc.)
Option 1: Google Gemini
- Get an API key from Google AI Studio
- Add it to
agents/.env:
LLM_PROVIDER=gemini
GEMINI_API_KEY=your-gemini-key-here
GEMINI_MODEL=gemini-1.5-pro- Restart the agents.
Option 2: OpenAI
- Get an API key from platform.openai.com
- Add it to
agents/.env:
LLM_PROVIDER=openai
LLM_API_KEY=sk-your-openai-key-here
LLM_MODEL=gpt-4- Restart the agents.
Option 3: Ollama (local, free)
Ollama lets you run models on your own machine. No API key or internet connection needed.
- Install Ollama from ollama.com
- Pull a model:
ollama pull llama2- Make sure Ollama is running:
ollama serve- Add to
agents/.env:
LLM_PROVIDER=openai
LLM_API_KEY=ollama
LLM_BASE_URL=http://localhost:11434/v1
LLM_MODEL=llama2- Restart the agents.
Option 4: Any OpenAI-compatible service
Any service that exposes an OpenAI-compatible API works. Set LLM_BASE_URL to point at it:
LLM_PROVIDER=openai
LLM_API_KEY=your-key
LLM_BASE_URL=https://your-provider.com/v1
LLM_MODEL=model-nameFull configuration reference
OpenAI-compatible providers
| Variable | Default | Description |
|---|---|---|
LLM_PROVIDER | -- | Set to openai |
LLM_API_KEY | -- | Your API key |
LLM_BASE_URL | https://api.openai.com/v1 | API endpoint |
LLM_MODEL | gpt-3.5-turbo | Model name |
LLM_TEMPERATURE | 0.7 | Creativity (0.0 = deterministic, 1.0 = creative) |
LLM_MAX_TOKENS | 8192 | Maximum response length |
LLM_TIMEOUT | 30 | Timeout in seconds |
Gemini
| Variable | Default | Description |
|---|---|---|
LLM_PROVIDER | -- | Set to gemini |
GEMINI_API_KEY | -- | Your Google API key |
GEMINI_MODEL | gemini-1.5-pro | Model name |
GEMINI_TEMPERATURE | 0.7 | Creativity |
GEMINI_MAX_TOKENS | 8192 | Maximum response length |
GEMINI_TIMEOUT | 30 | Timeout in seconds |
Config file alternative
Instead of environment variables, you can configure the LLM in agents/config.ini:
[LLM]
PROVIDER=openai
BASE_URL=https://api.openai.com/v1
MODEL=gpt-3.5-turbo
TEMPERATURE=0.7
MAX_TOKENS=8192
TIMEOUT=30
[Gemini]
MODEL=gemini-1.5-pro
TEMPERATURE=0.7
MAX_TOKENS=8192
TIMEOUT=30Environment variables take precedence over config.ini.
Security reminders
- Never commit API keys to version control.
- For production deployments, use a secrets manager (AWS Secrets Manager, GCP Secret Manager, Azure Key Vault). See the Deployment guides.
- Rotate API keys periodically.
What you should see
After configuring an LLM provider and restarting the agents, AI features should work. When you complete workspace onboarding, the system will generate templates using your configured provider instead of returning mock data.
If AI generation fails, check the agent logs and verify your API key is correct:
# Check agent logs (if running locally)
cd agents && make run-templates
# Look for connection errors or invalid key messagesNext: Core Concepts -- understand how HypLab is organized before you start using it.