Configuring AI Provider Keys
This page explains how to configure Mito Data Copilot to use your own AI API keys instead of the Mito server.
By default, Mito uses our server to send AI requests to the model provider. If instead you want to use your own AI API keys, you can set the following configuration options.
Available Model Providers
Mito supports the following AI models through environment variables:
OpenAI
Set
OPENAI_API_KEYto your OpenAI API keyWhen using OpenAI, Mito will automatically use gpt-4.1.
Claude (Anthropic)
Set
CLAUDE_MODELto specify the model (e.g., "claude-3-7-sonnet-latest").Set
CLAUDE_API_KEYto your Anthropic API key
Gemini (Google)
Set
GEMINI_MODELto specify the model (eg., "gemini-2.0-flash").Set
GEMINI_API_KEYto your Google API key
Ollama (Self-hosted)
Set
OLLAMA_MODELto specify the modelSet
OLLAMA_BASE_URLto your Ollama server URL (e.g., "http://localhost:11434/v1")
Azure OpenAI
If you are a Mito Enterprise user, you can configure Mito to use a Azure OpenAI endpoint instead. If you have questions about Mito Enterprise, please contact [email protected].
Set
AZURE_OPENAI_API_KEYto your Azure OpenAI API keySet
AZURE_OPENAI_API_VERSIONto specify the API versionSet
AZURE_OPENAI_ENDPOINTto your Azure OpenAI endpoint URLSet
AZURE_OPENAI_MODELto specify the deployed model name
Setting Up Environment Variables
Important: Environment variables must be set before launching JupyterLab, as they are read when the Mito server extension initializes during startup.
Method 1: System Environment Variables
Set environment variables at the system level before starting JupyterLab:
On Windows:
set GEMINI_API_KEY=your-api-key-here
set GEMINI_MODEL=gemini-2.0-flashOn macOS/Linux:
export GEMINI_API_KEY=your-api-key-here
export GEMINI_MODEL=gemini-2.0-flashMethod 2: .env File with jupyter_server_config.py
Create a
.envfile in your Jupyter config directory:
GEMINI_API_KEY=your-api-key-here
GEMINI_MODEL=gemini-2.0-flashCreate or modify your
jupyter_server_config.pyfile to load these variables on startup:
import os
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv('/path/to/your/.env')Method 3: Permanent Environment Variables
Add the environment variables to your shell's configuration file for permanent setup:
On Windows:
Add environment variables through System Properties > Environment Variables.
On macOS/Linux:
Add to your .bashrc, .zshrc, or equivalent:
export GEMINI_API_KEY=your-api-key-here
export GEMINI_MODEL=gemini-2.0-flashData Protection Considerations
Remember that when using external AI providers:
Private data in dataframe names, column headers, or the first five rows of data might be shared with the AI provider
To maximize data protection, Mito Enterprise users can connect to a self-hosted model
Last updated
Was this helpful?