Integration guide
Integration video
To get started you can follow the integration video, or follow the steps below.
Step 2
Create and configure a new project
Next create your first project. To configure your project click "Edit project settings" button and enter the required information.
Watch the video below to learn how to find your p8 file, DeviceCheck Key ID, and Apple Team ID.
Once you've filled out the required information, choose which proxy rules you want to enable and click "Save settings".
Step 3
Generate a new key
Now that your project is configured you can now create an AIProxy key by visiting the "Keys" tab in the dashboard. Enter a name and your OpenAI key and click the "Add new key" button.
Step 4
Add AIProxy to your app
At this point you're ready to start integrating AIProxy into your app. AIProxy is built right into SwiftOpenAI, an open-source Swift package for interacting with OpenAI's public API. Using this package is the easiest way to get set up quickly. Here's how:
- Add the SwiftOpenAI package to your Xcode project
- Initialize using the code generated on the key details screen.
If you’re not using the SwiftOpenAI package you can use the AIProxy.swift file and edit the placeholder constants with your aiproxyPartialKey and deviceCheckBypass values. For sample requests visit the Swift examples page.
Step 5
Configure Xcode for DeviceCheck
An integral layer of security for AIProxy is Apple's DeviceCheck. A successful DeviceCheck integration requires the following:
1. Your Apple developer team must be selected under the 'Signing & Capabilities' tab in Xcode
2. The bundle identifier of your app must be explicit (i.e. it can't contain a wildcard)
3. The bundle identifier of your app must be listed as an App Identifier
4. On MacOS, your signing certificate can't be set to 'Sign to Run Locally'