Skip to main content

Connect VS Code to the RC OpenAI-Compatible API

Level: Beginner · Time: 10–15 min · Category: How-to

Tags: VS Code · BYOK · Custom Endpoint

Configure VS Code BYOK (Bring Your Own Key) with the Research Computing LLM gateway, then send a successful test query from VS Code Chat.

Use this when you want VS Code Chat to send requests to the RC OpenAI-compatible API instead of a built-in provider. You need VS Code with Chat available, one RC LLM API key, and one model ID that your key can use.

Prerequisites

What you will do

  • Collect the exact API key, model ID, and endpoint URL values.
  • Add the RC LLM gateway as a VS Code Custom Endpoint provider.
  • Configure chatLanguageModels.json if VS Code opens it.
  • Select the RC model in VS Code Chat and send a successful test query.

1. Collect the values from this portal

Start with the portal values so VS Code setup is just data entry, not guesswork.

  • Create or copy an API key from the AI LLM area of your profile.
  • Open the model list and copy one model ID available to your account.
  • Use the full Chat Completions endpoint below for VS Code Custom Endpoint.
  • If you are using a different local gateway in development, use that gateway's full /v1/chat/completions URL instead.
# Base URL
https://openai.rc.asu.edu/v1

# Full Chat Completions endpoint for VS Code Custom Endpoint
https://openai.rc.asu.edu/v1/chat/completions

2. Preflight the API once from a terminal

This step proves the key, model ID, and endpoint work before VS Code is involved. If this fails, fix the portal key/model first.

  • Replace the two placeholder values before running the command.
  • A successful response includes an assistant message with the preflight text.
  • A 401 usually means the key is wrong or expired. A 404/model error usually means the model ID is wrong for your account.
export RC_LLM_API_KEY="paste-your-key-here"
export RC_LLM_MODEL="paste-model-id-here"

curl -sS https://openai.rc.asu.edu/v1/chat/completions \
-H "Authorization: Bearer $RC_LLM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "'"$RC_LLM_MODEL"'",
"messages": [
{
"role": "user",
"content": "Reply with exactly: RC API preflight ok"
}
],
"temperature": 0
}'

3. Open VS Code Language Models

Use VS Code's built-in BYOK flow. For an OpenAI-compatible gateway like RC LLM, choose Custom Endpoint.

  • Update VS Code first if the Chat view or Language Models editor is missing.
  • Open Command Palette with Ctrl+Shift+P or Cmd+Shift+P.
  • Run Chat: Manage Language Models.
  • Select Add Models.
  • Choose Custom Endpoint.

4. Enter the Custom Endpoint provider details

VS Code will ask for provider information. The labels can vary slightly by version, but these are the values to use.

  • Group name: ASU Research Computing.
  • Display name: RC LLM, or the specific model name you copied.
  • API key: paste your RC LLM API key when VS Code asks for it.
  • API type: Chat Completions.
  • Endpoint URL: https://openai.rc.asu.edu/v1/chat/completions.
  • Model ID: use a model ID available to your API key.
  • Do not share screenshots that show your API key.

5. Save the model configuration if VS Code opens JSON

Some Custom Endpoint setups open chatLanguageModels.json so you can finish the model details. Use this shape, replacing the placeholders with your key and model ID.

chatLanguageModels.json
[
{
"name": "ASU Research Computing",
"vendor": "customendpoint",
"apiKey": "YOUR_RC_LLM_API_KEY",
"apiType": "chat-completions",
"models": [
{
"id": "MODEL_ID_FROM_PORTAL",
"name": "RC LLM",
"url": "https://openai.rc.asu.edu/v1/chat/completions",
"toolCalling": true,
"vision": false,
"maxInputTokens": 128000,
"maxOutputTokens": 8192
}
]
}
]

6. Select the RC model in VS Code Chat

After saving the provider configuration, switch the Chat view to the RC model before sending a test message.

  • Open the VS Code Chat view.
  • Open the model picker in the chat input.
  • Choose the model under ASU Research Computing or RC LLM.
  • If it does not appear, reload VS Code and check that it is visible in Chat: Manage Language Models.

7. Send a successful test query

Use a harmless chat prompt first. This confirms VS Code can send a request through BYOK and receive a response from the RC OpenAI-compatible API.

  • Paste the prompt below into VS Code Chat with the RC model selected.
  • A successful result is a normal assistant response in VS Code Chat.
  • The exact wording can vary, but there should be no authentication, provider, or model-not-found error.
  • After this works, try explanation prompts before asking VS Code to edit files.
You are connected to VS Code through the ASU Research Computing OpenAI-compatible API. Reply with one short sentence that starts with: Connected:

A good next prompt:

Explain what this workspace does from the README and package files. Do not edit files yet. List the files you inspected.

Troubleshooting

  • If Custom Endpoint is missing, update VS Code and confirm BYOK is not disabled by organization policy.
  • If the terminal preflight fails, fix the API key, model ID, or endpoint before changing VS Code.
  • If authentication fails in VS Code but cURL works, update the provider details from Chat: Manage Language Models and re-enter the API key.
  • If VS Code opens chatLanguageModels.json, do not put that file in a project repo and do not share screenshots that include apiKey.
  • If the model does not appear in the picker, confirm the model is visible in the Language Models editor, then reload VS Code.
  • If chat works but agent edits fail, the model may not support tool calling; use explanation/review prompts or choose a tool-capable model.
  • If standard inline completions do not use this model, that is expected: VS Code BYOK applies to chat and utility tasks, not every Copilot feature.

Next steps

  • LLM API Guide — return here if the key, endpoint, or model ID fails outside VS Code.
  • Create a lab portal — use the configured VS Code model on a beginner web project.
  • Create a Slurm CLI — practice using BYOK assistance on a command-line project.