How to use Google Gemini in Xcode 26 beta

Someone asked on Mastodon1 whether it’s possible to use Google’s Gemini in the new Xcode 26β on macOS 26 beta. It is!

Xcode 26, Settings, Intelligence tab, showing the Gemini entry, listing all available models

Well, with some creative proxy scripting, that is.

Google offers an OpenAI-compatible API for Gemini, and while working, it is not what Xcode expects in terms of URL layout. In Xcode’s LLM provider config, the custom “URL” parameter is the API’s base URL up to but not including the v1/ path segment, e.g. https://api.openai.com/ instead of the full https://api.openai.com/v1/. When making calls to the provider later on, Xcode will automatically append the endpoint path (e.g. v1/models etc.) to that URL.

Now, the Gemini URL structure breaks with the v1/ convention: its URL is https://generativelanguage.googleapis.com/v1beta/openai/ instead of https://generativelanguage.googleapis.com/v1/. You can see why this might be a problem.

Step 1: Setting up Gemini in Xcode

Go to Settings → Intelligence → Add a Model Provider, then fill out the form as follows:

  • Type: Internet Hosted
  • URL: https://generativelanguage.googleapis.com/
  • API Key: Bearer $apiKey (the latter being the actual API key)
  • API Key Header: Authorization
  • Description: Whatever, I set it to “Gemini”

Click “Save”, quit Xcode.

Step 2: Setting up request rewriting using Proxyman

It’s possible to transform the requests into the right shape using a local rewriting proxy. Here, I’m using the excellent Proxyman.2 Download and install it. (I won’t go into the details of the setup, as it’s both straightforward and well-enough documented on their website.)

(You could also use Proxygen for that; I just picked Proxyman because I’m familiar with it.)

Once it’s running, I made it proxy all app-level Xcode requests, then enabled and configured Proxyman’s scripting capabilities to rewrite the requests on the fly.

Proxyman script editor

The Proxyman script config

URL: https://generativelanguage.googleapis.com/v1/. Process all HTTP methods, and include all subpaths of this URL. Script:

function onRequest(context, url, request) {
  request.path = request.path.replace("/v1/", "/v1beta/openai/");
  request.color = 'yellow';
  return request;
}

This will rewrite any Gemini calls to /v1/… to the correct Google API path.

Step 3: Checking the list of Gemini models

Open Xcode again, go into Settings → Intelligence → Gemini. It should now display the list of available models:

Xcode 26, Settings, Intelligence tab, showing the Gemini entry, listing all available models

Step 4: Using Gemini in Xcode

For this, I created a new Swift app, went into the ContentView.swift, and told Gemini 2.5 Flash to “Make it German, add two buttons (“Much AI”, “So Gemini”)". And it did!

Screenshot of Xcode 26 after using gemini-2.5-flash

Caveats

  • Proxyman has to be active alongside Xcode for this procedure to work. This may or may not be desirable, depending on your machine and overall setup.
  • It’s possible that in future Xcode betas, Apple will allow more customization when it comes to LLM providers. Fingers crossed!

Hacker News discussion


Oh hello! Did you know I make pretty useful Shortcuts-related macOS & iOS apps, like …


  1. https://iosdev.space/@austinbond/114672153450134516 ↩︎

  2. Proxyman is free for what we’re doing right here! But it’s a good app well worth the money. It’s also part of a Setapp subscription↩︎

✍️ Reply by email     ⭐️ Also on micro.blog
Carlo Zottmann @czottmann