Skip to main content

GenAI Environment Variables Reference

A quick lookup of the environment variable names that hold each GenAI service's API key, base URL, and model list inside a Vocareum lab.

J
Written by Julia Dashzeveg

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

OPENAI_API_KEY

OPENAI_BASE_URL

OPENAI_MODELS

Azure OpenAI

AZURE_OPENAI_API_KEY

AZURE_OPENAI_ENDPOINT

AZURE_OPENAI_MODELS

Llama

LLAMA_API_KEY

LLAMA_BASE_URL

LLAMA_MODELS

Custom

GENAI_API_KEY

GENAI_BASE_URL

GENAI_MODELS

Claude

ANTHROPIC_API_KEY

ANTHROPIC_BASE_URL

ANTHROPIC_MODELS

Claude Bedrock

ANTHROPIC_API_KEY

ANTHROPIC_BASE_URL

ANTHROPIC_MODELS

Gemini

GOOGLE_API_KEY

GOOGLE_GEMINI_BASE_URL

GOOGLE_GEMINI_MODELS

Nova

NOVA_API_KEY

NOVA_BASE_URL

NOVA_MODELS

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_BASE is set whenever GenAI is enabled. It holds a copy of the OpenAI base URL for code that uses an older version of the openai Python package (earlier than 1.0), which reads this name instead of OPENAI_BASE_URL.

  • ANTHROPIC_AUTH_TOKEN is set alongside the Claude variables. Claude Code reads this variable rather than ANTHROPIC_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.

Did this answer your question?