Skip to main content

LLM API Access

Overview

You can access Large Language Models (LLMs) programmatically for your applications or scripts. The API is compatible with the OpenAI specification, allowing you to use standard tools and libraries.

Want an AI assistant that edits your code, not just an API?

Getting Started with AI walks you from zero to a working setup — key, assistant, agents, and skills — and assumes no prior experience. This page is the API reference underneath it.

How to Request an API Key

API keys are managed through the Voyager User Administration portal.

  1. Login to the Voyager portal.
  2. Navigate to the LLM Access tab.
  3. Click Create Key to generate an API token.
  4. Review the list of available models to use in your requests.

Voyager LLM Access Tab

Examples

Replace <YOUR_API_KEY> with your actual key and <MODEL_NAME> with a supported model (e.g., llama3).

curl https://openai.rc.asu.edu/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-d '{
"model": "<MODEL_NAME>",
"messages": [
{
"role": "user",
"content": "Explain quantum computing in one sentence."
}
]
}'

Use Python

For real projects, keep secrets out of source files by reading them from the environment.

Install the SDK into your virtual environment with Mamba:

mamba install -c conda-forge openai

Set the connection values in your shell (or a .env file that you keep out of source control). Read the key in from a prompt so it does not land in your shell history:

read -rs OPENAI_API_KEY   # paste your key, then press Enter (nothing is echoed)
export OPENAI_API_KEY
export OPENAI_BASE_URL="https://openai.rc.asu.edu/v1"

To set it permanently, add the export line to ~/.zshrc or ~/.bashrc by editing the file in a text editor rather than echoing the key into it — an echo command containing your key is itself recorded in your history.

Keep the key out of your shell history

Anything typed at a prompt is written in plain text to ~/.zsh_history, ~/.bash_history, or PowerShell's ConsoleHost_history.txt. The same goes for the placeholder keys in the examples above: substitute a variable rather than pasting the real value. If a key is exposed, regenerate it in the Voyager portal — rotating it invalidates the old one.

Your Python code can then read the key and base URL from the environment automatically:

from openai import OpenAI

client = OpenAI() # reads OPENAI_API_KEY and OPENAI_BASE_URL from the environment

response = client.chat.completions.create(
model="<MODEL_NAME>",
messages=[{"role": "user", "content": "Hello!"}],
)

print(response.choices[0].message.content)

Use an AI coding assistant

Prefer to build with an AI assistant that can read your project and edit files? These options connect to this same RC gateway with your key:

  • Getting Started with AI — the complete beginner path: pick a tool, set it up, and learn the prompting and agent habits that make our models work well. Start here.
  • Set up OpenCode — a free assistant with a desktop app and a terminal interface. The guide walks you through installing it, storing your key, and adding RC as a provider from scratch.
  • Connect VS Code to the RC API — use VS Code Chat with the RC gateway (Bring Your Own Key).
Generate your OpenCode config in Voyager

OpenCode needs two things to reach RC: your API key and a provider config pointing at https://openai.rc.asu.edu/v1. You do not have to write that config by hand — the opencode tab under LLM Access in the Voyager portal generates it for you, including agent roles and tool permissions. See Getting Started with AI.

List available models

curl https://openai.rc.asu.edu/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"

Use any returned id as the model value in chat requests. The Models list in the portal shows context windows, capabilities, and usage data.

Troubleshooting

Common issues when using the API:

  • Authentication Failed (401): Ensure your API key is correct and has not expired. You can regenerate it in the portal.
  • Model Not Found: Check the "Available Models" list to ensure you are requesting a valid model name (e.g., llama3 vs llama-3).
  • SDK ignores the endpoint: If cURL works but an SDK does not, confirm the SDK is using https://openai.rc.asu.edu/v1 as its base URL.
  • Rate Limits (429): If you receive a 429 error, you may be exceeding the allowed request rate. Please wait and try again.