Google Colab: using the VIDAI Control Plane as the backend¶
Colab notebooks run standard Python. Install the OpenAI SDK, read the control plane's API key from Colab Secrets, and every notebook cell that calls the SDK routes through us.
TL;DR¶
Add a Colab secret named VIDAI_API_KEY (🔑 sidebar → Add
new secret). Then in a notebook cell:
!pip install -q openai
from google.colab import userdata
from openai import OpenAI
client = OpenAI(
base_url="https://your-vidai-server.example.com/v1",
api_key=userdata.get("VIDAI_API_KEY"),
)
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "reply with: ok"}],
)
print(resp.choices[0].message.content)
Prerequisites¶
- A Google account with Colab access.
- Control plane base URL and an API key from API Keys.
- A model registered on the Models page.
Attribution¶
Colab secrets are per-user. Mint one VIDAI API key per Colab user (or share a key inside a team). Each key becomes a row on Chargeback.
Framework notebooks¶
The same key + base URL works for any framework you'd use in a Colab notebook — LangChain, LlamaIndex, DSPy, Instructor, CrewAI. Point them at the control plane the same way you would locally; each has its own page in this section.
Verify it works¶
Run the TL;DR cell. Expect ok. A row appears on
Request Logs.
If something's off¶
Raise an issue at github.com/vidaiUK/vidai-quickstart/issues with the notebook cell (masking the key) and the traceback if any. We'll get it sorted.