For Students, Teachers, and Admins
When Generative AI (GenAI) is enabled for an assignment part, Vocareum pre-populates the lab work area with environment variables for each GenAI service available to the lab. This article is a reference table of those variable names, for instructors and learners who need to look up the exact variable to read while writing assignment code. Use it when you are writing or reviewing code that calls a GenAI service and you need to confirm the precise variable name for a given provider.
This article does not cover how GenAI keys are generated, routed, or budgeted, and it does not cover how to enable GenAI in an assignment. For that background and those procedures, refer to the related articles linked at the end of this reference.
Environment Variables by Service
Each GenAI service available to the lab sets three environment variables: an API key, a base URL, and a list of the models the service can reach. The following table lists the variable names for every supported service. Use the names exactly as written, because the naming is not uniform across services.
Service | API key variable | Base URL variable | Model list variable |
OpenAI |
|
|
|
Azure OpenAI |
|
|
|
Llama |
|
|
|
Custom |
|
|
|
Claude |
|
|
|
Claude Bedrock |
|
|
|
Gemini |
|
|
|
Nova |
|
|
|
Custom is the literal label used in the Vocareum interface for the catch-all compatible-endpoint service. If your assignment uses a service configured under that Custom label, read the GENAI_API_KEY and GENAI_BASE_URL variables.
Additional variables
Two more variables are set for compatibility with common tools:
OPENAI_API_BASEis set whenever GenAI is enabled. It holds a copy of the OpenAI base URL for code that uses an older version of theopenaiPython package (earlier than 1.0), which reads this name instead ofOPENAI_BASE_URL.ANTHROPIC_AUTH_TOKENis set alongside the Claude variables. Claude Code reads this variable rather thanANTHROPIC_API_KEY.
Naming Notes
A few details in the table above are easy to get wrong, so confirm them against your service before writing code.
The variable names are deliberately not normalized into a single pattern. Most services pair an _API_KEY variable with a _BASE_URL variable, but there are two exceptions. Azure OpenAI uses AZURE_OPENAI_ENDPOINT rather than a _BASE_URL name for its URL. Gemini pairs GOOGLE_API_KEY with GOOGLE_GEMINI_BASE_URL, so the key and URL variables do not share an identical prefix. Reproduce these names exactly as shown rather than assuming a consistent suffix.
Claude and Claude Bedrock use the same ANTHROPIC_* variables, but only one of them populates the variables in a given lab. If the policy includes only Claude Bedrock, the ANTHROPIC_* variables hold the Bedrock key and URL. If the policy includes both Claude and Claude Bedrock, direct Claude takes precedence: the ANTHROPIC_* variables hold the Claude key and URL, and Claude Bedrock is not exposed in the lab.
Note: If a variable name is already set in the lab's environment, Vocareum adds a number to the end of the name instead of overwriting it, for example OPENAI_API_KEY1 and OPENAI_BASE_URL1. This is rare. If your code cannot find a variable listed in this article, check the lab's environment for a numbered version.
VM Labs
Virtual machine (VM) labs configured with the Claude desktop setup do not use the variable names above. They use a single key variable, VOC_GENAI_API_KEY, and one URL variable per service, such as VOC_GENAI_CLAUDE_URL, VOC_GENAI_OPENAI_URL, and VOC_GENAI_CLAUDE_BEDROCK_URL.
Related Articles
For more background and for the procedures that this reference supports, refer to the following articles.
To understand how GenAI keys are generated, routed through the gateway, and budgeted in the lab, refer to What is GenAI in Vocareum Labs?.
To enable GenAI and select a policy for an assignment part, refer to Configuring GenAI in an Assignment.
To locate your GenAI key as a learner, refer to Accessing Your GenAI Key.
