LLM Provider Configuration
SpecForge includes LLM-based features such as natural-language based spec generation and error explanation. To use these features, you need to configure an LLM provider.
Supported Providers
SpecForge currently supports the following LLM providers:
- OpenAI
- Get an API key from platform.openai.com/api-keys.
- Gemini
- Get an API key from ai.google.dev/gemini-api/docs/api-key.
- Anthropic
- Get an API key from platform.claude.com/docs/en/api/admin/api_keys/retrieve.
- Ollama
- Install and run Ollama from docs.ollama.com/quickstart.
Configuration Methods
Configuration via VS Code UI
- The LLM provider and the model can be configured in the VS Code settings through the
specforge.llmProviderandspecforge.llmModelsettings, respectively. - Ensure that the
specforge.apiKeySourcesetting is set tovscodein the VS Code extension settings. - Use the command palette to run the
SpecForge: Configure API Key for LLM Providercommand. This will prompt you to enter the API key for the chosen provider. The key will be securely stored in VS Code’s secret storage.
Configuration via Environment Variables (Windows, macOS, Linux)
SpecForge will read from the environment variables to configure the LLM provider.
- Make sure that the
specforge.apiKeySourcesetting is set toenvin the VS Code extension settings. - Set the following environment variables before starting the SpecForge server:
OpenAI
# Linux / macOS
export SPECFORGE_LLM_PROVIDER=openai
export SPECFORGE_LLM_MODEL=gpt-5-nano-2025-08-07
export OPENAI_API_KEY=your-api-key-here
# Windows PowerShell
$env:SPECFORGE_LLM_PROVIDER="openai"
$env:SPECFORGE_LLM_MODEL="gpt-5-nano-2025-08-07"
$env:OPENAI_API_KEY="your-api-key-here"
Get an API key from platform.openai.com/api-keys.
Gemini
# Linux / macOS
export SPECFORGE_LLM_PROVIDER=gemini
export SPECFORGE_LLM_MODEL=gemini-2.5-flash
export GEMINI_API_KEY=your-api-key-here
# Windows PowerShell
$env:SPECFORGE_LLM_PROVIDER="gemini"
$env:SPECFORGE_LLM_MODEL="gemini-2.5-flash"
$env:GEMINI_API_KEY="your-api-key-here"
Get an API key from ai.google.dev/gemini-api/docs/api-key.
Anthropic
# Linux / macOS
export SPECFORGE_LLM_PROVIDER=anthropic
export SPECFORGE_LLM_MODEL=claude-haiku-4-5
export ANTHROPIC_API_KEY=your-api-key-here
# Windows PowerShell
$env:SPECFORGE_LLM_PROVIDER="anthropic"
$env:SPECFORGE_LLM_MODEL="claude-haiku-4-5"
$env:ANTHROPIC_API_KEY="your-api-key-here"
Get an API key from platform.claude.com/docs/en/api/admin/api_keys/retrieve.
Ollama
First, install and run Ollama from docs.ollama.com/quickstart.
Then set the environment variables:
# Linux / macOS
export SPECFORGE_LLM_PROVIDER=ollama
export SPECFORGE_LLM_MODEL=your-model-name # e.g., llama3.2, mistral
export OLLAMA_API_BASE=http://127.0.0.1:11434
# Windows PowerShell
$env:SPECFORGE_LLM_PROVIDER="ollama"
$env:SPECFORGE_LLM_MODEL="your-model-name" # e.g., llama3.2, mistral
$env:OLLAMA_API_BASE="http://127.0.0.1:11434"
Change OLLAMA_API_BASE if your Ollama server is running on a different machine.
Default Models
If you don’t set the SPECFORGE_LLM_MODEL variable:
- OpenAI: Defaults to
gpt-5-nano-2025-08-07 - Gemini: Defaults to
gemini-2.5-flash - Anthropic: Defaults to
claude-haiku-4-5 - Ollama: You must specify a model (no default)
Without LLM Configuration
Without an appropriate LLM provider configuration, LLM-based SpecForge features will be unavailable. The rest of SpecForge will continue to work normally.