Skip to content
Crystal CodeDocs
ENEnglish

Your first session

This guide takes you from installation to a conversation in your browser. You will need a terminal, a project directory, and an account or API key for a model provider. Model providers may charge for usage.

Commands below use crystal on macOS and Linux. On Windows, use CrystalCode instead, including in the login and server commands.

On macOS or Linux:

Terminal window
curl --fail --location --show-error https://crystalcode.ink/scripts/install-extended.sh | sh

On Windows, open PowerShell:

Terminal window
Invoke-RestMethod -Uri https://crystalcode.ink/scripts/install-extended.ps1 | Invoke-Expression

Open a new terminal and run crystal --version (or CrystalCode --version on Windows). On Windows, also install Git for Windows; the agent uses its Bash shell. For platform requirements and installer details, see Install.

The extended installer seeds the starter provider files when ~/.crystal/providers/ is missing or empty. If your provider file is already present, continue to the sign-in step. Otherwise, download it as described below.

A provider connects Crystal Code to models. Browse the individual JSON files in CrystalCode.Defaults/providers and choose the service you use. Download its raw JSON file into ~/.crystal/providers/; create that directory if it does not exist. On Windows the default location is %USERPROFILE%\.crystal\providers\.

For example, to add ChatGPT on macOS or Linux:

Terminal window
mkdir -p ~/.crystal/providers
curl --fail --location --show-error \
https://raw.githubusercontent.com/YELANDAOKONG/CrystalCode.Defaults/master/providers/chatgpt.json \
--output ~/.crystal/providers/chatgpt.json

In PowerShell:

Terminal window
$providers = "$env:USERPROFILE\.crystal\providers"
New-Item -ItemType Directory -Force $providers | Out-Null
Invoke-WebRequest -Uri https://raw.githubusercontent.com/YELANDAOKONG/CrystalCode.Defaults/master/providers/chatgpt.json -OutFile "$providers\chatgpt.json"

These commands overwrite the destination file if it exists. Back up any customizations first. For another provider, download that provider’s file instead. Do not define the same provider in multiple files. If you use CRYSTAL_HOME or --home, use its providers directory instead. See Model catalog for the complete catalog and configuration details.

ChatGPT account: after adding chatgpt.json, run:

Terminal window
crystal login chatgpt

Follow the browser sign-in. If the browser does not open, use crystal login chatgpt --no-browser and open the printed link. Account sign-in and an OpenAI API key are different ways to connect; use the one supported by your chosen provider.

API key: obtain a key from your provider and create ~/.crystal/credentials.json (on Windows, %USERPROFILE%\.crystal\credentials.json). For example, a DeepSeek key belongs under deepseek:

{
"deepseek": { "apiKey": "" }
}

Replace the empty value with your key on your own machine. For another provider, use its exact name from the JSON file. The credential file is plain text: keep it private and never commit or share it. You can instead set a provider-specific environment variable; see Credentials.

The extended installer already installs the web search and page fetch plugin. It adds websearch and webfetch to the agent. If you used the standard installer, you can add the plugin later.

You can chat directly in the terminal or connect to a local server from your browser. Choose whichever you prefer; terminal use does not require a server.

Open a terminal, change into the project you want Crystal Code to work on, and run:

Terminal window
crystal

On Windows, run CrystalCode instead. The app uses your saved provider and model, or DeepSeek by default on a first run. If you set up a different provider, add --provider <name> --model <id> and replace the placeholders with the provider name and a model ID from its JSON file. Do not type the angle brackets.

Once the session opens, try typing “Explain what this project does without changing any files” and pressing Enter. Use /model to switch configured models and /help to see commands. Review permission requests before accepting them. If you installed the Web plugin, you can also ask it to search the web. See Interactive session for more controls.

In a terminal, change into the project you want Crystal Code to work on. Then start the local server:

Terminal window
crystal server --allow-origin https://web.crystalcode.ink

On Windows, replace crystal with CrystalCode. The command above uses your saved provider and model (DeepSeek by default). If you set up a different provider, add --provider <name> --model <id>, using a model ID from that provider’s JSON file. For example, after ChatGPT login, add --provider chatgpt --model <id>. Replace <id> with a listed model ID; do not type the angle brackets. The server checks credentials during startup, before you can switch models in the browser.

Leave the terminal open. The server prints a local URL such as http://127.0.0.1:52144 and a generated token. The port and token can change when the server restarts, so use the values from this launch. Keep the token private: anyone who has it can control the session.

Open web.crystalcode.ink, enter the local URL and token printed in your terminal, connect, and allow browser access to the local network if prompted. If asked to trust the project directory, do so only if you trust its contents.

Select the provider and a model from the installed catalog. Try asking: “Explain what this project does without changing any files.” Review any permission requests before accepting them. To test the Web plugin, ask it to search for a topic and summarize the results; network calls follow the host’s approval policy.

If you cannot connect, check that the server is still running, use the URL from its latest startup, and check the browser’s local-network permission. If a model is unavailable, check the provider file, credentials or login, and selected model. Provider files are loaded at startup, so restart the server after changing them.

Run crystal web --auth token from the project directory (on Windows, CrystalCode web --auth token). Open the local URL printed by the process and enter its token. The installer places the front end under Crystal Home so the page and API are served from the same origin. See Web mode.