DREAM Lab AI Gateway
This is an experimental service. Users may experience occasional interruptions, and we cannot guarantee its long-term availability.
DREAM Lab’s AI gateway service provides API access to Large Language Models (LLMs) hosted by campus cloud providers (currently, Google). It can be used in conjunction with a coding agent or to build custom AI workflows. It does not provide a “chat” interface. The service is primarily oriented toward DREAM Lab workshop attendees, researchers learning AI-assisted coding, and Library staff.
The OpenAI-compatible API endpoint for the gateway service is:
https://litellm.dreamlab.ucsb.edu/v1
The Gateway supports access to the following Google models:
gemini-4-argon: frontier model for complex reasoning and codinggemini-3.8-flash: best for agentic codinggemini-3.5-flash-lite: best for low-cost inference tasksgemini-embedding-2: multimodal embedding model
Creating an API Key
To use the AI gateway, you first need to generate a personal API Key. Anyone with a UCSB Net ID can create a key through the API key manager. Please note the following restrictions:
- You may only have one active key at a time.
- If you “regenerate” a new key, your previous key is automatically disabled.
- Keys expire automatically after three months.
- Your key has a set budget that resets weekly or monthly. Use the key manager to see your available budget.
- The “spend” associated with your API key reflects the real cost of your API requests. Requests to more expensive models will use more of your quota than requests to cheaper models.
Using the AI Gateway
The easiest way to use the AI gateway is by creating a DREAM Lab Coder Workspace. The workspace configuration page includes a form field for entering your AI gateway API key; when you start the workspace, the API key is available through the DREAMLAB_LLM_KEY environment variable. OpenCode is also pre-configured with DREAMLAB_LLM_KEY to connect to models using the “DREAM Lab AI Gateway” model provider.
Python Example
Because the gateway exposes an OpenAI-compatible API, you can query models using standard libraries such as openai.
Create a project directory, set up a virtual environment, and install openai using uv:
mkdir llm-example
cd llm-example
uv venv
source .venv/bin/activate
uv pip install openaiThen create a Python script (e.g., main.py) pointing to the gateway’s base_url:
import os
from openai import OpenAI
# In a Coder Workspace with a configured key, DREAMLAB_LLM_KEY is set automatically
api_key = os.environ.get("DREAMLAB_LLM_KEY", "your-api-key-here")
client = OpenAI(
api_key=api_key,
base_url="https://litellm.dreamlab.ucsb.edu/v1"
)
response = client.chat.completions.create(
model="gemini-3.5-flash-lite",
messages=[
{"role": "user", "content": "Explain the difference between a list and a tuple in Python."}
]
)
print(response.choices[0].message.content)Run the script:
python main.pyData Privacy & Security
The DREAM Lab AI gateway IS NOT approved for use with data classified as P3 or P4 under the UC data protection levels. The service uses models through Google’s Gemini Enterprise Agent Platform: Google will not use data to train or fine-tune any AI/ML models; however, they may retain some data for limited periods of time for specific conditions (see “Gemini Enterprise Agent Platform and zero data retention”).
Responsible Use
You are responsible for how you use this service and anything it generates. Verify output before relying on it. Do not use it as a substitute for medical, legal, or financial advice. Do not use it to produce content or take actions that would violate law or University policy. As noted by the UC AI Council, if an action wasn’t permissible before AI, it isn’t permissible with AI.
Additional resources: