Describe the bug
When defining a custom provider in providers.json with an env_var for the API key, vix fails to resolve the key from that environment variable unless the keyring value is set (with with random stuff).
To reproduce
- Create a
~/.vix/providers.json (or ./.vix/providers.json) registering a custom provider with an env_var:
{
"credential_methods": [
{
"env_var": "GEMINI___API_KEY",
"keyring": "opencode-api-key", # fails without it but get info from env_var
"kind": "api_key"
}
],
"display_name": "Google",
"id": "google",
"inference": {
"auth_header": "x-goog-api-key",
"auth_scheme": "x-api-key",
"base_url": "https://generativelanguage.googleapis.com/v1beta/interactions"
},
"model_prefix": "google",
"models": [
{
"context_window": 200000,
"display_name": "Gemini3",
"spec": "google/gemini-3.5-flash"
}
],
"wire_format": "chat_completions"
},
- Set
export MY_CUSTOM_API_KEY=sk-... in your shell — no .env, no keychain entry.
- Run vix, select the model
myprovider/my-model.
- Observe that vix reports
no credential for myprovider or fails at request time with an auth error.
Expected behavior
Per the credential resolution order, environment variables should take highest priority and be resolved regardless of whether the OS keychain is available or configured. A custom provider's env_var should work identically to the built-in providers' env vars (e.g. ANTHROPIC_API_KEY, OPENAI_API_KEY).
Actual behavior
The env var is only consulted when the keychain is reachable and/or contains at least one entry for that provider. On systems without a usable keychain (e.g. headless servers, containers, WSL without gnome-keyring), the env var is silently ignored and the credential is reported as missing.
Environment
- OS: (any headless/container/WSL setup without a functioning keyring daemon)
- Vix version: (please fill in)
- Keychain availability: none / unreachable
Additional context
The built-in providers (Anthropic, OpenAI, etc.) resolve their env vars (ANTHROPIC_API_KEY, OPENAI_API_KEY) independently of the keychain, which works fine. The bug seems specific to custom providers defined via providers.json — the credential resolution logic for custom env_var fields may be gated on a prior keychain lookup.
Describe the bug
When defining a custom provider in
providers.jsonwith anenv_varfor the API key, vix fails to resolve the key from that environment variable unless the keyring value is set (with with random stuff).To reproduce
~/.vix/providers.json(or./.vix/providers.json) registering a custom provider with anenv_var:{ "credential_methods": [ { "env_var": "GEMINI___API_KEY", "keyring": "opencode-api-key", # fails without it but get info from env_var "kind": "api_key" } ], "display_name": "Google", "id": "google", "inference": { "auth_header": "x-goog-api-key", "auth_scheme": "x-api-key", "base_url": "https://generativelanguage.googleapis.com/v1beta/interactions" }, "model_prefix": "google", "models": [ { "context_window": 200000, "display_name": "Gemini3", "spec": "google/gemini-3.5-flash" } ], "wire_format": "chat_completions" },export MY_CUSTOM_API_KEY=sk-...in your shell — no.env, no keychain entry.myprovider/my-model.no credential for myprovideror fails at request time with an auth error.Expected behavior
Per the credential resolution order, environment variables should take highest priority and be resolved regardless of whether the OS keychain is available or configured. A custom provider's
env_varshould work identically to the built-in providers' env vars (e.g.ANTHROPIC_API_KEY,OPENAI_API_KEY).Actual behavior
The env var is only consulted when the keychain is reachable and/or contains at least one entry for that provider. On systems without a usable keychain (e.g. headless servers, containers, WSL without gnome-keyring), the env var is silently ignored and the credential is reported as missing.
Environment
Additional context
The built-in providers (Anthropic, OpenAI, etc.) resolve their env vars (
ANTHROPIC_API_KEY,OPENAI_API_KEY) independently of the keychain, which works fine. The bug seems specific to custom providers defined viaproviders.json— the credential resolution logic for customenv_varfields may be gated on a prior keychain lookup.