You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to set up an Azure Foundry (Cognitive Services) model on windows #11792
When I try to add this model from Azure in opencode it only asks me for the API KEY. I select the the gpt 5.1 Codex model in the chat from Azure Cognitive Services and it says:
"AI_LoadSettingError: Azure OpenAI resource name setting is missing. Pass it using the 'resourceName' parameter or the AZURE_RESOURCE_NAME environment variable."
I've tried to set this AZURE_RESOURCE_NAME in various places:
As an environment var. I verified the environment variable was set correctly as "my-service".
I created an opencode.json file in the project's folder trying different json structures
Nothing worked. Still getting the same message.
Also, in windows I can't find any file with my settings and the API key that I can modify.
Hi,
I've finally figured out. In windows it doesn't create any opencode.json file but if you create one and put this in your project root, it works:
{
"$schema": "https://opencode.ai/config.json",
"model": "gpt-5.1-codex",
"theme": "opencode",
"autoupdate": true,
"provider": {
"azure-cognitive-services": {
"options": {
"apiKey": "-redacted-",
"resourceName": "my-service"
},
"models": {
"gpt-5.1-codex": {
"name": "gpt-5.1-codex"
}
}
}
}
}
Where resource name is the first part of your Target URI in Foundry: https://my-service.cognitiveservices.azure.com.
Do not put any base url as it will build it itself using the resourceName.
Activity
github-actions commentedon Feb 2, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
ilrenzo commentedon Feb 5, 2026
Hi,
I've finally figured out. In windows it doesn't create any opencode.json file but if you create one and put this in your project root, it works:
{
"$schema": "https://opencode.ai/config.json",
"model": "gpt-5.1-codex",
"theme": "opencode",
"autoupdate": true,
"provider": {
"azure-cognitive-services": {
"options": {
"apiKey": "-redacted-",
"resourceName": "my-service"
},
"models": {
"gpt-5.1-codex": {
"name": "gpt-5.1-codex"
}
}
}
}
}
Where resource name is the first part of your Target URI in Foundry: https://my-service.cognitiveservices.azure.com.
Do not put any base url as it will build it itself using the resourceName.