Question
Hello!
I'm trying to use my API access through my university with opencode but no matter what configuration I use I always either get a "Resource Not Found" error or an "Internal Server Error". Here is my config:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"um-gpt": {
"name": "U-M GPT",
"npm": "@ai-sdk/azure",
"options": {
"baseURL": "https://api.umgpt.umich.edu/azure-openai-api/openai",
"apiVersion": "2025-04-01-preview",
"apiKey": "{env:API_KEY}",
"useDeploymentBasedUrls": true,
"headers": {
"api-key": "{env:API_KEY}",
"openai-organization": "{env:SHORTCODE}",
},
},
"models": {
"gpt-4o": {
"id": "gpt-4o",
"limit": {
"context": 128000,
"output": 16384
}
},
},
}
}
}
This Python code works so I know that I can connect and talk to the models:
from openai import AzureOpenAI
import os
# Sets the current working directory to be the same as the file.
os.chdir(os.path.dirname(os.path.abspath(__file__)))
# Create Azure client
client = AzureOpenAI(
api_key=os.environ["API_KEY"],
api_version="2025-04-01-preview",
azure_endpoint="https://api.umgpt.umich.edu/azure-openai-api",
organization=os.environ["SHORTCODE"],
)
# Create Query
messages = [
{
"role": "system",
"content": "You are a helpful assistant. Always say GO BLUE! at the end of your response. Respond in json format.",
},
{
"role": "user",
"content": "Explain step by step. Where is the University of Michigan?",
},
]
# Send a completion request.
response = client.chat.completions.create(
model="gpt-4o",
messages=messages,
temperature=0,
stop=None,
response_format={"type": "json_object"},
)
# Print response.
print(response.choices[0].message.content)
They do not allow direct access to the Azure subscription but I was hoping since the Python code works opencode would work too. I'm running opencode in terminal in WSL2. Here is the error from the logs:
ERROR 2026-02-16T17:33:51 +0ms service=session.processor error=Internal Server Error stack="AI_APICallError: Internal Server Error\n at <anonymous> (../../node_modules/.bun/@ai-sdk+provider-utils@3.0.20+d6123d32214422cb/node_modules/@ai-sdk/provider-utils/dist/index.mjs:950:18)\n at processTicksAndRejections (native:7:39)" process
Thanks for any help in diagnosing this and I'd be happy to provide any needed details.
Question
Hello!
I'm trying to use my API access through my university with opencode but no matter what configuration I use I always either get a "Resource Not Found" error or an "Internal Server Error". Here is my config:
This Python code works so I know that I can connect and talk to the models:
They do not allow direct access to the Azure subscription but I was hoping since the Python code works opencode would work too. I'm running opencode in terminal in WSL2. Here is the error from the logs:
Thanks for any help in diagnosing this and I'd be happy to provide any needed details.