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.

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):

export OPENAI_API_KEY="YOUR_API_KEY"
export OPENAI_BASE_URL="https://openai.rc.asu.edu/v1"

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? Two beginner-friendly options connect to this same RC gateway with your key:

  • 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).
note

OpenCode needs two things to reach RC: your API key (stored as an environment variable) and a provider config that points at https://openai.rc.asu.edu/v1. Both are covered step by step in the OpenCode setup guide.

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.