I have a Microsoft Foundry resource with two models deployed: GPT 6.1 Sol and GPT 6 Astra. I wanted to pick them straight from T3 Code's model picker, the same way I pick Claude. It took a bit of digging, so here's the whole story.
First attempt: wrong target
My first pass tested the Foundry endpoint with curl and a small Python script. Both models answered fine. But none of that put them in T3 Code, which is what I actually wanted. Lesson learned: say which app the models should show up in.
How T3 Code works with models
T3 Code doesn't hold API keys or call model APIs itself. It drives coding agents installed on your machine, like Claude Code, OpenCode, Copilot or Kiro. So the question became which of those agents can talk to Foundry.
I searched the T3 app bundle for "foundry". Every hit belonged to the Claude SDK that ships inside it, and that's only for Claude models on Foundry. There was nothing for GPT models.
OpenCode can talk to Foundry, and T3 has an OpenCode provider. That was the way in.
OpenCode was too old
My Mac had OpenCode 1.1.23. T3 wants 2.0.18 or newer, and version 2 lives in a separate npm package. OpenCode 2 also converts its database on first run, so I backed up the database, the auth file, both config files and T3's settings before touching anything.
npm install -g --allow-scripts=@opencode/cli @opencode/cli
npm skipped the postinstall script on my first try. That script picks the native binary for your machine, so I ran the install again with --allow-scripts.
The config was already there
My OpenCode config already had a foundry provider pointing at my Foundry resource, with the models named "GPT-6.1 Sol (Foundry)" and "GPT-6 Astra (Foundry)". I'd set it up a while back and forgotten. Its key matched the one I was using, and OpenCode 2 reads the old format without complaint.
A quick run through each one:
Switching it on in T3
OpenCode was turned off in T3's provider settings. I flipped it on, and T3 found OpenCode 2.3.2 straight away.
The Foundry models showed up in the OpenCode model list:
And here's the part I wanted. Open a new thread, click the model button, type "Foundry":
I started a small test thread with each model inside T3. GPT-6.1 Sol replied "hello from GPT-6.1 Sol (Foundry), running inside T3 Code", and Astra said the same with its own name.
Things that tripped me up
- T3 has no direct Foundry option for GPT models, so you go through OpenCode.
- The OpenCode 1 to 2 upgrade is a separate package, not a normal update.
- npm blocks postinstall scripts unless you allow them.
- macOS wouldn't let me grab a regular screenshot, so I took these in T3's own browser preview with a short-lived, read-only pairing token, then revoked it. That's why you can see a "Limited permissions" banner on the settings page.
Keep your key safe
Never paste your Foundry API key into chats, documents or screenshots. If it ever ends up somewhere it shouldn't, regenerate it in the Azure portal under Keys and Endpoint, then update your OpenCode config.
Microsoft Foundry models in T3 Code: GPT 6.1 Sol and GPT 6 Astra
Step by step notes for getting Microsoft Foundry deployments into T3 Code's model picker on a Mac.
What we ended up with
| Thing | Value |
|---|---|
| Foundry resource | <your-resource> |
| Endpoint | https://<your-resource>.services.ai.azure.com/openai/v1 |
| Deployments | gpt-6.1-sol and gpt-6-astra (default names, same as the model) |
| T3 Code version | 0.1.11 |
| T3 provider used | OpenCode, running OpenCode 2.3.2 |
| Names in the picker | GPT-6.1 Sol (Foundry), GPT-6 Astra (Foundry) |
How T3 Code talks to Foundry
T3 Code doesn't call model APIs itself. It drives coding agents (Claude, OpenCode, Copilot, Kiro and so on) that are installed on the machine. T3 0.1.11 has no built-in Microsoft Foundry provider for GPT models. The only Foundry support inside the app is for Claude models.
OpenCode can talk to Foundry directly, and T3 already has an OpenCode provider. So the path is Foundry, then OpenCode, then T3 Code.
Steps
1. Check the Foundry key and deployments
set -a; source .env; set +a
curl -H "api-key: $AZURE_FOUNDRY_API_KEY" "$AZURE_FOUNDRY_ENDPOINT/models"
The resource lists 513 models, and both gpt-6.1-sol and gpt-6-astra are generally available. A test call to /responses with each name came back with HTTP 200, so both deployments were already live.
2. Back up OpenCode before upgrading
OpenCode 2 converts its database the first time it runs, so I copied everything first:
B=~/opencode-backup-$(date +%Y%m%d-%H%M%S); mkdir -p "$B"
cp -p ~/.local/share/opencode/opencode.db* ~/.local/share/opencode/auth.json "$B"/
cp -p ~/.config/opencode/opencode.json ~/.config/opencode/opencode.jsonc "$B"/
cp -p ~/.t3/userdata/settings.json "$B"/t3-settings.json
3. Upgrade OpenCode to version 2
This Mac had OpenCode 1.1.23. T3 Code needs 2.0.18 or newer, and version 2 ships as a separate npm package.
npm install -g --allow-scripts=@opencode/cli @opencode/cli
opencode --version # opencode v2.3.2
4. The Foundry provider in OpenCode
~/.config/opencode/opencode.jsonc already had a foundry provider pointing at my Foundry resource, so I didn't need to add one. Its key matched the new key exactly. OpenCode 2 still reads that older config format. The relevant part, with the key left out:
"provider": {
"foundry": {
"npm": "@ai-sdk/openai",
"name": "Azure AI Foundry",
"options": {
"baseURL": "https://<your-resource>.services.ai.azure.com/openai/v1",
"apiKey": "<key>",
"headers": { "api-key": "<key>" }
},
"models": {
"gpt-6-astra": { "id": "gpt-6-astra", "name": "GPT-6 Astra (Foundry)" },
"gpt-6-sol": { "id": "gpt-6-sol", "name": "GPT-6 Sol (Foundry)" },
"gpt-6.1-sol": { "id": "gpt-6.1-sol", "name": "GPT-6.1 Sol (Foundry)" }
}
}
}
opencode models | grep -E "^foundry/"
5. Test each model through OpenCode
opencode run --standalone --model foundry/gpt-6.1-sol "Reply with exactly: hello from <your model name>"
opencode run --standalone --model foundry/gpt-6-astra "Reply with exactly: hello from <your model name>"
6. Turn on OpenCode in T3 Code
The OpenCode provider was switched off in T3. In ~/.t3/userdata/settings.json I changed providerInstances.opencode.enabled from false to true. You can also do this in Settings > Providers > OpenCode with the toggle. T3 picked it up right away and shows OpenCode v2.3.2 as Authenticated.
The OpenCode model list in T3 now includes the Foundry deployments, and they're switched on:
7. Pick the model in a thread
Open a new thread, click the model button next to the send button, and type Foundry in the search box.
8. Confirm it runs inside T3
I started a short test thread in T3 with each model. Both replied:
- GPT-6.1 Sol (Foundry): "hello from GPT-6.1 Sol (Foundry), running inside T3 Code"
- GPT-6 Astra (Foundry): "hello from GPT-6 Astra (Foundry), running inside T3 Code"
Obstacles
No native Foundry provider in T3. I searched the T3 app bundle for "foundry". Every hit belonged to the Claude Code SDK bundled inside it, which only uses Foundry for Claude models. OpenCode filled the gap.
OpenCode was too old. Version 1.1.23 shows as limited or broken in T3. The fix was the separate @opencode/cli package, which brought it to 2.3.2.
npm skipped the postinstall script. The first install printed a warning that postinstall.mjs didn't run. That script picks the native binary for your platform, so I reinstalled with --allow-scripts=@opencode/cli.
Two different Azure keys. OpenCode already had an azure login with a different key, probably for another resource. I left it alone and used the existing foundry provider, whose key matched.
Python TLS error during the first API test. The python.org Python build doesn't come with CA certificates on macOS. The test script now loads /etc/ssl/cert.pem. Verification stays on.
Screenshots. macOS blocked a normal screen capture (could not create image from display). I took the T3 screenshots in T3's own browser preview instead. That needed a pairing token, so I issued a read-only one that expired in 5 minutes and revoked the session afterward. That's also why the settings page shows a "Limited permissions" banner.
Undoing it
- Turn OpenCode off again in Settings > Providers.
- Go back to OpenCode 1:
npm uninstall -g @opencode/cli, then restore the files from~/opencode-backup-*.
Security note
Treat your Foundry API key like a password. If it is ever exposed, regenerate it in the Azure portal under Keys and Endpoint, then update it in ~/.config/opencode/opencode.jsonc (both apiKey and the api-key header) and in your project's .env.
Conclusion
Getting GPT 6.1 Sol and GPT 6 Astra into T3 Code didn't need a new provider, just the right path. T3 Code drives coding agents instead of calling models itself, so the trick was to let OpenCode talk to Microsoft Foundry and let T3 Code talk to OpenCode. Once OpenCode was on version 2 and switched on in T3, the Foundry models showed up in the picker like any other model.
A few takeaways if you try this yourself:
- Check which agents your client can drive before hunting for a native provider. The way in might already be installed.
- Back up before big upgrades, especially when a tool converts its database on first run.
- Test each model from the command line first. If it works there, any problem in the app is the app.
- Keep keys and endpoints out of chats, screenshots and posts. Use placeholders when you share your setup.
The same approach should work for any Foundry deployment OpenCode can reach. Give it a go, and let me know in the comments how it went for you.
Published Nov 23, 2026
Version 1.0suzarilshah
MVP
Joined August 12, 2020
Educator Developer Blog
Follow this blog board to get notified when there's new activity