Providers Guide

April 21, 2026 ยท View on GitHub

Providers define where credentials come from for each API service. They map provider names (like anthropic) to credential sources (like ANTHROPIC_API_KEY).

Provider Reference

Environment Variable Providers

ProviderEnvironment VariableDescription
anthropicANTHROPIC_API_KEYAnthropic API key for Claude models
openaiOPENAI_API_KEYOpenAI API key
openrouterOPENROUTER_API_KEYOpenRouter API key for multi-provider access
googleGEMINI_API_KEYGoogle API key for Gemini models
zhipuZHIPU_API_KEYZhipu AI API key for GLM models
mistralMISTRAL_API_KEYMistral AI API key
deepseekDEEPSEEK_API_KEYDeepSeek API key
togetherTOGETHER_API_KEYTogether AI API key
groqGROQ_API_KEYGroq API key
cohereCOHERE_API_KEYCohere API key
xaiXAI_API_KEYxAI API key for Grok models
cerebrasCEREBRAS_API_KEYCerebras API key
zaiZAI_API_KEYZAI API key
ai_gatewayAI_GATEWAY_API_KEYVercel AI Gateway API key
vercel-ai-gatewayAI_GATEWAY_API_KEYVercel AI Gateway API key
minimaxMINIMAX_API_KEYMiniMax API key
moonshotMOONSHOT_API_KEYMoonshot AI API key for Kimi models
claude_code_oauthCLAUDE_CODE_OAUTH_TOKENClaude Code OAuth token

File-based Providers

ProviderFile PathDescription
codex_auth~/.codex/auth.jsonOpenAI Codex CLI authentication file
opencode_auth~/.local/share/opencode/auth.jsonOpenCode authentication file
gemini_auth~/.gemini/oauth_creds.jsonGemini CLI OAuth credentials file

Provider Types

Environment Variable Providers

Most providers use environment variables. To set up:

# Set the environment variable
export ANTHROPIC_API_KEY=sk-ant-...

# Run an agent
slop-code run --model anthropic/sonnet-4.5 --problem file_backup

You can also use a different environment variable name:

# Use a custom env var
export MY_CUSTOM_KEY=sk-ant-...
slop-code run --model anthropic/sonnet-4.5 \
  --provider-api-key-env MY_CUSTOM_KEY \
  --problem file_backup

File-based Providers

Some providers (like codex_auth) read credentials from files. The file path supports ~ expansion:

# Codex expects auth at ~/.codex/auth.json
# The file is typically created by the codex CLI:
codex auth login

File-based credentials are read once and cached.

PI Provider Notes

For pi agent runs, SCB provider names are mapped to PI provider names at agent construction time. Key mappings:

  • codex_auth -> openai-codex
  • bedrock -> amazon-bedrock
  • zhipu/zhipu-coding-plan/zai -> zai
  • ai_gateway/vercel-ai-gateway -> vercel-ai-gateway

If an SCB provider has no PI mapping, the run fails early with a setup error.

For codex_auth, SCB converts ~/.codex/auth.json into a temporary PI auth file (openai-codex) under a per-run temp directory and sets PI_CODING_AGENT_DIR to that temp path.

Configuration File

Providers are defined in configs/providers.yaml:

providers:
  # Environment variable provider
  anthropic:
    type: env_var
    env_var: ANTHROPIC_API_KEY
    description: Anthropic API key for Claude models

  # File-based provider
  codex_auth:
    type: file
    file_path: ~/.codex/auth.json
    description: OpenAI Codex CLI authentication file

Schema

FieldTypeRequiredDescription
typeenv_var | fileYesCredential source type
env_varstringFor env_var typeEnvironment variable name
file_pathstringFor file typePath to credential file (supports ~)
descriptionstringNoHuman-readable description

Adding a New Provider

Step 1: Add to providers.yaml

providers:
  # ... existing providers ...

  my_provider:
    type: env_var
    env_var: MY_PROVIDER_API_KEY
    description: My provider API key

Step 2: Set Up the Credential

export MY_PROVIDER_API_KEY=your-api-key

Step 3: Create a Model Config

Create a model file that references the provider:

# configs/models/my-model.yaml
internal_name: my-model-v1
provider: my_provider
pricing:
  input: 1.0
  output: 2.0

Step 4: Test

slop-code run --model my_provider/my-model --problem test_problem

API Reference

ProviderDefinition

class ProviderDefinition(BaseModel):
    name: str                    # Provider identifier
    credential_type: CredentialType  # ENV_VAR or FILE
    env_var: str | None          # Env var name (for env_var type)
    file_path: str | None        # File path (for file type)
    description: str             # Human-readable description

ProviderCatalog

class ProviderCatalog:
    @classmethod
    def get(cls, name: str) -> ProviderDefinition | None:
        """Get provider by name."""

    @classmethod
    def list_providers(cls) -> list[str]:
        """List all registered provider names."""

    @classmethod
    def ensure_loaded(cls) -> None:
        """Load providers from configs/providers.yaml (idempotent)."""

Troubleshooting

Unknown Provider Error

ValueError: Unknown provider 'custom'. Supported providers: anthropic, openai, ...

Solution: Add the provider to configs/providers.yaml.

Provider Type Mismatch

ValueError: Provider 'anthropic' does not use file credentials.

Solution: Check that you're using the correct provider type. Use APIKeyStore.get_credential_type(provider) to verify.

See Also