Skip to content

AI Integration

Carolina Cloud containers ship with Claude Code pre-installed, and notebook flavors include additional in-app AI surfaces (Marimo’s AI panels, RStudio’s gander). To activate them, pass an Anthropic API key when you create the instance. The key flows into the container as an environment variable, the AI tools auto-configure on first start, and the key is never stored by Carolina Cloud — you provide it again for each new instance.

When creating an instance, pass an anthropic_api_key. If provided, it is used to:

  • Pre-authenticate the Claude Code CLI (claude command) for the ccloud user
  • Configure Marimo’s AI autocomplete, edit, and chat panels (Marimo flavors)
  • Wire up gander, ellmer, and shinychat for in-IDE AI (RStudio flavors)

Supported flavors: base, genomics, datascience, marimo, datasciencemarimo, rstudioserver, rgeospatial

Via the API:

Terminal window
curl -X POST https://console.carolinacloud.io/api/instance/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"resource_type": "container",
"flavor": "marimo",
"n_vcpus": 4,
"mem_gib": 16,
"disk_size_gib": 100,
"anthropic_api_key": "sk-ant-..."
}'

Via the dashboard:

In the creation modal, paste your key into the Anthropic API Key field. The field is shown for every AI-wired flavor and is always optional — leave it blank to skip AI setup.

The integration depends on the flavor:

FlavorClaude Code CLINotebook AIIDE AI
base
genomics
datascience
marimoMarimo autocomplete / edit / chat
datasciencemarimoMarimo autocomplete / edit / chat
rstudioservergander, ellmer, shinychat
rgeospatialgander, ellmer, shinychat

Every AI surface we configure is pinned to Claude Sonnet 4.6 (claude-sonnet-4-6):

  • Marimo flavors: ~/.marimo.toml sets autocomplete_model, edit_model, and chat_model all to anthropic/claude-sonnet-4-6.
  • RStudio flavors: ~/.Rprofile sets options(gander.chat = ellmer::chat_claude(model = "claude-sonnet-4-6")).
  • Claude Code CLI: the claude binary uses Claude Code’s own default model (currently Sonnet 4.6 as well). We do not pin it — you can switch at any time with the in-app model selector.

You can swap to a different Claude model from inside the container.

Claude Code (any flavor): run claude and use the in-app model selector, or pass the model as a flag:

Terminal window
claude --model claude-opus-4-7

Marimo flavors (marimo, datasciencemarimo): edit ~/.marimo.toml and change the [ai.models] block:

[ai.models]
autocomplete_model = "anthropic/claude-opus-4-7"
edit_model = "anthropic/claude-opus-4-7"
chat_model = "anthropic/claude-opus-4-7"

Save the file and restart the Marimo server (the auto-restart loop picks up the new config within a few seconds, or restart the container to force it immediately).

RStudio flavors (rstudioserver, rgeospatial): the gander addin’s default model lives in ~/.Rprofile:

options(gander.chat = ellmer::chat_claude(model = "claude-sonnet-4-6"))

Edit that line to use the model you want, then restart the R session (Session → Restart R, or Ctrl+Shift+F10) so the new option takes effect. For ellmer in your own R code, pass the model directly:

chat <- ellmer::chat_claude(model = "claude-opus-4-7")
chat$chat("Summarize this dataset")

Skipping the field is fully supported. The Claude Code CLI is still installed on every AI-wired flavor — it’s baked in at build time, not at startup — so the claude command is on PATH and ready to run. The only difference is that no AI configuration is pre-applied, so:

  • Claude Code: the first run of claude will prompt you to authenticate.
  • Marimo flavors: the AI panels stay disabled. To enable them later, set ANTHROPIC_API_KEY in your shell and write a ~/.marimo.toml (see the format above), then restart the Marimo server.
  • RStudio flavors: the ellmer, gander, and shinychat packages are installed but the gander addin is not wired to a default chat. Set ANTHROPIC_API_KEY in ~/.Renviron, then add the options(gander.chat = ...) line to ~/.Rprofile to activate gander’s Ctrl+Shift+I addin.
  • The key is never stored on Carolina Cloud servers. It is forwarded once to the host running your container, written into that container’s environment, and not retained anywhere else.
  • Inside the container, the key lives in ~/.bashrc (as ANTHROPIC_API_KEY), in ~/.claude.json (Claude Code’s auth file — only the last 20 characters), in ~/.Renviron on RStudio flavors, and in ~/.marimo.toml on Marimo flavors.
  • Stopping and restarting a container preserves the key (the writable layer survives). Recreating the container wipes it, and you’ll need to provide it again at creation time.
  • To rotate keys without recreating, edit ~/.bashrc and the relevant config files inside the container.