The best way to control Claude Code, Codex and more from any computer or phone
| 1 | --- |
| 2 | title: Setup |
| 3 | description: Give Alchemy a Turso API token. |
| 4 | --- |
| 5 | |
| 6 | import PackageManagers from "../../../components/PackageManagers.astro"; |
| 7 | |
| 8 | Sign up at [turso.tech](https://turso.tech), then create an API token with the [Turso CLI](https://docs.turso.tech/cli/introduction): |
| 9 | |
| 10 | ```sh |
| 11 | turso auth api-tokens mint alchemy |
| 12 | ``` |
| 13 | |
| 14 | Turso only supports API tokens. There is no browser sign-in. |
| 15 | |
| 16 | ## Add the provider |
| 17 | |
| 18 | Install `@alchemy.run/turso`: |
| 19 | |
| 20 | <PackageManagers add="@alchemy.run/turso" /> |
| 21 | |
| 22 | Then add `Turso.providers()` next to your cloud's providers: |
| 23 | |
| 24 | ```typescript |
| 25 | // alchemy.run.ts |
| 26 | import * as Turso from "@alchemy.run/turso"; |
| 27 | |
| 28 | providers: Layer.mergeAll(Cloudflare.providers(), Turso.providers()), |
| 29 | ``` |
| 30 | |
| 31 | ## Store the token in a profile |
| 32 | |
| 33 | ```sh |
| 34 | alchemy profile edit --add Turso |
| 35 | ``` |
| 36 | |
| 37 | Paste the token when asked. You can leave the organization blank. |
| 38 | |
| 39 | If you belong to more than one organization, enter its name. `turso org list` shows them. |
| 40 | |
| 41 | See [Profiles](/environments/profiles) to learn how profiles work. |
| 42 | |
| 43 | ## Use environment variables in CI |
| 44 | |
| 45 | Set `TURSO_API_TOKEN` and Alchemy uses it instead of your profile: |
| 46 | |
| 47 | ```sh |
| 48 | TURSO_API_TOKEN=... alchemy deploy |
| 49 | ``` |
| 50 | |
| 51 | `TURSO_API_KEY` works too. Set `TURSO_ORGANIZATION` if you belong to more than one organization. |
| 52 | |
| 53 | ## Pass a token in code |
| 54 | |
| 55 | Use a token you already have, for example in tests: |
| 56 | |
| 57 | ```typescript |
| 58 | Effect.provide( |
| 59 | Turso.fromToken({ |
| 60 | apiToken: "...", |
| 61 | organization: "my-org", |
| 62 | }), |
| 63 | ) |
| 64 | ``` |
| 65 | |
| 66 | `apiToken` can be a string or a `Redacted` value. |
| 67 | |
| 68 | ## Next steps |
| 69 | |
| 70 | - [Build the tutorial](/turso/tutorial/part-1) |
| 71 | - [Turso overview](/turso) |