AI features in notebooks

marimo AI features in ozeye notebooks can call ozeye chat completions without exposing raw API keys to notebook Python code.

Set up

  1. Create an API key in Dashboard → API keys.
  2. Open Dashboard → Notebooks and select the key for notebook AI.
  3. When the notebook page loads, ozeye mints a short-lived notebook token that only works for notebook AI.

API configuration

To attach or change the AI key for a notebook file, call PUT /v1/notebooks/files/{id}/ai-connection:

{
  "api_key_id": "key_uuid_from_dashboard"
}

Security model

  • Raw API keys are not stored in browser localStorage.
  • Notebooks run on their own site, notebooks.ozeye.eu, which has no ozeye cookies and no account routes. Code in a notebook cannot reach your account, API keys or chats.
  • Notebook AI tokens use the oznb_* prefix, expire after 2 hours and work only for notebook AI on the notebook site, not on the public API. They end when you reload the notebook or disconnect AI.
  • Revoking the selected API key stops notebook AI.

Spending limits

Notebook AI spends from the key selected for the notebook and counts against that key’s spending limit. A capped key keeps working in a notebook until it reaches its cap, then notebook AI stops with a spending limit error.

An API key can only change the code of a notebook that same key created. Saving or syncing any other notebook returns 403, including notebooks made in the dashboard or before this rule. Reading still works, and the signed-in dashboard can change any of your notebooks.

A request made with an API key can only connect notebook AI to that same key, and cannot save into or start a notebook connected to a different key (403). Signed in on the dashboard, you can choose any of your keys.