Xcode

Using OpenRouter with Apple Intelligence in Xcode

Using Xcode with Apple Intelligence

Apple Intelligence in Xcode 26 provides built-in AI assistance for coding. By integrating OpenRouter, you can access hundreds of AI models directly in your Xcode development environment, going far beyond the default ChatGPT integration.

This integration allows you to use models from Anthropic, Google, Meta, and many other providers without leaving your development environment.

Prerequisites

Apple Intelligence on Xcode is currently in Beta and requires:

Setup Instructions

Step 1: Access Intelligence Settings

Navigate to Settings > Intelligence > Add a Model Provider in your macOS system preferences.

Xcode Intelligence Settings

Step 2: Configure OpenRouter Provider

In the “Add a Model Provider” dialog, enter the following details:

  • URL: https://openrouter.ai/api
    • Important: Do not add /v1 at the end of the endpoint like you typically would for direct API calls
  • API Key Header: api_key
  • API Key: Your OpenRouter API key (starts with sk-or-v1-)
  • Description: OpenRouter (or any name you prefer)

Click Add to save the configuration.

OpenRouter Configuration

Step 3: Browse Available Models

Once configured, click on OpenRouter to see all available models. Since OpenRouter offers hundreds of models, you should bookmark your favorite models for quick access. Bookmarked models will appear at the top of the list, making them easily accessible from within the pane whenever you need them.

Available Models

You’ll have access to models from various providers including:

  • Anthropic Claude models
  • Google Gemini models
  • Meta Llama models
  • OpenAI GPT models
  • And hundreds more

Extended Model List

Step 4: Start Using AI in Xcode

Head back to the chat interface (icon at the top) and start chatting with your selected models directly in Xcode.

Xcode Chat Interface

Using Apple Intelligence Features

Once configured, you can use Apple Intelligence features in Xcode with OpenRouter models:

  • Code Completion: Get intelligent code suggestions
  • Code Explanation: Ask questions about your code
  • Refactoring Assistance: Get help improving your code structure
  • Documentation Generation: Generate comments and documentation

Apple Intelligence Interface

Image credit: Apple Developer Documentation

Learn More