Apple Shortcuts Integration¶
Apple Shortcuts on macOS, iPhone, and iPad can call Backend.AI GO's local inference API directly using the built-in Get Contents of URL action. This lets you build system-wide automations such as translating selected text in any app, summarizing long articles from the clipboard or Share Sheet, and drafting message replies, all powered by models running on your own hardware.
Integration Methods Overview¶
Backend.AI GO provides three ways to interact with Apple Shortcuts depending on your platform and workflow:
| Method | Best For | Platforms | How It Works |
|---|---|---|---|
Management REST API (/api/v1/inference/chat/completions) | HTTP actions in Shortcuts (Get Contents of URL) | macOS, iPhone, iPad | Sends OpenAI-compatible JSON requests to the Management API inference proxy (default port 8001). Works out of the box on localhost without extra router setup. |
Continuum Router API (/v1/chat/completions) | Multi-model routing and OpenAI SDK clients | macOS, iPhone, iPad | Sends requests to the Continuum Router TCP server (default port 39080) after enabling Enable TCP server in Settings > API Server. |
aigo CLI (aigo chat, aigo translate) | Shell-based Shortcuts (Run Shell Script) | macOS only | Invokes the bundled aigo command-line tool from a macOS Shortcut without constructing JSON payloads by hand. |
URL Scheme (aigo://) | Launching Backend.AI GO or deep-linking into setup flows | macOS | Opens the Backend.AI GO desktop app or pre-fills node connection and enterprise enrollment dialogs (aigo://enroll?...). It does not return inference output to a Shortcut. |
For most Shortcuts that work across both Mac and iPhone or iPad, use the Get Contents of URL action with the Management REST API (POST /api/v1/inference/chat/completions).
Prerequisites and Setup¶
Before building a Shortcut, verify the following requirements in Backend.AI GO:
- Load a model: Open the Models page in Backend.AI GO, download a model (for example, a Qwen or Llama instruct model), and click Run so the inference server is active. Note the exact model ID shown on the card.
- Verify Management API status: Open Settings > API Server > Management API. The Management API runs on
http://127.0.0.1:8001by default. -
Check authentication settings:
- Same Mac (
127.0.0.1): While Require API key is off (the default on localhost), local Shortcuts can callhttp://127.0.0.1:8001/api/v1/inference/chat/completionswithout an authentication header. - API key enabled or remote devices: When Require API key is on, open Settings > API Server > Access keys, create a key with the
Inference WriteandInference Readscopes, and pass it in theX-API-Keyheader (orAuthorization: Bearer <your-key>).
- Same Mac (
-
Use non-streaming requests: Apple Shortcuts' Get Contents of URL action waits for a single complete HTTP response and cannot parse Server-Sent Events (SSE) token streams. Always set
"stream": false(or omit the"stream"field, which defaults tofalse).
Management API vs. Continuum Router Port
The Management API listens on port 8001 by default and exposes the inference proxy at POST /api/v1/inference/chat/completions. If you prefer to call the Continuum Router directly on port 39080 (POST /v1/chat/completions), turn on Enable TCP server in Settings > API Server first. Both endpoints accept the same OpenAI chat completions JSON format.
Testing with curl¶
Before assembling actions in the Shortcuts app, test your endpoint and model name from the terminal using curl.
1. Check Server Health and Loaded Models¶
Verify that the Management API is reachable and your model is listed:
# Check Management API health
curl http://127.0.0.1:8001/api/v1/health
# List models available through the inference proxy
curl http://127.0.0.1:8001/api/v1/inference/models
If Require API key is enabled, include -H "X-API-Key: YOUR_ACCESS_KEY" in each command.
2. Send a Basic Chat Completion Request¶
curl http://127.0.0.1:8001/api/v1/inference/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen2.5-7b-instruct",
"messages": [
{"role": "user", "content": "Say hello in Korean."}
],
"stream": false
}'
3. Test with a System Prompt and Generation Parameters¶
You can control output length and creativity using system messages, temperature, and max_tokens:
curl http://127.0.0.1:8001/api/v1/inference/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen2.5-7b-instruct",
"messages": [
{
"role": "system",
"content": "You are a concise translator. Translate the user text into English and return only the translation."
},
{
"role": "user",
"content": "로컬 LLM을 사용하면 개인정보를 안전하게 보호할 수 있습니다."
}
],
"temperature": 0.2,
"max_tokens": 256,
"stream": false
}'
Sample JSON Response:
{
"id": "chatcmpl-8f3a9b2c",
"object": "chat.completion",
"created": 1710000000,
"model": "qwen2.5-7b-instruct",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Using a local LLM keeps your personal information safe."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 38,
"completion_tokens": 12,
"total_tokens": 50
}
}
In every Apple Shortcut below, you will extract the assistant's reply from choices -> first item -> message -> content.
Step-by-Step Shortcuts Examples¶
Example 1: Translate Selected Text¶
This Shortcut takes text selected in any macOS app (via Quick Actions / Services) or shared via the iOS Share Sheet, translates it locally, and copies or displays the result.
Action Sequence¶
- Create a new Shortcut and name it Translate with Local AI.
-
Configure input:
- On macOS: Click the Shortcut details (i) icon, enable Use as Quick Action, enable Services Menu, and set the input type to Receive Text input from Quick Actions (if there is no input: Ask for Text).
- On iPhone / iPad: Enable Show in Share Sheet and accept Text.
-
Add a Get Contents of URL action and configure it as follows:
| Field | Value |
|---|---|
| URL | http://127.0.0.1:8001/api/v1/inference/chat/completions |
| Method | POST |
| Headers | Content-Type: application/jsonX-API-Key: YOUR_ACCESS_KEY (only if API key authentication is enabled) |
| Request Body | JSON |
-
Inside the Get Contents of URL JSON body, add the following keys (or build the payload with a Dictionary action first; see Safely Escaping Input Text below):
model(Text):qwen2.5-7b-instruct(replace with your loaded model ID)temperature(Number):0.2max_tokens(Number):1024stream(Boolean):false-
messages(Array of 2 Dictionaries):- Item 1 (Dictionary):
role=system,content=You are a professional translator. Translate the user's text into Korean. Output only the translated text without explanations. - Item 2 (Dictionary):
role=user,content= Shortcut Input variable
- Item 1 (Dictionary):
Equivalent JSON payload structure:
{
"model": "qwen2.5-7b-instruct",
"messages": [
{
"role": "system",
"content": "You are a professional translator. Translate the user's text into Korean. Output only the translated text without explanations."
},
{
"role": "user",
"content": "<Shortcut Input>"
}
],
"temperature": 0.2,
"max_tokens": 1024,
"stream": false
}
-
Add the response-parsing actions right after Get Contents of URL:
- Get Dictionary Value: Get
ValueforchoicesinContents of URL. - Get Item from List: Get
First ItemfromDictionary Value. - Get Dictionary Value: Get
ValueformessageinItem from List. - Get Dictionary Value: Get
ValueforcontentinDictionary Value.
- Get Dictionary Value: Get
-
Add Copy to Clipboard and Show Result (passing the final
Dictionary Value) so you can see the translation immediately and paste it anywhere.
Example 2: Summarize Messages or Clipboard¶
This Shortcut reads long text from the clipboard (or Share Sheet), summarizes it into key bullet points, and displays the summary in a notification alert.
Action Sequence¶
- Create a new Shortcut named Summarize Clipboard.
- Add Get Clipboard (or accept Text from the Share Sheet).
-
Add Get Contents of URL with:
- URL:
http://127.0.0.1:8001/api/v1/inference/chat/completions - Method:
POST - Headers:
Content-Type: application/json - Request Body:
JSON
- URL:
Equivalent JSON payload structure:
{
"model": "qwen2.5-7b-instruct",
"messages": [
{
"role": "system",
"content": "Summarize the following text into 3 to 5 concise bullet points. Focus on key facts and action items."
},
{
"role": "user",
"content": "<Clipboard>"
}
],
"temperature": 0.3,
"max_tokens": 512,
"stream": false
}
-
Extract the summary text using the same four actions:
- Get Dictionary Value ->
choicesfromContents of URL - Get Item from List ->
First Item - Get Dictionary Value ->
message - Get Dictionary Value ->
content
- Get Dictionary Value ->
-
Add Show Result (with the final
Dictionary Value) to display the bulleted summary on screen.
Example 3: Draft a Reply¶
This Shortcut takes an incoming message, prompts you briefly for how you want to respond, generates a polished reply locally, and copies the draft to your clipboard.
Action Sequence¶
- Create a new Shortcut named Draft Reply with Local AI.
- Add Get Clipboard (or receive text from Quick Actions / Share Sheet) and add Set Variable to store it as
OriginalMessage. - Add Ask for Input with prompt
"What is your main point or desired tone?"(for example,"Politely decline and suggest next Tuesday"), and add Set Variable to store it asReplyIntent. -
Add Get Contents of URL with:
- URL:
http://127.0.0.1:8001/api/v1/inference/chat/completions - Method:
POST - Headers:
Content-Type: application/json - Request Body:
JSON
- URL:
Equivalent JSON payload structure:
{
"model": "qwen2.5-7b-instruct",
"messages": [
{
"role": "system",
"content": "You write clear, polite message replies. Draft a ready-to-send reply to the original message following the user's intent. Output only the reply body."
},
{
"role": "user",
"content": "Original message:\n<OriginalMessage>\n\nMy reply intent:\n<ReplyIntent>"
}
],
"temperature": 0.5,
"max_tokens": 512,
"stream": false
}
-
Parse the response:
- Get Dictionary Value ->
choicesfromContents of URL - Get Item from List ->
First Item - Get Dictionary Value ->
message - Get Dictionary Value ->
content
- Get Dictionary Value ->
-
Add Copy to Clipboard and Show Notification (or Quick Look) so you can review and paste the drafted reply.
macOS Alternative: Using Run Shell Script with the aigo CLI¶
On macOS, you can skip HTTP and JSON parsing altogether by using the Run Shell Script action with the bundled aigo CLI:
- Add the Receive Text input action.
- Add Run Shell Script (Shell:
/bin/zsh, Pass Input: as stdin). - Use
aigo chatwith a system prompt:
input_text="$(cat)"
aigo chat --system "Translate the user's text into Korean. Output only the translation." "$input_text"
- Add Show Result or Copy to Clipboard.
See the CLI Reference for all aigo chat and aigo translate flags.
Using Shortcuts on iPhone and iPad¶
On an iPhone or iPad, 127.0.0.1 and localhost refer to the mobile device itself, not your Mac. Because Backend.AI GO binds its API servers to 127.0.0.1 by default, mobile Shortcuts cannot reach your Mac until you configure network access.
You have two ways to connect your iPhone or iPad to Backend.AI GO running on your Mac.
Option 1: Local Wi-Fi (LAN Binding)¶
Use this option when your Mac and your iPhone or iPad are on the same trusted home or office Wi-Fi network.
- On your Mac, open Backend.AI GO and go to Settings > API Server > Access keys.
- Click Create Key, give it a name (such as
iPhone Shortcuts), select the Inference Read and Inference Write scopes, and copy the generated key. -
Go to Settings > API Server > Management API:
- Turn on Require API key.
- Turn on Allow access from other devices (this binds the Management API to
0.0.0.0on port8001).
-
Find your Mac's local LAN IP address in macOS System Settings > Wi-Fi > Details (for example,
192.168.1.50). -
In your iPhone or iPad Shortcut, update the Get Contents of URL action:
- URL:
http://192.168.1.50:8001/api/v1/inference/chat/completions - Headers: Add
X-API-Key: <your-access-key>
- URL:
Using the Continuum Router Port Instead
You can also point your iPhone or iPad at the Continuum Router (http://192.168.1.50:39080/v1/chat/completions) by enabling Enable TCP server and Allow external access in Settings > API Server. Enabling external access on the router automatically requires an access key with Inference Read or Inference Write. See External Access for full details.
Option 2: Tailscale or WireGuard VPN (Recommended)¶
If you use your iPhone or iPad away from home, or on networks where client isolation blocks device-to-device LAN traffic, a mesh VPN such as Tailscale provides encrypted access without opening ports on your router:
- Install Tailscale on both your Mac and your iPhone or iPad, and sign in to the same Tailnet.
- In Backend.AI GO on your Mac, enable Require API key and Allow access from other devices under Settings > API Server > Management API, and issue an access key with Inference Write.
- Copy your Mac's Tailscale IPv4 address (
100.x.y.z) or MagicDNS hostname from the Tailscale menu bar app. - In your Shortcut on iPhone or iPad, set the URL to
http://100.x.y.z:8001/api/v1/inference/chat/completionsand include theX-API-Keyheader.
Security Considerations for Remote Access¶
- Always require an API key: Backend.AI GO prevents enabling Allow access from other devices on the Management API unless Require API key is turned on.
- Use least-privilege scopes: Create a dedicated key for Shortcuts with only
Inference ReadandInference Writerather thanAdmin. - Do not expose ports to the public internet: Avoid port-forwarding port
8001or39080on your home router. Use Tailscale or a VPN when connecting from outside your local network. - Rotate compromised keys: If a Shortcut containing a hardcoded API key is shared with someone else, revoke that key immediately in Settings > API Server > Access keys.
Tips and Troubleshooting¶
Safely Escaping Input Text¶
When input text from the clipboard or selection contains double quotes (") or line breaks, inserting it into a raw text JSON block can break JSON syntax. By building the request body with native Dictionary fields inside Get Contents of URL (setting the body type to JSON and inserting the Shortcut Input token into the content field of the dictionary), Apple Shortcuts automatically JSON-escapes quotes, backslashes, and newlines for you.
Checking Server Status Before Running¶
If you want your Shortcut to fail gracefully with a friendly message when Backend.AI GO is not running or no model is loaded, add a quick check at the top of the Shortcut:
- Call Get Contents of URL on
http://127.0.0.1:8001/api/v1/inference/status(or/api/v1/inference/models). - Check whether
runningistrue(or whether thedatalist is non-empty) using Get Dictionary Value and an If action before sending the chat completion request.
Model Size and Performance Expectations¶
Shortcuts run interactively, so response latency matters:
- Small models (1B to 4B parameters): Respond in 1 to 3 seconds on Apple Silicon Macs. Ideal for quick text translations and short replies.
- Medium models (7B to 14B parameters): Offer stronger summarization quality and nuanced drafting, typically completing within 3 to 10 seconds depending on input length.
- Large or reasoning models (30B+ or thinking models): Can take 15 seconds or longer to finish generating a complete non-streaming response. Keep
max_tokensbounded (for example,512) so Apple Shortcuts does not time out waiting for the HTTP response.
Common Issues¶
| Problem | Cause | Solution |
|---|---|---|
Could not connect to the server | Backend.AI GO is not running, the wrong port is used, or iPhone/iPad is calling 127.0.0.1. | Verify Backend.AI GO is running. On Mac, use port 8001 (Management API) or enable the TCP server on 39080. On iPhone/iPad, use your Mac's LAN or Tailscale IP and enable Allow access from other devices. |
401 Unauthorized or 403 Forbidden | API key authentication is enabled, or the key lacks the required scope. | Create an access key with Inference Write in Settings > API Server > Access keys and pass X-API-Key: <your-key> in Headers. |
No model loaded / Model not found (404 or 503) | No model is currently running, or the "model" string in the Shortcut does not match the loaded model ID. | Start a model on the Models page and check curl http://127.0.0.1:8001/api/v1/inference/models for the exact id value. |
Output contains raw data: {"id":...} lines instead of a dictionary | The request enabled SSE streaming ("stream": true), which Shortcuts cannot parse as a single JSON object. | Set "stream": false in the JSON request body. |
The data couldn't be read because it isn't in the correct format | Input text contained unescaped quotes or newlines inside a raw text body, or the server returned an error response. | Use the native JSON builder in Get Contents of URL instead of a raw text block, and inspect the raw output of Contents of URL with Quick Look to see the server's error message. |
Related Pages¶
- API Server Overview: Overview of the Management API and Continuum Router
- External Access: Safely exposing the API server to other devices on your network
- Building Apps with the API: Using the OpenAI-compatible API with Python, TypeScript, and curl
- Private Document Translation: Translating text and documents locally
- CLI Reference: Full documentation for the
aigocommand-line tool