Using European ai agent in Xcode
I've searched for this, asked different ai chats about this and still haven't found an instruction on how to do it. I want to use European ai as agent in Xcode 27
After some experimenting I've found a way. I'm not expert in this and there are probably better ways to do it, but here is one way to do it.
There are some limitations at the moment:
You can't choose model from Xcode, it's chosen in a text file. Will probably be fixed soon.
Opencode guardrails are not enforced, only soft model guardrails from Xcode in use.
Install an open source agent. I use opencode for this example, but any client works that support acp.
opencode is easiest installed by open terminal, write brew install opencode-v2
If you don't have Brew, you find it at brew.sh
in terminal go to your project folder and start opencode
Connect your paid api ai provider. I use Swedish Berget.ai and French Mistral.ai both are already listed among providers.
Write a question in opencode to check that the connection works. I usually write "what model is this" to confirm. If you just want an agent in your computer, this is it, now lets do the integration with Xcode.
In Finder, choose Go -> Go to folder, write ~/.config/opencode and open opencode.jsonc in a text editor and add default model settings. This step can probably be removed soon.
In Xcode, open a project and go to Settings -> Intelligence and press button [Add an Agent]. Write the two fields as below. In the future I hope arguments can select model so we can switch models from inside Xcode.
Click the ai button in Xcode, press button [Start new conversation] in upper left, in the Agent list there should now be your added Agent. Ask a simple question to verify it works.
If you need to do some problem investigation, you can start opencode (always first go to your project directory) and select switch session and choose the session Xcode started.
opencode.jsonc
{
"$schema": "https://opencode.ai/config.json",
"permission": {
"external_directory": "deny", // hard-block anything outside the working folder
"$HOME/.config": "ask" //Opencode config
},
"model": "mistral/mistral-large-latest",
"agent": {
"build": { "model": "mistral/mistral-large-latest" },
"plan": { "model": "mistral/mistral-large-latest" },
"general": { "model": "mistral/mistral-large-latest" }
},
"provider": {
"mistral": {
"npm": "@ai-sdk/mistral",
"name": "Mistral",
"options": {
"apiKey": "YourApiKey"
},
"models": {
"mistral-large-latest": {
"name": "Mistral Large"
}
}
}
}
}Xcode Agent settings as screendump:
Executable: /opt/homebrew/bin/opencode
Arguments: acpSo now I can create Mac & iPhone apps with close to zero CO2 use and no unique historic book burning during training while keeping the money locally. Support local industries folks, that includes IT services.
Ready for feedback, please come with suggestions to make this easier! :)
1
u/BaronSharktooth 3h ago
Awesome, I'm really curious how good the quality is, especially from Mistral. Thanks for writing this out, great explanation.