| 1 | import type { DocsAuthDict } from "../types"; |
| 2 | |
| 3 | /** |
| 4 | * English reference dictionary for `app/[locale]/docs/auth/page.tsx` |
| 5 | * ("Connect a provider"). Every command and lookup order is checked against |
| 6 | * docs/INSTALL.md §8, docs/PROVIDERS.md (local models), and the CLI |
| 7 | * definitions in crates/cli/src/lib.rs (`auth`, `login`) and |
| 8 | * crates/cli/src/cloud.rs (`account`). |
| 9 | */ |
| 10 | export const docsAuth: DocsAuthDict = { |
| 11 | metaTitle: "Connect a provider · Codewhale Docs", |
| 12 | metaDescription: |
| 13 | "Give Codewhale a model: save a provider key, check which key is in use, or run a local model with no key. A Codewhale account is optional.", |
| 14 | bodyClassName: "text-ink-soft leading-relaxed", |
| 15 | title: "Connect a provider", |
| 16 | lede: |
| 17 | "Codewhale needs a model to answer. Save a key for a hosted provider, or point Codewhale at a model running on your own machine. You pay the provider directly; no Codewhale account is involved.", |
| 18 | sections: [ |
| 19 | { |
| 20 | id: "save-key", |
| 21 | title: "Save a provider key", |
| 22 | blocks: [ |
| 23 | { |
| 24 | p: "Get an API key from your provider, then save it. Codewhale asks for the key and does not echo it. DeepSeek is the default provider, so it is the example here.", |
| 25 | }, |
| 26 | { |
| 27 | code: `codewhale auth set --provider deepseek |
| 28 | codewhale auth status --provider deepseek`, |
| 29 | lang: "Terminal", |
| 30 | }, |
| 31 | { |
| 32 | p: "`auth status` names the source in use — config file, secret store, or environment variable — and shows only the last four characters. In a script, pipe the key in with `--api-key-stdin` instead of typing it.", |
| 33 | }, |
| 34 | { |
| 35 | p: "You can also connect from inside Codewhale: press F3 (or type `/provider`), choose a provider, paste the key, then pick a model.", |
| 36 | }, |
| 37 | { |
| 38 | note: "In v0.10.0, `auth set --provider deepseek` also switches your default model to DeepSeek Pro. Run `/model` if you want the faster, cheaper model back. Connecting through F3 keeps your current model.", |
| 39 | }, |
| 40 | ], |
| 41 | }, |
| 42 | { |
| 43 | id: "which-key", |
| 44 | title: "Know which key is used", |
| 45 | blocks: [ |
| 46 | { p: "When a key is set in more than one place, the first match in this order wins:" }, |
| 47 | { |
| 48 | steps: [ |
| 49 | "`--api-key` on the command line, for one run.", |
| 50 | "`api_key` in `~/.codewhale/config.toml`.", |
| 51 | "The secret store written by `codewhale auth set`.", |
| 52 | "The provider's environment variable, such as `DEEPSEEK_API_KEY`.", |
| 53 | ], |
| 54 | }, |
| 55 | { |
| 56 | p: "Exporting a new environment variable therefore does not replace a key you saved earlier. If a rotated key keeps failing, run `auth status` to see which source is active, then save the new key or clear the stored one:", |
| 57 | }, |
| 58 | { code: "codewhale auth clear --provider deepseek", lang: "Terminal" }, |
| 59 | { |
| 60 | p: "On Linux the secret store is a private file (mode 0600) under `~/.codewhale/secrets/`, not an OS keyring. `codewhale doctor --probe-api` makes one test call to confirm that the key and the network both work.", |
| 61 | }, |
| 62 | ], |
| 63 | }, |
| 64 | { |
| 65 | id: "other-providers", |
| 66 | title: "Use another provider or a local model", |
| 67 | blocks: [ |
| 68 | { |
| 69 | p: "`codewhale auth list` shows every provider Codewhale knows and whether each one has a key. The pattern is the same for all of them: `codewhale auth set --provider <name>`, or that provider's environment variable.", |
| 70 | }, |
| 71 | { |
| 72 | p: "Local runners — Ollama, vLLM, and SGLang — need no key by default, and your prompts stay on your machine. Start the runner, then choose it:", |
| 73 | }, |
| 74 | { |
| 75 | code: `codewhale auth list |
| 76 | codewhale --provider ollama --model <model-tag>`, |
| 77 | lang: "Terminal", |
| 78 | }, |
| 79 | { |
| 80 | p: "The [models page](/models) lists providers, local setups, and how to switch models mid-session.", |
| 81 | }, |
| 82 | ], |
| 83 | }, |
| 84 | { |
| 85 | id: "account", |
| 86 | title: "Sign in to a Codewhale account (optional)", |
| 87 | blocks: [ |
| 88 | { |
| 89 | p: "A provider key and a Codewhale account are different things. The account is for account features only, such as cloud agents and continuing a session from the web app. Installing Codewhale and working locally never need one.", |
| 90 | }, |
| 91 | { |
| 92 | rows: [ |
| 93 | ["codewhale login", "Sign in through your browser with a one-time code."], |
| 94 | ["codewhale account status", "Show which account this profile is signed in to."], |
| 95 | ["codewhale account logout", "Remove this profile's session."], |
| 96 | ["codewhale account keys list", "List provider keys saved in your account. Values are never shown."], |
| 97 | ], |
| 98 | codeTerms: true, |
| 99 | }, |
| 100 | { |
| 101 | p: "`codewhale login` does not accept provider keys; those always go through `codewhale auth set`. The session is kept in your operating system's credential manager when one is available, and in the private Codewhale secrets file otherwise — for example over SSH or in a container.", |
| 102 | }, |
| 103 | ], |
| 104 | }, |
| 105 | ], |
| 106 | next: [ |
| 107 | { |
| 108 | href: "/docs/guide", |
| 109 | label: "Start your first task", |
| 110 | note: "Open Codewhale in a project and give it something concrete to do.", |
| 111 | }, |
| 112 | { |
| 113 | href: "/docs/modes", |
| 114 | label: "Set modes and approvals", |
| 115 | note: "Decide whether Codewhale asks before it runs commands.", |
| 116 | }, |
| 117 | { |
| 118 | href: "/docs/trust", |
| 119 | label: "See what leaves your machine", |
| 120 | note: "What the provider receives, what stays local, and how to turn usage counting off.", |
| 121 | }, |
| 122 | ], |
| 123 | sourceNote: |
| 124 | "Source documents: docs/INSTALL.md §8, docs/PROVIDERS.md, docs/CODEWHALE_AGENT.md · Update docs-map.ts when changing.", |
| 125 | }; |
| 126 |