Add provider instruction for Azure OpenAI
This commit is contained in:
@@ -74,7 +74,7 @@ To use Amazon Bedrock with opencode:
|
||||
- `AWS_PROFILE`: First login through AWS IAM Identity Center (or AWS SSO) using
|
||||
`aws sso login`. Then get the name of the profile you want to use.
|
||||
- `AWS_BEARER_TOKEN_BEDROCK`: You can generate a long-term API key from the
|
||||
Amazon Bedrock console.
|
||||
Amazon Bedrock console.
|
||||
|
||||
Once you have one of the above, set it while running opencode.
|
||||
|
||||
@@ -94,7 +94,7 @@ To use Amazon Bedrock with opencode:
|
||||
export AWS_ACCESS_KEY_ID=XXX
|
||||
```
|
||||
|
||||
2. Run the `/models` command to select the model you want.
|
||||
1. Run the `/models` command to select the model you want.
|
||||
|
||||
---
|
||||
|
||||
@@ -122,6 +122,69 @@ the Anthropic models should be available when you use the `/models` command.
|
||||
|
||||
---
|
||||
|
||||
### Azure OpenAI
|
||||
|
||||
1. Head over to the [Azure portal](https://portal.azure.com/) and create an **Azure OpenAI** resource. You'll need:
|
||||
|
||||
- **Resource name**: This becomes part of your API endpoint (`https://RESOURCE_NAME.openai.azure.com/`)
|
||||
- **API key**: Either `KEY 1` or `KEY 2` from your resource
|
||||
|
||||
2. Go to [Azure AI Foundry](https://ai.azure.com/) and deploy a model.
|
||||
|
||||
:::note
|
||||
The deployment name must match the model name for opencode to work properly.
|
||||
:::
|
||||
|
||||
3. Run `opencode auth login` and select **Azure**.
|
||||
|
||||
```bash
|
||||
$ opencode auth login
|
||||
|
||||
┌ Add credential
|
||||
│
|
||||
◆ Select provider
|
||||
│ ● Azure
|
||||
│ ...
|
||||
└
|
||||
```
|
||||
|
||||
4. Enter your API key.
|
||||
|
||||
```bash
|
||||
$ opencode auth login
|
||||
|
||||
┌ Add credential
|
||||
│
|
||||
◇ Select provider
|
||||
│ Azure
|
||||
│
|
||||
◇ Enter your API key
|
||||
│ _
|
||||
└
|
||||
```
|
||||
|
||||
5. Set your resource name as an environment variable:
|
||||
|
||||
```bash
|
||||
AZURE_RESOURCE_NAME=XXX opencode
|
||||
```
|
||||
|
||||
Or add it to a `.env` file in the project root:
|
||||
|
||||
```bash title=".env"
|
||||
AZURE_RESOURCE_NAME=XXX
|
||||
```
|
||||
|
||||
Or add it to your bash profile:
|
||||
|
||||
```bash title="~/.bash_profile"
|
||||
export AZURE_RESOURCE_NAME=XXX
|
||||
```
|
||||
|
||||
6. Run the `/models` command to select your deployed model.
|
||||
|
||||
---
|
||||
|
||||
### GitHub Copilot
|
||||
|
||||
To use your GitHub Copilot subscription with opencode:
|
||||
@@ -343,7 +406,7 @@ https://platform.openai.com/api-keys
|
||||
"provider": {
|
||||
"openrouter": {
|
||||
"models": {
|
||||
"somecoolnewmodel": {},
|
||||
"somecoolnewmodel": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -646,7 +709,7 @@ You can use any OpenAI-compatible provider with opencode. Most modern AI provide
|
||||
|
||||
4. Create or update your `opencode.json` file in your project directory:
|
||||
|
||||
```json title="opencode.json" "\"myprovider\"" {5-15}
|
||||
```json title="opencode.json" ""myprovider"" {5-15}
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"provider": {
|
||||
@@ -714,6 +777,7 @@ We are setting the `apiKey` using the `env` variable syntax, [learn more](/docs/
|
||||
#### Common Examples
|
||||
|
||||
**Together AI:**
|
||||
|
||||
```json title="opencode.json"
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
@@ -735,6 +799,7 @@ We are setting the `apiKey` using the `env` variable syntax, [learn more](/docs/
|
||||
```
|
||||
|
||||
**Fireworks AI:**
|
||||
|
||||
```json title="opencode.json"
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
@@ -754,6 +819,7 @@ We are setting the `apiKey` using the `env` variable syntax, [learn more](/docs/
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
Reference in New Issue
Block a user