AI prompts in JupyterLab notebooks
Manual · Next: Write and run AI questions
You need JupyterLab 4.2 or newer and Python 3.12 or newer. Use a ChatGPT subscription or an OpenAI or Anthropic API key.

For a project managed by uv, install and launch with:
uv add jupyterlab nbinlineai
uv run jupyter lab
Install the extension in the environment running JupyterLab. Installing it only in a different notebook kernel’s environment will not load its server component.
ChatGPT uses your account allowance, which has limits and may use additional credits. API requests are billed separately by their provider. The extension never switches from a selected ChatGPT connection to a paid API connection without your choice.
Sign in with ChatGPT opens the account sign-in page. If its browser callback cannot reach the Jupyter server, choose Use device code and follow the displayed link and code. The connection shows the account, runtime-supported models available to it and their reasoning efforts, and usage information when available. An unavailable usage display does not mean unlimited usage. No separate Codex app, command, Node installation, or API key is needed for this connection.
For device-code sign-in, leave Configure AI open, choose Use device code, then open Open device sign-in page in your usual browser profile and enter the code shown in the dialog. If an embedded or automated browser meets a sign-in challenge, you can copy that link into your normal browser, such as Safari; this does not require moving the notebook there. Finish the account sign-in, return to the notebook, and use Check connection if the status has not updated. Cancel sign-in stops a pending attempt. A completed sign-in only connects the account; choose a supported model and Use for this notebook to save the notebook default.
If device-code login is disabled, enable it in your personal ChatGPT security settings, or ask your workspace administrator to enable it in workspace permissions. See OpenAI’s authentication guide.
Signing in, checking status, and opening Configure AI do not change the notebook. Use for this notebook explicitly saves the ChatGPT connection, model, and effort as notebook defaults. Setting Default connection for new notebooks saves a user preference; it does not replace an existing notebook’s saved choice. A question with an explicit cell provider override keeps that choice until you select Notebook default in the cell’s Override controls or click Use notebook defaults. Each notebook has its own questions, context, declared tools, and Keep choices; your ChatGPT sign-in is shared. If sign-in expires, a model becomes unavailable, or usage is limited, your saved selection remains visible and requests pause until you reconnect or deliberately change it. Disconnect stops this Jupyter server’s connection without signing you out of other apps or projects.
The panel shows the notebook folder as location context and the JupyterLab project folder. ChatGPT file access currently reads Notebook tools only: built-in ChatGPT file, shell, and browser actions are disabled. Enabled notebook tools run separately in Python with the kernel user’s normal permissions, including its own working directory. The displayed folder does not confine Python or promise that the kernel has changed directory.