Skip to main content
Opsh works with five AI providers: OpenAI, Anthropic, Gemini, OpenRouter, and Ollama. All provider settings live in ~/.opsh/config.json under the provider key. Only the provider named in provider.selected is used at runtime — the others retain their settings so you can switch between them without re-entering credentials.

Setting your provider interactively

The easiest way to configure a provider is through the interactive editor:
  • Run opsh --init in your terminal to open the setup wizard.
  • Type !config inside the Opsh REPL, then choose Provider from the menu.
Both flows let you pick a provider, choose a model, and enter your API key. Your selections are saved to ~/.opsh/config.json immediately.

The provider.selected field

The provider.selected field controls which provider Opsh uses. Set it to one of:
ValueProvider
"openrouter"OpenRouter
"openai"OpenAI API
"anthropic"Anthropic API
"gemini"Gemini (Google AI API)
"ollama"Ollama (local)

Provider config snippets

Each provider has its own sub-object inside provider. The tabs below show the full structure and default values for each one.
config.json
{
  "provider": {
    "selected": "openrouter",
    "openrouter": {
      "model": "openrouter/auto",
      "baseUrl": "https://openrouter.ai/api/v1",
      "apiKey": "YOUR_OPENROUTER_KEY",
      "temperature": 0.1
    }
  }
}
FieldDescription
modelModel ID to use. Default: openrouter/auto.
baseUrlOpenRouter API endpoint. Default: https://openrouter.ai/api/v1.
apiKeyYour OpenRouter API key.
temperatureSampling temperature (0–1). Default: 0.1.

Default base URLs

ProviderDefault base URL
OpenRouterhttps://openrouter.ai/api/v1
OpenAIhttps://api.openai.com/v1
Anthropichttps://api.anthropic.com/v1
Geminihttps://generativelanguage.googleapis.com/v1beta
Ollamahttp://localhost:11434/api
You can change baseUrl to point to a compatible proxy or self-hosted endpoint.
API keys are stored as plain text in ~/.opsh/config.json. Restrict access to this file so other users on the system cannot read it:
chmod 600 ~/.opsh/config.json