Skip to content

Provider Setup

ByteMind supports any model provider that exposes an OpenAI-compatible API, plus Anthropic and Gemini native APIs.

Multi-Provider Setup (Model Switching)

Configure multiple providers at once and switch between them at runtime with /model:

json
{
  "provider_runtime": {
    "current_provider": "deepseek",
    "default_provider": "deepseek",
    "default_model": "deepseek-v4-flash",
    "providers": {
      "deepseek": {
        "type": "openai-compatible",
        "base_url": "https://api.deepseek.com",
        "api_key_env": "DEEPSEEK_API_KEY",
        "model": "deepseek-v4-flash",
        "models": ["deepseek-v4-flash", "deepseek-v4-pro"]
      },
      "openai": {
        "type": "openai-compatible",
        "base_url": "https://api.openai.com/v1",
        "api_key_env": "OPENAI_API_KEY",
        "model": "gpt-5.4-mini",
        "models": ["gpt-5.4-mini", "gpt-5.4"]
      },
      "anthropic": {
        "type": "anthropic",
        "base_url": "https://api.anthropic.com",
        "api_key_env": "ANTHROPIC_API_KEY",
        "model": "claude-sonnet-4-20250514",
        "models": ["claude-sonnet-4-20250514", "claude-opus-4-20250514"]
      }
    }
  }
}

Switching models: enter /model to open an interactive picker listing all configured models across providers. Use ↑↓ to navigate and Enter to switch. The config file is updated automatically.

Quick jump

You can also jump directly with /model <provider>/<model>, e.g. /model openai/gpt-5.4.

See Config Reference for every field.

Single Provider Examples (Legacy)

json
{
  "provider": {
    "type": "openai-compatible",
    "base_url": "https://api.openai.com/v1",
    "model": "gpt-4o",
    "api_key_env": "OPENAI_API_KEY"
  }
}

Any OpenAI-compatible endpoint works

If a service accepts POST /v1/chat/completions with standard OpenAI request/response format, it works with ByteMind. This includes Azure OpenAI, Groq, Together AI, and most self-hosted inference servers.

Using Environment Variables for API Keys

Always prefer api_key_env over a literal api_key in config files. This keeps secrets out of your source tree:

json
{ "provider": { "api_key_env": "MY_API_KEY_VAR" } }

Set the variable before starting ByteMind:

powershell
# Temporary (current window only):
$env:MY_API_KEY_VAR = "sk-..."

# Permanent (survives reboots):
[Environment]::SetEnvironmentVariable("MY_API_KEY_VAR", "sk-...", "User")
# Restart terminal after this command.
bash
bytemind

api_key overrides api_key_env

If both api_key and api_key_env are set, api_key (plain text) takes priority. Remove api_key from your config to use the environment variable.

Custom Auth Headers

For providers that require non-standard authentication:

json
{
  "provider": {
    "type": "openai-compatible",
    "base_url": "https://my-internal-gateway/v1",
    "model": "gpt-4o",
    "auth_header": "X-API-Token",
    "auth_scheme": "",
    "api_key_env": "GATEWAY_TOKEN"
  }
}

Verifying the Setup

After creating your config, run:

bash
bytemind

Type a simple task like say hello and verify the model responds. If it fails, check:

  • base_url is reachable from your machine
  • api_key or the env var is set and valid
  • model ID matches what the provider offers

See Troubleshooting for common auth error solutions.

See Also

Released under the MIT License.