| 1 | # Sign in to a Codewhale account |
| 2 | |
| 3 | You do not need an account to use Codewhale. Local use with your own provider |
| 4 | key or a local model works signed out; see [Providers](PROVIDERS.md). An |
| 5 | account adds things that live outside one machine: cloud computers, account |
| 6 | conversations, named agents, saved provider keys and machine tokens for CI. |
| 7 | Which of these your account has depends on the account and the deployed |
| 8 | service. |
| 9 | |
| 10 | ## Sign in |
| 11 | |
| 12 | In Codewhale 0.10.5, starting a new sign-in from the terminal is closed until |
| 13 | accounts open: `codewhale login` and `/login` say that accounts are not open |
| 14 | yet and point you to `/provider`, and `/login` is not listed in the command |
| 15 | menu. A profile that is already signed in keeps working: `codewhale account |
| 16 | status`, the other `codewhale account` commands, `/connect account` and |
| 17 | `/logout` are unchanged, and so is a machine key in `CODEWHALE_API_KEY`. The |
| 18 | rest of this section describes sign-in as it works when accounts are open. |
| 19 | |
| 20 | In the terminal UI: |
| 21 | |
| 22 | ```text |
| 23 | /login |
| 24 | ``` |
| 25 | |
| 26 | From the shell: |
| 27 | |
| 28 | ```sh |
| 29 | codewhale login |
| 30 | ``` |
| 31 | |
| 32 | Both open a browser page where you approve the sign-in. `codewhale login |
| 33 | --no-open` prints the address instead of opening a browser, for a remote |
| 34 | shell. The command waits up to 10 minutes; change that with |
| 35 | `--timeout-seconds`. In the terminal UI you can cancel the wait. |
| 36 | |
| 37 | Signing in keeps your selected model and does not upload any key that is |
| 38 | already on this machine. Signing in alone does not give you model access: |
| 39 | connect a model with `/connect`, or keep using the one you have. |
| 40 | |
| 41 | Check who you are signed in as: |
| 42 | |
| 43 | ```sh |
| 44 | codewhale account status |
| 45 | ``` |
| 46 | |
| 47 | ## Sign out |
| 48 | |
| 49 | ```text |
| 50 | /logout |
| 51 | ``` |
| 52 | |
| 53 | ```sh |
| 54 | codewhale logout |
| 55 | ``` |
| 56 | |
| 57 | Sign-out removes the account session for the current `--profile` and revokes |
| 58 | it with the service when the service is reachable. Your local model |
| 59 | connections, settings and conversations stay. |
| 60 | |
| 61 | `codewhale logout --all` is different: it removes every saved provider key, |
| 62 | provider sign-in and account session on this machine. It asks first; `--yes` |
| 63 | skips the question and is required when the command is not run from a |
| 64 | terminal. |
| 65 | |
| 66 | ## What stays on this machine |
| 67 | |
| 68 | | Item | Where it is | |
| 69 | | --- | --- | |
| 70 | | Account session | The private Codewhale secrets file (mode `0600`), scoped to the profile and the account service address. It is not written to `config.toml` and does not use the operating-system keychain. | |
| 71 | | Provider keys you set locally | Your local configuration and secret store. Sign-in never uploads them. | |
| 72 | | Conversations, settings, memory | Local, unless you start a conversation on a cloud computer. | |
| 73 | |
| 74 | Nothing is copied to the account automatically. `codewhale account push` is |
| 75 | never automatic and currently requires `--dry-run`, which shows what would be |
| 76 | pushed without writing it. `codewhale account pull --dry-run` shows the |
| 77 | account's copy without writing local files; importing it into local settings |
| 78 | is not available yet. |
| 79 | |
| 80 | ## Provider keys saved in the account |
| 81 | |
| 82 | An account that supports saved provider keys can hold a key so that cloud |
| 83 | conversations can use it. These are keys Codewhale presents to a model |
| 84 | provider. |
| 85 | |
| 86 | ```sh |
| 87 | codewhale account keys list |
| 88 | codewhale account keys set deepseek --api-key-stdin |
| 89 | codewhale account keys set deepseek --from-local |
| 90 | codewhale account keys remove deepseek |
| 91 | ``` |
| 92 | |
| 93 | - `list` shows which providers are configured. It never prints a key. |
| 94 | - `set` saves a key. `--api-key-stdin` reads it from standard input, so it |
| 95 | does not appear in your shell history; `--from-local` uploads the key this |
| 96 | machine already resolves for that provider. This is the only way a local key |
| 97 | reaches the account. |
| 98 | - `remove` deletes the account's copy. It does not change the local copy or |
| 99 | revoke the key at the provider. |
| 100 | |
| 101 | ## Machine tokens for CI |
| 102 | |
| 103 | A machine token lets a script or CI job act as your account without a browser |
| 104 | sign-in. These are keys a caller presents to Codewhale. |
| 105 | |
| 106 | ```sh |
| 107 | codewhale account api-keys create --name "ci" |
| 108 | codewhale account api-keys list |
| 109 | codewhale account api-keys revoke TOKEN_ID |
| 110 | ``` |
| 111 | |
| 112 | `create` prints the secret once; store it in your CI secret manager. Limit it |
| 113 | with `--expires-in-days` and one or more `--scope` values (`account:read`, |
| 114 | `agent:run`, `models:infer`; all three when omitted). `list` shows names and |
| 115 | ids, never the secret. |
| 116 | |
| 117 | Set the token as `CODEWHALE_API_KEY` in the job. While it is set it is used |
| 118 | instead of the browser session, and `codewhale account whoami` reports the |
| 119 | account it authenticates as. Commands that manage computers, projects, GitHub |
| 120 | access and agents need an interactive sign-in and refuse a machine token. |
| 121 | |
| 122 | The GitHub review workflow uses a machine token; see |
| 123 | [GitHub review bot](GITHUB_ACTION.md). |
| 124 | |
| 125 | ## More account commands |
| 126 | |
| 127 | | Command | Use | |
| 128 | | --- | --- | |
| 129 | | `codewhale account computers` | List, create, pause and manage cloud computers. | |
| 130 | | `codewhale dispatch`, `codewhale account session` | Start or continue a conversation on a cloud computer. See [Cloud computer dispatch](CLOUD_DISPATCH.md). | |
| 131 | | `codewhale account agents` | Manage named agents and their saved model. | |
| 132 | | `codewhale account projects`, `codewhale account github` | List projects and the GitHub repositories the account may use. | |
| 133 | |
| 134 | `codewhale cloud ...` is an older spelling of `codewhale account ...` and |
| 135 | still works. Run any command with `--help` for its options. |
| 136 |