This guide shows you how to set up hybrid AI routing on an iPhone: short or private prompts stay on a local model, while heavy or complex requests go to a cloud API. It is for iPhone users who already have a local AI app and a cloud provider account, and who want to avoid sending every request to the cloud. The steps use Apple Shortcuts, a built-in automation app, so you do not need to write a full iOS app. If you only want to test local models first, read How to run AI models locally on your PC: a beginner's guide. For Android, see How to Run an AI Model Locally on Android: Apps and Setup.
- [ ] Shortcuts app opens.
- [ ] Local app responds in Safari at your local URL.
- [ ] Cloud API key works in a desktop test (curl or provider console).
- [ ] You know the exact JSON field names your providers expect.
1. Open Shortcuts and create a new shortcut. Tap +, then name it "Hybrid AI Router". Expected result: an empty shortcut canvas. Shortcuts is Apple's automation app; it chains actions together.
2. Add a "Text" action. Type a sample prompt, for example: "Summarize this note in three bullets: The meeting moved to Friday." Expected result: the Text action holds your prompt. You will replace this with Shortcut Input later if you use Siri or the Share Sheet.
3. Add an "If" action to check the prompt. First add "Get Length of Text" and set its input to the Text action. Then add "If" > "Length" > "is less than" > 200. Expected result: the shortcut has two branches: short prompts and long prompts. Why: short prompts are usually cheap and fast enough for a local model.
Example:If the prompt is "What is 2+2?", the length is 8, so the local branch runs. If the prompt is a 500-word essay request, the cloud branch runs.
4. Build the local branch. Inside the "If" branch, add "Get Contents of URL". Set URL to your local endpoint, for example `http://127.0.0.1:8080/v1/chat/completions`. Set Method to POST. Add header `Content-Type: application/json`. Expected result: Shortcuts will send an HTTP POST request to your local app. Why: most local runtimes speak the same OpenAI-compatible chat format.
Use this JSON body as a template:
{
"model": "your-local-model",
"messages": [
{"role": "user", "content": "What is 2+2?"}
],
"temperature": 0.7
}Replace "your-local-model" with the model name your app reports. If your app does not require a model name, remove that line. Expected result: the local app returns a JSON response.
5. Build the cloud branch. In the "Otherwise" branch, add another "Get Contents of URL". Set URL to your cloud endpoint, for example `https://api.example.com/v1/chat
Status: practical guide. Some statements come from vendors; verify in your environment.
Machine data: Citation Map JSON · JSON-LD · Semantic Embeddings — separate stage.
| Entity | Type | Role |
|---|---|---|
| локальная модель на iPhone | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| on-device AI iPhone | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| HybridRouter iOS | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| Apple Intelligence или ChatGPT | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| гибридный роутинг LLM | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| iOS | платформа/технология | упоминается в заголовке, TL;DR или разделах гайда |
| Apple | компания | упоминается в заголовке, TL;DR или разделах гайда |
No independent confirmation is provided; source claims and editorial conclusions are separated below.
| Source | Type | Role |
|---|---|---|
| api.example.com | внешний источник | ссылка из тела гайда |
Cite as: AI Release. Локальная модель или облако на iPhone: как настроить гибридный роутинг ИИ-запросов. ai-release.org.