Skip to main content

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 labelMeaning
[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:

  1. OPSCODE_<VARIABLE> environment variable (for example, OPSCODE_ANTHROPIC_API_KEY)
  2. Standard provider environment variable (for example, ANTHROPIC_API_KEY)
  3. Global ~/.opscode/.env file (managed by /auth and ops auth set)
  4. Nearest project .env file

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​

ProviderAPI key variableCustom base URL variable
AnthropicANTHROPIC_API_KEYANTHROPIC_BASE_URL
OpenAIOPENAI_API_KEYOPENAI_BASE_URL
Google GenAIGOOGLE_API_KEYGOOGLE_GEMINI_BASE_URL
Google Vertex AIGOOGLE_CLOUD_PROJECT (uses ADC)—
Azure OpenAIAZURE_OPENAI_API_KEYAZURE_OPENAI_ENDPOINT
GroqGROQ_API_KEYGROQ_BASE_URL
DeepSeekDEEPSEEK_API_KEYDEEPSEEK_API_BASE
Together AITOGETHER_API_KEYTOGETHER_API_BASE
Fireworks AIFIREWORKS_API_KEYFIREWORKS_BASE_URL
OpenRouterOPENROUTER_API_KEYOPENROUTER_API_BASE
Mistral AIMISTRAL_API_KEYMISTRAL_BASE_URL
NVIDIA NIMNVIDIA_API_KEYNVIDIA_BASE_URL
PerplexityPPLX_API_KEYPERPLEXITY_BASE_URL
CohereCOHERE_API_KEYCO_API_URL
IBM watsonxWATSONX_APIKEYWATSONX_URL
HuggingFaceHUGGINGFACEHUB_API_TOKENHF_INFERENCE_ENDPOINT
LiteLLMLITELLM_API_KEY—
xAIXAI_API_KEYXAI_API_BASE
BasetenBASETEN_API_KEYBASETEN_BASE_URL
OllamaOLLAMA_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.