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
Setting up opencode with azure ai foundry (openai) project issue #4136
I have then used the powershell command [System.Environment]::SetEnvironmentVariable('AZURE_RESOURCE_NAME', 'opencode-test', 'User') to set the resuce name.
Lastly i used the opencode auth login and pasted the same api key that is set within the opencode.jsonc.
When i then try to use opencode, i then get:
anyone know what i might be doing wrong? is there a way to run it in "verbose mode", so it is easier to debug?
changed the title [-]Settign up opencode with azure ai foundry (openai) project[/-][+]Setting up opencode with azure ai foundry (openai) project issue[/+]on Nov 9, 2025
@rekram1-node I have connected Opencode to Github App, and I have a workflow file. I am not able to configure the resources properly using Azure OpenAI.
name: opencode
on:
issue_comment:
types: [created]
jobs:
opencode:
# Run only if the comment body contains /oc or /opencode
if: |
contains(github.event.comment.body, '/oc') ||
contains(github.event.comment.body, '/opencode')
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
I am getting following error.
modelID: "gpt-4.1-mini",
providerID: "azure",
time: {
created: 1762877974726,
completed: 1762877974757,
},
sessionID: "ses_58c48dd8effesRo8Q0Ps8f0sIO",
error: {
name: "UnknownError",
data: {
message: "Error: Unable to connect. Is the computer able to access the url?",
},
},
}
I have kept the model name and deployment name, but still there is an issue in connecting to Azure OpenAI model.
AZURE_RESOURCE_NAME = https://{resource_name}.openai.azure.com/openai/deployments/{model_name}/chat/completions?api-version=2025-01-01-preview
No, there is no such restriction. I can access it using python sdk or in Azure Playground as well. Do you have some boiler plate code or some reference I can refer to. It will be helpful.
@rekram1-node Thanks, I was able to fix the code and it is working as expected. However, I have one doubt, I can see the current session is being stored at opencode side. I have hosted my own opencode server. Can you point me to the reference if there is a way I configure in github action workflow that will connect to my server instead of opencode server.
hmm that's interesting... I don't think we have a great way of doing that rn.... Frank added a command that allows u to import a session from a github action locally, but u have to run it yourself each time it doesn't auto sync.
I suppose u could also do SSH + a file mount and write a custom action if u want everything to auto sync
I did try, but still issue persist the share link that is created for session is still stored on opencode.ai server and not on my own server.
Then only option I could see now is, I can do opencode serve and then try connecting using SDK or send a direct API request.
I am doubtful whether using this approach I would be able to create a new branch, update the code automatically and then raise a PR. I don't see a direct functionality available in SDK.
Activity
[-]Settign up opencode with azure ai foundry (openai) project[/-][+]Setting up opencode with azure ai foundry (openai) project issue[/+]rekram1-node commentedon Nov 9, 2025
@BenjaminOmar the model key shouldn't need a provider prefix: "azure/"
Also note: "The deployment name must match the model name for opencode to work properly."
I see you made a deployment called
GPT-4.1but that doesn't match the model namegpt-4.1rekram1-node commentedon Nov 9, 2025
u prolly saw this but we have docs for azure: https://opencode.ai/docs/providers/#azure-openai
BenjaminOmar commentedon Nov 9, 2025
figured it out @rekram1-node. it should be like this:
thanks for the help!
Delta-11 commentedon Nov 11, 2025
@rekram1-node I have connected Opencode to Github App, and I have a workflow file. I am not able to configure the resources properly using Azure OpenAI.
name: opencode
on:
issue_comment:
types: [created]
jobs:
opencode:
# Run only if the comment body contains /oc or /opencode
if: |
contains(github.event.comment.body, '/oc') ||
contains(github.event.comment.body, '/opencode')
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
I am getting following error.
modelID: "gpt-4.1-mini",
providerID: "azure",
time: {
created: 1762877974726,
completed: 1762877974757,
},
sessionID: "ses_58c48dd8effesRo8Q0Ps8f0sIO",
error: {
name: "UnknownError",
data: {
message: "Error: Unable to connect. Is the computer able to access the url?",
},
},
}
I have kept the model name and deployment name, but still there is an issue in connecting to Azure OpenAI model.
AZURE_RESOURCE_NAME = https://{resource_name}.openai.azure.com/openai/deployments/{model_name}/chat/completions?api-version=2025-01-01-preview
rekram1-node commentedon Nov 11, 2025
does the resource have any security restrictions? Wondering why the action cant access it
Delta-11 commentedon Nov 12, 2025
No, there is no such restriction. I can access it using python sdk or in Azure Playground as well. Do you have some boiler plate code or some reference I can refer to. It will be helpful.
rekram1-node commentedon Nov 12, 2025
@Delta-11 there isn't much to our azure stuff it is just this:
and the ai sdk package: https://ai-sdk.dev/providers/ai-sdk-providers/azure
Delta-11 commentedon Nov 12, 2025
@rekram1-node Thanks, I was able to fix the code and it is working as expected. However, I have one doubt, I can see the current session is being stored at opencode side. I have hosted my own opencode server. Can you point me to the reference if there is a way I configure in github action workflow that will connect to my server instead of opencode server.
rekram1-node commentedon Nov 12, 2025
hmm that's interesting... I don't think we have a great way of doing that rn.... Frank added a command that allows u to import a session from a github action locally, but u have to run it yourself each time it doesn't auto sync.
I suppose u could also do SSH + a file mount and write a custom action if u want everything to auto sync
Here is an example of a custom action for reference: https://github.com/sst/opencode/blob/dev/.github/workflows/duplicate-issues.yml
Delta-11 commentedon Nov 13, 2025
I did try, but still issue persist the share link that is created for session is still stored on opencode.ai server and not on my own server.
Then only option I could see now is, I can do opencode serve and then try connecting using SDK or send a direct API request.
I am doubtful whether using this approach I would be able to create a new branch, update the code automatically and then raise a PR. I don't see a direct functionality available in SDK.
rekram1-node commentedon Nov 13, 2025
We are going to make share self hostable soon
Delta-11 commentedon Nov 14, 2025
Thanks for that.