Skip to content

Xcode

Last updated View as MarkdownAgent setup

Xcode ↗︎ supports internet-hosted chat providers that use the OpenAI Chat Completions API. Point a chat provider at an AI Gateway custom domain protected by Cloudflare Access. Xcode authenticates with an Access service token stored as its API key.

This integration uses static credentials. Xcode cannot use cloudflared to generate short-lived Access tokens.

Prerequisites

Before you start, you need:

  1. In Xcode, go to Xcode > Settings > Intelligence.

  2. Under Chat, select Add a Chat Provider > Internet Hosted.

  3. Enter a name for the provider, such as AI Gateway.

  4. For URL, enter your AI Gateway custom domain followed by /compat.

    Replace ai.example.com with your custom domain.

    https://ai.example.com/compat

    Xcode appends /v1/models to list available models. It sends prompts to /v1/chat/completions. AI Gateway accepts both paths under the compat endpoint.

  5. For API Key, enter the following single-header service token value. Replace <CLIENT_ID> and <CLIENT_SECRET> with your Access service token values.

    {"cf-access-client-id":"<CLIENT_ID>","cf-access-client-secret":"<CLIENT_SECRET>"}
  6. Set API Key Header to Authorization.

  7. Select Add.

  8. Enable a model, then select it in the coding assistant and send a prompt. Requests now route through AI Gateway.

For more information about custom chat providers, refer to Setting up coding intelligence ↗︎.

To confirm traffic reaches AI Gateway, refer to Verify it works.

Was this helpful?