Models & Credentials

Every harness needs a model to run and credentials to reach it. You declare the model in your agent YAML, and Goalrail manages the credentials that authenticate to each provider.

Choose a model

Declare the model in your agent YAML:

executor:
  harness: claude-sdk
  model: claude-sonnet-4-6

Override it at runtime without editing the file:

goalrail run agent.yaml --model claude-sonnet-4-6

Switch models mid-session

Use the /model command inside any running session to switch models on the fly. The agent keeps its conversation history and tool state – only the underlying model changes.

Credentials

Goalrail needs credentials to talk to a model provider.

goalrail setup

The setup wizard walks you through adding a credential, setting a default, or removing one. It also auto-detects credentials already on your machine (API keys in environment variables, logged-in CLIs, and local servers) so you can confirm them with one tap.

Credential types

TypeWhat it is
API keyA first-party provider key (Anthropic, OpenAI, OpenRouter, and more)
SubscriptionA Claude Pro/Max or ChatGPT Plus/Pro plan, via the official claude / codex CLIs
GatewayBring your own proxy or local model. Just paste a base URL and key.

API key

Get a key from your provider's dashboard and add it via goalrail setup. Supported providers:

ProviderKey source
Anthropicconsole.anthropic.com
OpenAIplatform.openai.com
OpenRouteropenrouter.ai
Groqconsole.groq.com
DeepSeekplatform.deepseek.com
xAIconsole.x.ai
Mistralconsole.mistral.ai
Together AIapi.together.xyz
Fireworks AIfireworks.ai

Subscription

If you have a Claude Pro/Max or ChatGPT Plus/Pro plan, Goalrail can use your existing CLI login. No API key needed. Just make sure you're logged in:

claude auth login    # for Claude Pro/Max
codex login          # for ChatGPT

goalrail setup auto-detects an active CLI login and offers it as a one-tap option.

Gateway

Goalrail works with any OpenAI-compatible or Anthropic-compatible gateway:

MLflow AI GatewayMLflow AI Gateway
OpenRouterOpenRouter
LiteLLMLiteLLM
PortkeyPortkey
HeliconeHelicone
Cloudflare AI GatewayCloudflare AI Gateway
Kong AI GatewayKong AI Gateway
Vercel AI GatewayVercel AI Gateway
Azure OpenAIAzure OpenAI
OllamaOllama
LM StudioLM Studio
vLLMvLLM
LocalAILocalAI
TGI (Hugging Face)TGI (Hugging Face)
GPT4AllGPT4All

goalrail setup asks for a base URL and a key. The base URL differs depending on the agent:

ProviderForBase URLKey
OpenRouterClaude Codehttps://openrouter.ai/apiyour OpenRouter key (sk-or-...)
OpenRouterCodex / OpenAI agentshttps://openrouter.ai/api/v1your OpenRouter key (sk-or-...)
Ollama (local)Codex / OpenAI agentshttp://localhost:11434/v1any value (Ollama ignores it)

Note: For Claude Code, point at OpenRouter's Anthropic-compatible endpoint (.../api, not .../api/v1); for Codex and the OpenAI-agents harness, use the OpenAI-compatible .../api/v1.