{"slug": "hybrid-llm-routing-on-iphone-local-models-plus-cloud-apis-with-shortcuts", "title": "Hybrid LLM routing on iPhone: local models plus cloud APIs with Shortcuts", "summary": "A developer built a hybrid LLM router inside Apple Shortcuts that keeps short or sensitive prompts on a local OpenAI-compatible model and sends longer requests to a cloud API, using a simple 200-character length check to branch between the two. The shortcut requires no Xcode or custom iOS app, relying on two HTTP request actions and a conditional, with the developer noting the API key stored in a shortcut should be treated as a low-limit throwaway credential and rotated if the phone is shared.", "body_md": "Most of the prompts I type on my phone are trivial — a quick rewrite, a two-line summary, a \"what does this mean\" question. Sending all of those to a paid cloud endpoint felt wasteful, and some of them contained things I would rather not upload at all. So I built a small router in Apple Shortcuts that keeps the light and sensitive requests on a local model and only sends the heavy lifting to a cloud API.\n\nNo Xcode, no full iOS app. Just Shortcuts, an HTTP request, and one length check.\n\nThe idea is simple: one shortcut, two branches.\n\nEverything happens inside Shortcuts, Apple's built-in automation app, which chains actions into a single runnable script. You can trigger it from the app, from Siri, or from the Share Sheet.\n\nBefore touching Shortcuts, make sure the pieces talk to each other:\n\n`http://127.0.0.1:8080/v1/chat/completions`. The port depends on your app.` sk-`) that identifies your account.\nMy checklist before I started:\n\nThat last item matters more than it sounds. Two \"OpenAI-compatible\" endpoints can still disagree on field names, and you will only find out at runtime.\n\nWrite the rule down before you build anything. Mine looked like this:\n\nThe 200-character threshold is a heuristic, not science. Short prompts are usually cheap and fast enough for a small on-device model. If yours handles more, raise the number.\n\n`Hybrid AI Router`. You get an empty canvas.` Summarize this note in three bullets: The meeting moved to Friday.` Later you can swap this for Shortcut Input when you run it from Siri or the Share Sheet.`Length` → `is less than` → `200`.\nYou now have two branches. A prompt like `What is 2+2?` is 8 characters, so it falls into the local branch. A request for a 500-word essay lands in the cloud branch. That is the whole routing logic — everything else is plumbing.\n\nInside the If branch:\n\n`POST`.` Content-Type: application/json`.\nThen add a **Request Body** in JSON. This template works for most local runtimes, since they tend to speak the OpenAI-compatible chat format:\n\n```\n{\n  \"model\": \"your-local-model\",\n  \"messages\": [\n    {\"role\": \"user\", \"content\": \"What is 2+2?\"}\n  ],\n  \"temperature\": 0.7\n}\n```\n\nReplace `your-local-model` with the model name your app reports. If your app ignores the model field, delete that line entirely. A correct run ends with your local app returning a JSON response that the shortcut can read.\n\nIn the **Otherwise** branch, add a second **Get Contents of URL**:\n\n`https://api.example.com/v1/chat/completions`.` model` field and the actual prompt in `content`.\nOne practical note: keeping the API key inside a shortcut is convenient but not a vault. Anyone with access to your unlocked phone can open the shortcut and read it. Treat a shortcut key as a low-limit throwaway credential, and rotate it if the phone is shared.\n\nDo not trust a single happy-path run. I tested by editing the Text action:\n\nIf the local branch fails, open the local URL in Safari first — if Safari cannot reach it, Shortcuts will not either. If the cloud branch fails, re-test the key from a desktop curl call to separate an auth problem from a shortcut problem.\n\nTwo things I would change next time: switching the Text action to Shortcut Input so the router works from Siri and the Share Sheet, and adding a fallback so a failed cloud call retries locally instead of just erroring out.\n\nYou do not need a custom app to get hybrid AI on an iPhone. A length check and two HTTP actions in Shortcuts are enough to keep cheap, private prompts on-device and spend cloud tokens only where they buy you something. Start with a crude rule like 200 characters, run both branches deliberately, and tune the threshold based on what your local model actually handles well. If you are still choosing which local model to run, AI Release also has beginner guides for running models locally on a PC and on Android — worth a read before you hardcode a gateway.\n\nThis article was originally published on AI Release — [https://ai-release.org](https://ai-release.org)\n\nMore practical AI guides and breakdowns: [https://t.me/ai_release1](https://t.me/ai_release1)", "url": "https://wpnews.pro/news/hybrid-llm-routing-on-iphone-local-models-plus-cloud-apis-with-shortcuts", "canonical_source": "https://dev.to/qunirice_verase_1ab0caeba/hybrid-llm-routing-on-iphone-local-models-plus-cloud-apis-with-shortcuts-26gj", "published_at": "2026-11-16 10:13:31+00:00", "updated_at": "2026-11-16 10:21:33.396813+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "ai-agents", "developer-tools"], "entities": ["Apple", "Shortcuts", "Siri", "OpenAI", "AI Release"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/hybrid-llm-routing-on-iphone-local-models-plus-cloud-apis-with-shortcuts", "markdown": "https://wpnews.pro/news/hybrid-llm-routing-on-iphone-local-models-plus-cloud-apis-with-shortcuts.md", "text": "https://wpnews.pro/news/hybrid-llm-routing-on-iphone-local-models-plus-cloud-apis-with-shortcuts.txt", "jsonld": "https://wpnews.pro/news/hybrid-llm-routing-on-iphone-local-models-plus-cloud-apis-with-shortcuts.jsonld"}}