Provider credentials
OpsCode authenticates with model providers, web search APIs, and tracing backends using credentials stored via the interactive /auth manager, opscode auth CLI commands, or standard environment variables.
Interactive setup with /auth
In an interactive session, run /auth to open the credential manager:
/auth
The modal lists all supported providers alongside their current credential status:
| Status label | Meaning |
|---|---|
[stored] | API key saved via /auth in ~/.opscode/.env |
[env: VARNAME] | API key resolved from an active shell environment variable |
[missing] | No credential configured—select the row to add an API key and optional base URL |
Manage credentials from the CLI
Use ops auth to inspect or update stored credentials directly from your terminal:
# List all configured providers and credential sources
ops auth list
# Store an API key for a provider interactively
ops auth set anthropic
# Remove a stored credential
ops auth remove anthropic
Key resolution precedence
When a credential is defined in multiple places, OpsCode uses the highest-priority source:
OPSCODE_<VARIABLE>environment variable (for example,OPSCODE_ANTHROPIC_API_KEY)- Standard provider environment variable (for example,
ANTHROPIC_API_KEY) - Global
~/.opscode/.envfile (managed by/authandops auth set) - Nearest project
.envfile
Using the OPSCODE_ prefix lets you give OpsCode a dedicated API key or billing quota without affecting other tools in your shell.
Provider environment variables
| Provider | API key variable | Custom base URL variable |
|---|---|---|
| Anthropic | ANTHROPIC_API_KEY | ANTHROPIC_BASE_URL |
| OpenAI | OPENAI_API_KEY | OPENAI_BASE_URL |
| Google GenAI | GOOGLE_API_KEY | GOOGLE_GEMINI_BASE_URL |
| Google Vertex AI | GOOGLE_CLOUD_PROJECT (uses ADC) | — |
| Azure OpenAI | AZURE_OPENAI_API_KEY | AZURE_OPENAI_ENDPOINT |
| Groq | GROQ_API_KEY | GROQ_BASE_URL |
| DeepSeek | DEEPSEEK_API_KEY | DEEPSEEK_API_BASE |
| Together AI | TOGETHER_API_KEY | TOGETHER_API_BASE |
| Fireworks AI | FIREWORKS_API_KEY | FIREWORKS_BASE_URL |
| OpenRouter | OPENROUTER_API_KEY | OPENROUTER_API_BASE |
| Mistral AI | MISTRAL_API_KEY | MISTRAL_BASE_URL |
| NVIDIA NIM | NVIDIA_API_KEY | NVIDIA_BASE_URL |
| Perplexity | PPLX_API_KEY | PERPLEXITY_BASE_URL |
| Cohere | COHERE_API_KEY | CO_API_URL |
| IBM watsonx | WATSONX_APIKEY | WATSONX_URL |
| HuggingFace | HUGGINGFACEHUB_API_TOKEN | HF_INFERENCE_ENDPOINT |
| LiteLLM | LITELLM_API_KEY | — |
| xAI | XAI_API_KEY | XAI_API_BASE |
| Baseten | BASETEN_API_KEY | BASETEN_BASE_URL |
| Ollama | OLLAMA_API_KEY (optional) | (configured in config.toml) |
Web search and LangSmith tracing
Configure optional keys for live documentation search (Tavily) and execution tracing (LangSmith):
export TAVILY_API_KEY="tvly-..."
export LANGSMITH_API_KEY="ls-..."
export LANGSMITH_PROJECT="opscode"
When LANGSMITH_API_KEY is present, OpsCode enables trace collection automatically. You can toggle tracing mid-session with /trace.