Skip to content

Configuration

CaretForge uses a layered configuration system with clear precedence rules.

Precedence Order

CLI flags  >  Environment variables  >  Config file  >  Defaults

Higher-priority sources override lower ones. For example, --model gpt-4o on the command line overrides whatever is in your config file.

Config File Location

PlatformPath
macOS / Linux~/.config/caretforge/config.json
Windows%APPDATA%\caretforge\config.json

The XDG_CONFIG_HOME environment variable is respected on Linux/macOS.

Creating the Config File

bash
# Create with placeholder values (no secrets)
caretforge config init

# Create with API key placeholder included
caretforge config init --with-secrets

Config File Structure

json
{
  "defaultProvider": "azure-foundry",
  "providers": {
    "azureFoundry": {
      "endpoint": "https://YOUR-RESOURCE.services.ai.azure.com",
      "apiKey": "your-api-key",
      "authMode": "apiKey",
      "models": [{ "id": "gpt-4o", "description": "GPT-4o" }],
      "chatCompletionPath": "/chat/completions",
      "apiVersion": "2024-10-21"
    }
  },
  "telemetry": false
}

Fields

FieldTypeDefaultDescription
defaultProviderstring"azure-foundry"Which provider to use when --provider isn't specified
providersobject{}Provider-specific configuration (see below)
telemetrybooleanfalseTelemetry opt-in (not implemented; switch only)

Azure Foundry Provider Fields

FieldTypeDefaultDescription
endpointstringRequired. Your Azure resource URL
apiKeystringAPI key (omit if using Azure CLI auth)
authModestring"apiKey"Auth method: apiKey, azureCli, or managedIdentity
modelsarray[]List of { id, description? } objects
chatCompletionPathstring"/chat/completions"Path appended for chat completions
apiVersionstring"2024-08-01-preview"Azure API version query parameter

Azure Anthropic Provider Fields

For Anthropic models (Claude) deployed on Azure AI Foundry.

FieldTypeDefaultDescription
endpointstringRequired. https://RESOURCE.openai.azure.com/anthropic
apiKeystringRequired. Azure API key
apiVersionstring"2023-06-01"Anthropic API version header
modelsarray[]List of { id, description? } objects

Example:

json
{
  "defaultProvider": "azure-anthropic",
  "providers": {
    "azureAnthropic": {
      "endpoint": "https://YOUR-RESOURCE.openai.azure.com/anthropic",
      "apiKey": "your-key-here",
      "models": [{ "id": "claude-opus-4-6", "description": "Claude Opus 4-6" }]
    }
  }
}

Azure Responses Provider Fields

For models that use the OpenAI Responses API (e.g. gpt-5.2-codex, codex-mini) instead of Chat Completions.

FieldTypeDefaultDescription
endpointstringRequired. https://RESOURCE.openai.azure.com
apiKeystringRequired. Azure API key
modelsarray[]List of { id, description? } objects

Example:

json
{
  "defaultProvider": "azure-responses",
  "providers": {
    "azureResponses": {
      "endpoint": "https://YOUR-RESOURCE.openai.azure.com",
      "apiKey": "your-key-here",
      "models": [{ "id": "gpt-5.2-codex", "description": "GPT-5.2 Codex (Responses API)" }]
    }
  }
}

TIP

The same Azure API key works across Chat Completions, Anthropic, and Responses API endpoints on the same resource.

Environment Variables

Environment variables override config file values:

VariableMaps to
CARETFORGE_DEFAULT_PROVIDERdefaultProvider
CARETFORGE_AZURE_ENDPOINTproviders.azureFoundry.endpoint
CARETFORGE_AZURE_API_KEYproviders.azureFoundry.apiKey
CARETFORGE_AZURE_AUTH_MODEproviders.azureFoundry.authMode
CARETFORGE_AGENT_ENDPOINTproviders.azureAgents.endpoint
CARETFORGE_AGENT_IDproviders.azureAgents.agentId
CARETFORGE_AGENT_API_KEYproviders.azureAgents.apiKey

Viewing Your Config

bash
# Shows config with secrets redacted
caretforge config show

# JSON output for scripting
caretforge config show --json

Tips

  • Don't commit your config file if it contains API keys. Use environment variables for CI/CD.
  • Use caretforge config init (without --with-secrets) to create a safe template.
  • The config show command always redacts secrets, showing only the first 4 and last 2 characters.

Released under the MIT License.