This project creates a proxy for OpenRouter that modifies API responses to work with Xcode 26 beta as a model provider. The proxy transforms OpenRouter responses to match OpenAI's format, which is required by Xcode's native AI integration.
/models
endpoint returns models in OpenAI format/chat/completions
endpoint proxies requests directly to OpenRouter- Containerized with Docker
- Standalone pre-compiled executable
- Create docker-compose.yml (already created in project)
- Start the service:
docker-compose up
To use a different host port (e.g., 9090):
HOST_PORT=9090 docker-compose up
- Build the Docker image:
docker build -t openrouter-proxy ./proxy
- Run the container:
docker run --rm -p ${HOST_PORT:-8080}:8080 openrouter-proxy
- Make the build script executable:
chmod +x build_executable.sh
- Build the standalone executable:
./build_executable.sh
- Run the executable (default port 8080):
./proxy/dist/app
To run on a different port (e.g., 9090):
PORT=9090 ./proxy/dist/app
DISABLE_SSL_VERIFY
: Set to 'true' to disable SSL verification (useful for debugging with proxies like Charles). Default: SSL verification is enabled.MODEL_FILTER_FILE
: Set to the absolute path of a text file containing allowed model IDs (one per line). If set, the/v1/models
endpoint will only return models whose IDs are in this file.
-
Setting > Intelligence > Add a Model Provider...
- URL: http://localhost:8080
- API Key: Bearer sk-...
- API Key Header: Authorization
- Description: OpenRouter
When using a debugging proxy like Proxyman, you might encounter SSL certificate verification errors. To resolve this:
- Set the
DISABLE_SSL_VERIFY
environment variable totrue
:
# For Docker Compose
DISABLE_SSL_VERIFY=true docker-compose up
# For standalone executable
DISABLE_SSL_VERIFY=true ./proxy/dist/app
- Trust Proxyman's root certificate in your system keychain (macOS):
- Open Proxyman
- Go to Certificate → Install Certificate on This Mac...
- Follow prompts to add to System keychain
- Open Keychain Access, find "Proxyman" certificate
- Double-click it, expand Trust, and set "When using this certificate" to "Always Trust"
Important Security Note: Disabling SSL verification should only be done for debugging purposes. Never use this in production environments as it makes connections vulnerable to man-in-the-middle attacks.
- Get models in OpenAI format:
GET http://localhost:8080/models
(include your OpenRouter API key in the Authorization header) - Use chat completions:
POST http://localhost:8080/chat/completions
with your request payload and Authorization header