Skip to content

JupyterAI: using the VIDAI Control Plane as the backend

JupyterAI adds %%ai magic and a chat sidebar to JupyterLab. Its OpenAI provider accepts a custom base URL — set it once and every %%ai magic invocation and every chat message runs through the control plane.

TL;DR

Add to ~/.jupyter/jupyter_jupyter_ai_config.py:

c.AiExtension.default_language_model = "openai-chat:gpt-4o-mini"
c.AiExtension.model_parameters = {
    "openai-chat:gpt-4o-mini": {
        "openai_api_base": "https://your-vidai-server.example.com/v1",
        "openai_api_key":  "your-vidai-key",
    },
}

Restart JupyterLab. In a notebook:

%%ai openai-chat:gpt-4o-mini
Reply with exactly: ok

Prerequisites

  • JupyterLab + pip install jupyter-ai jupyter-ai-magics langchain-openai.
  • Control plane base URL and an API key from API Keys.
  • A model registered on the Models page.

Multiple models

Add more entries under model_parameters and reference them in the %%ai cell magic by their openai-chat:<name> id:

c.AiExtension.model_parameters = {
    "openai-chat:gpt-4o-mini":       {"openai_api_base": ..., "openai_api_key": ...},
    "openai-chat:claude-sonnet-4.5": {"openai_api_base": ..., "openai_api_key": ...},
}

Chat sidebar

The chat sidebar in JupyterLab uses default_language_model. Change it in Settings → Jupyter AI → Model to switch models without editing config.

Attribution

One VIDAI API key per JupyterHub user or per notebook server. On a multi-user JupyterHub, per-user keys are the clean pattern — each user's spend appears on their own row on Chargeback's API key section.

Verify it works

%%ai openai-chat:gpt-4o-mini
Reply with exactly: ok

A row appears on Request Logs.

If something's off

Raise an issue at github.com/vidaiUK/vidai-quickstart/issues with the JupyterAI config (masking the key) and the failing cell magic. We'll get it sorted.

Where to go next