Authentication
Kward needs access to a model provider before it can answer prompts. The fastest path is:
kward login
Or inside interactive Kward:
/login
Use the provider you already have access to. You can change providers later.
Choose a provider
| Provider | Use it when... |
|---|---|
| OpenAI/ChatGPT | You want the default Codex backend with a ChatGPT account. |
| Anthropic | You have Claude Pro/Max and want to use Claude through Kward. |
| OpenRouter | You want to use an OpenRouter API key and choose from its model catalog. |
| Copilot | You want to try experimental Copilot provider support. |
If you are unsure, start with kward login and choose OpenAI.
Login commands
kward login # OpenAI/ChatGPT OAuth
kward login anthropic # Anthropic Claude Pro/Max OAuth
kward login openrouter # OpenRouter API key
kward login github # GitHub OAuth for experimental Copilot support
From source, replace kward with ruby lib/main.rb.
OpenAI / ChatGPT
kward login
This opens a browser login and saves credentials to:
~/.kward/auth.json
Kward uses the ChatGPT/Codex backend, not the OpenAI Platform API key flow.
If Kward asks for an OAuth client ID, add it to ~/.kward/config.json:
{
"openai_oauth_client_id": "your-client-id"
}
Anthropic Claude Pro/Max
kward login anthropic
This saves credentials to:
~/.kward/anthropic_auth.json
Use this when you want Kward to use your Claude Pro/Max subscription. Kward refreshes the access token when a refresh token is available.
OpenRouter
kward login openrouter
This stores your API key in ~/.kward/config.json.
For a single shell session, you can avoid saving the key:
OPENROUTER_API_KEY=sk-or-v1-... kward
Choose OpenRouter when you want access to its model catalog or want provider/model selection through an API key.
Experimental Copilot support
kward login github
This saves GitHub OAuth credentials to:
~/.kward/github_auth.json
You can also use a token for one run:
COPILOT_GITHUB_TOKEN=... kward
Copilot support is experimental and uses direct HTTPS calls to the Copilot proxy API. It does not use the official Copilot CLI or SDK runtime.
Which credential wins?
If multiple credentials are available, Kward uses the configured provider.
Set it in ~/.kward/config.json:
{
"provider": "anthropic"
}
Or for one command:
KWARD_PROVIDER=openrouter kward
Supported provider values:
codex
anthropic
openrouter
copilot
Without an explicit provider, OpenAI/ChatGPT credentials are preferred when present.
Security notes
- Auth files are written with file mode
0600when possible. - Do not commit
~/.kward/config.jsonor auth files. - Prefer environment variables for temporary credentials.
kward auth statusshows credential status without printing secrets.kward auth logoutremoves saved credentials.