GET /api/v1/connections
Session auth only. A platform API key gets403.
Two servers answer the same path:
- cloud-api returns the account’s rows.
- allternit-api on the active computer returns the rows that live on that computer, with
source: "runtime:<runtime_id>".
id only when its state is on.
Clients ignore ids they don’t know. An id missing from the response falls back to the client catalog with
state: "off".
Rows from cloud-api
A client that does not send
caps=runner gets available: false on the four plan rows, reason “Update the app to connect this plan.”, reason_code update_app, and the vendor’s key row as the fallback. Everyone gets available: false with “Not available yet. Use a key for now.” (not_available_yet) when the server kill switch is off or the vendor is not on the server’s vendor list.
Coding tools and the local brain are available: false on cloud-api when no computer is online, with the reason “Runs on a computer.” and the fallback this-mac. Their live state comes from the runtime.
Rows from allternit-api (a computer’s runtime)
GET /api/v1/connections/catalog
The “More” list in Settings → Connections: brains and apps you can add beyond the rows the page always shows. Served by cloud-api only, so it answers with no computer. Session auth only, as forGET /api/v1/connections: a platform API key gets 403, no session gets 401. The web app sends X-Allternit-Route: cloud.
Query parameters (all optional):
groupisnullwhen the request had none;qisnullwhen it was empty.totalcounts the entries that matchqandgroup.countsgives every group’s total afterq, ignoringgroup, so onelimit=0call tells a client which groups have a More tile.next_cursorisnullon the last page (and always withlimit=0).- A page is sent with
Cache-Control: private, max-age=300.
- brains: one entry per cloud key row (
openai-key,anthropic-key,google-key,xai-key,together-key,fireworks-key,deepinfra-key,groq-key,deepseek-key,kimi-key,openrouter-key). Name “Vendorkey”, blurb “Your own API key”,ways: ["paste"],runs_on: "server",key_pageset, alwaysavailable. Connect opens the key sheet and submits toPOST /api/v1/connections/{id}/submit. - apps: the connector snapshot committed in cloud-api (
cmd/allternit-cloud-api/src/services/connections_catalog_apps.json, made byservices/open-connector/scripts/export-directory.ts).connector_idequalsid. Apps signed in with a key or custom credential haveways: ["paste"]; every other app (OAuth, Composio, no sign-in) hasways: ["oauth"]. An empty blurb is the category. Apps run on a computer: while the account has a computer online they areavailable: true; otherwiseavailable: false,unavailable_reason: "Runs on a computer.",fallbacks: ["this-mac"]. Connect goes to/api/v1/connectors/{connector_id}/connecton the gateway. - computers, phones, tools, voice, channels: empty. Every id in those groups is already a row on the page.
catalog is a reserved connection id. Clients also hide entries whose first way they can’t run and entries already on the page. An entry connected from More is promoted into its group’s main list as a normal row. If the call fails, clients hide the More tiles.
Catalog version 2
The reply’sversion is 2. Every addition is optional, so a client that ignores them still parses.
New fields on an entry (left out when empty, except the three flags):
Skills group.
group=skills lists skills that belong to an app, one entry per skill, each with app_id. A skill whose app_id matches no app is dropped. The group is empty until cloud skills can be installed; the Catalog’s Skills tab also lists Allternit’s own installable skills from the app.
Filters. category, interactive and sort (table above) apply on top of group and q. counts and total follow the filters, so a tab’s badge matches what it lists.
GET /api/v1/connections/catalog/:id
One entry, for the Catalog’s detail page.404 {"error": "not_found"}. Auth and the X-Allternit-Route: cloud header are the same as for the list.
Errors:
Actions
Clients poll
/login every 2 seconds and stop on done, expired or failed.
The login object
Keys
- A key is checked with the vendor before it is stored: OpenAI
GET /v1/models; AnthropicGET /v1/modelswithx-api-keyandanthropic-version; GoogleGET /v1beta/models?key=; xAIGET /v1/models; OpenRouterGET /api/v1/key. - A
401from the vendor sets the row toneedswithkey_rejected. - Keys are stored with AES-GCM through
CredentialCipher, the same pattern asinference_keys.rs. - The API never returns a key, only a masked tail.
Logins on a computer
connect for codex, grok-cli, kimi-cli and claude-code reuses start_login_with_env in cli_tools.rs and the login_remote argv. The runtime polls the tool’s own status and reports it from /login.
Plan runner rows
claude, chatgpt, grok and kimi run on a private box per person on an Allternit server. The box runs the vendor’s command-line program, the person signs in to the vendor themselves, and only messages the person sends go to it. Send GET /api/v1/connections?caps=runner to get these rows as available. Unknown caps values are ignored.
On these rows:
States:
connecting while the box wakes or a sign-in is pending; on with found set to the plan when known; needs with login_expired or vendor_limited; could_not_start when the box fails to create.
The sign-in kind per vendor: Codex device_code; Grok device_code with url_with_code; Claude link_paste; Kimi device_code if its program offers one, otherwise link_paste.
For chatgpt, the row from an online computer that reports state: "on" wins over the runner row. On Desktop, the iPhone app and Gizzi Code, a device sign-in (below) comes first.
Connect and the disclosure step
POST /api/v1/connections/{id}/connect on a plan row takes an optional body:
title and body carry the vendor’s display name. Show the text as given and never a copy of your own. When the person declines, open the key sheet and send nothing. Accepting stores the account, vendor, version and time; the record is kept when the vendor is disconnected and erased with the account. submit and login for a vendor with no stored acceptance return the same 409.
DELETE /api/v1/connections/{id} on a plan row returns 204 after the sign-out on the box, the deletion of that vendor’s sign-in files, and the removal of the row’s state. When it was the person’s last vendor, the box is destroyed. A failed sign-out still deletes the files and returns 204.
Chat with a plan model
A plan model id isplan/<vendor>/<model>, for example plan/claude/sonnet. These ids are not in the model catalog and GET /v1/models does not list them; take them from the models field of a row that is on. Send the turn to POST /v1/chat/completions as for any cloud model, with stream: true for OpenAI-compatible deltas. The server sends the messages you supply on every turn; there is no session to resume.
Set the header X-Allternit-Turn: person only on a message the person sent from the composer. The server removes tools and tool_choice before the turn runs, and replies carry no tool calls.
Plan turns are not metered against Allternit credits. A
developer message is sent as system. After the turn, save the chat with the plan chat store so it syncs to the person’s other devices with no computer. Errors after a streamed turn starts arrive as one data: {"error":{…}} line, then data: [DONE]; without streaming they are 409 login_expired, 409 vendor_limited, 504 no_reply, 502 vendor_failed or 502 could_not_start. Each carries a message to show as it is: vendor_limited when the vendor refused the plan (no active subscription, or its limit is used up), no_reply when the vendor’s program sent nothing for 60 seconds, and vendor_failed for any other vendor error. could_not_start means the box itself failed.
ChatGPT sign-in on the person’s device
On Desktop (through Gizzi Code, the engine under it), the iPhone app and Gizzi Code, ChatGPT uses OpenAI’s open-source Sign in with ChatGPT on the device. Nothing is sent to cloud-api: the tokens stay in the device’s keystore and chat goes from the device to OpenAI. The Desktop runtime’schatgpt row (runs_on: "computer") starts the sign-in with login.kind browser_redirect and reports its status. The disclosure text shows before the first connect, and the acceptance is recorded on the device. Model ids are chatgpt/<model>, separate from plan/chatgpt/<model>. A usage limit from OpenAI shows as Needs you · ChatGPT limit reached. These models follow the same person-only, chat-only, no-tools rules.
Plan chat store
Chats with plan (plan/<vendor>/<model>), Copilot (copilot/<model>) and, with no computer, Allternit Cloud (allternit/<alias>) models are saved on cloud-api so they sync across the person’s devices with no computer. The turn itself goes to POST /v1/chat/completions; afterwards the client saves the person’s message and the reply here. These routes need a signed-in session (an API token gets 403, none gets 401), are scoped to that person (another person’s thread is 404), never need a computer, and are erased with the account.
msgis{ "role": "user" | "assistant" | "system", "content": string, "model"?: string }. Content is up to 200,000 characters. Any other role, such astool, is400. A stored message also hasat, an ISO 8601 UTC time set by the server.- A summary is
{ "id", "title", "model", "message_count", "created_at", "updated_at", "project_id" }.project_idis null when the thread is in no project. Ids start withpth_. modelon create must be aplan/…,plan-…orcopilot/…id, orallternit/<alias>where the alias is in the Cloud catalog (GET /v1/models, hidden aliases included), otherwise400. For exampleallternit/glm-5.3is accepted andnopeis not.- An
allternit/<alias>thread records a chat with an Allternit Cloud model from an account with no computer. The client sends the turn toPOST /v1/chat/completionswith the bare alias (glm-5.3, withoutallternit/), which needs Cloud credits (see Chat Completions). With a computer connected, Cloud model chats go through the computer and are not stored here. A title is cut to 200 characters. A thread holds at most 5,000 messages. project_idon create ties the thread to one of your own account projects, such as a chat-only bot. It must be your project and not deleted, otherwise400. Deleting a bot project deletes its threads too.- Deleting a thread is not in this version.
GitHub Copilot
copilot is a server row that signs in with a GitHub App (allternit-copilot-connect) user token. It is available: true only when the server has ALLTERNIT_COPILOT_CLIENT_ID, ALLTERNIT_COPILOT_CLIENT_SECRET and ALLTERNIT_CREDENTIALS_KEY set. Without them it stays “Coming soon.” and connect returns 409 not_available. It carries person_only: true and no disclosure; the GitHub consent screen is the consent.
no_copilot means the GitHub account has no Copilot; the grant is revoked and nothing is stored. While on, found is “GitHub · @login” and models are the account’s Copilot chat models as copilot/<id>, read once at sign-in. The row is needs with login_expired when GitHub refuses the refresh token. The tokens are stored encrypted with CredentialCipher and erased with the account.
Chat uses POST /v1/chat/completions with a copilot/<model> id and X-Allternit-Turn: person. The same refusals apply as for plan models (plan_person_only, plan_no_tools, plan_rate at 20 turns in 5 minutes, plan_turn_in_flight, plan_not_connected). Copilot adds 409 login_expired, 409 vendor_limited, 400 model_not_available and 502 could_not_start. Copilot turns are not metered, and tools are off.
Reason codes
The kit’s routes never call
require_compute. On allternit-api, design_connector_routes.rs already matches a /connections path, so smoke-boot the server after a change to either route.
Older endpoints and Desktop bridge
The rest of this page covers endpoints that still back parts of Settings → Connections: route telemetry for an app’s ways, the gateway catalog, CLI auth status, and the phone-link open-app, check-app and read-account calls. They were the sources of the earlier four-tab page.Route telemetry: GET /v1/routes
GET /api/v1/subscriptions/gateway/v1/routes is the route router view described in Subscription gateway › Route router. Each route row can carry a telemetry object:
The numbers are computed when the request is read, from the gateway’s
task_attempts and canary_runs tables, for the adapters that implement the route. Nothing is estimated: a route with no rows behind it gets nulls and tasks7d: 0. telemetry is left out entirely when nothing serves the route (no adapter and no linked phone), so the UI never shows a row of zeros for a way that doesn’t exist.
“Used first” in the UI is the vendor’s boundRoute, and “Pin” is PUT /v1/routes/:vendor/override with { "route": "<id>" } (clear it with { "route": null }). A pin must be eligible, otherwise 400 route_not_eligible.
Gateway catalog: GET /v1/gateway/catalog
Returns the vendor and bot-project catalog that Bots & channels and the app rows are built from, fromcmd/allternit-api/assets/gateway-catalog.json (the file’s only copy).
Two servers answer it from that one file. On the user’s computer, allternit-api answers GET /api/v1/gateway/catalog. On the web, cloud-api answers the same path itself and does not relay it, so ai.allternit.com and the PWA get the current catalog even when the paired computer runs an older runtime.
Response:
packs are the vendors a person can connect, with one profiles entry per way to connect. botProjects are third-party bot projects Allternit tracks; status and identity say how far each one is (a planned, unverified project is listed but not connectable). The catalog is data: add a vendor by editing the JSON, not the UI.
Coding tools: GET /api/v1/providers/auth/status?kind=cli
The Coding tools tab lists only CLI brains.kind=cli limits GET /api/v1/providers/auth/status to CLI rows; each row has its status (not_installed when the binary isn’t on the computer) and an install object {available, requiresTerms, license, termsUrl, pin}. Local models are listed under Settings → Models and API-key providers under Settings → API Keys, so they are not in this response.
Desktop IPC: phone-link:open-app and phone-link:check-app
Allternit Desktop exposes two calls onwindow.allternit.phoneLink for the connect wizard. Both take the linked phone’s deviceId (from phoneLink.devices()) and the app’s catalog id (id in surfaces/allternit-desktop/src/main/phone-app-catalog.json, such as chatgpt or slack). On web, the phone layout and the PWA, and on older Desktop builds, the functions are absent; the wizard checks for them first.
-
openApp(IPCphone-link:open-app) opens the app on the phone so the person can sign in there. It maps the catalog id to the iPhone bundle ids (ios) or Android packages (android) and launches through the same Phone Link lane as thephone.open_appbot tool (iCTRLlaunch_app). It always answerssignedIn: null. -
checkApp(IPCphone-link:check-app) opens or foregrounds the app, waits for it to draw, reads its screen through the same path asphone.screen_text(falling back tophone.read_ui), and decides:falsewhen a sign-in screen is showing: a whole label such as “Sign in”, “Log in”, “Sign up”, “Create account” or “Continue with Google”. This wins over everything else, because some apps show their main screen and a “Log in” button while signed out.truewhen the app’s main screen is showing: for the AI chat apps (catalog categoryAI chat), the chat composer (“Message ChatGPT”, “Ask anything”, “New chat”); for other apps, main-screen labels for their category (for example “Inbox” for email, “Direct messages” for chat apps), or a “Sign out” / “Log out” control.nullotherwise. It looks a second time before answeringnull.
accountis an email address or an@handlethat is shown on the screen, only whensignedInis notfalse; otherwisenull. The result is saved on the phone’s cached app list, sophoneLink.devices()reports the app’ssignedInuntil the next check.
surfaces/allternit-desktop/src/main/phone-app-signin.ts.
not_installed is reported only when the phone’s own app list doesn’t have the app, or every launch attempt said the app is missing. Other launch failures (accessibility off, locked, offline, or the phone refusing to start the app) come back as their own code and message.
Desktop IPC: phone-link:read-account
window.allternit.phoneLink.readAccount({ deviceId, app }) (IPC phone-link:read-account) checks any catalog app on a linked phone: whether it is signed in, which account, and the plan and usage windows when the app shows them. Like the wizard calls, it is absent on web, the phone layout, the PWA and older Desktop builds.
- Every read starts with the sign-in check (
classifySignInon the app’s first screen, one more look while it is still drawing). A sign-in screen ends the read withsignedIn: false, and the app record’s account, plan and usage are cleared. - Apps with navigation specs in
surfaces/allternit-desktop/src/main/phone-account-specs.tsthen walk them. A spec is a list of paths; each path is a series of taps, each with candidates: a whole label,id:<accessibility or resource id>, orre:<pattern>for a label that carries the person’s name (Discord’s “<name>, Online”). A tap step withscroll: nswipes up at most n times looking for its row. A path markedverifiedOn: 'ios' | 'android'was walked on a real phone; once a platform has verified paths for an app, only those run there. Verified paths start with optional Back / Close taps, because an app reopens on the screen it was left on. An app without a spec gets only the sign-in check. - Each spec has an
accountrule list:email,handle(a whole-label @handle),match(a pattern), orafter/beforean anchor label. Feed apps use their own rule so other people’s handles and emails on a feed are never taken. Without rules (the AI chat apps), the first email, else a whole-label @handle. - When a tap leaves the top of the screen unchanged (some apps ignore an accessibility click, LinkedIn’s profile button), the reader taps once more where the element’s label shows. A required tap step that finds nothing waits and looks once more; an empty read gets two more looks while the screen draws.
- Android tree lines end with flags after the bounds (
, clickable long-clickable); both parsers accept them. - Taps go through
phone.find_and_tapwith exact matching, and only to an element whose whole label or id is a spec candidate. A label that is only visible text, with no element (Telegram’s tab bar, TikTok while its element tree is busy), is tapped at the text’s position withphone.tap. A deny-list is checked before every tap: anything matching sign out, log out, delete, remove, upgrade, buy, subscribe, cancel, billing, payment, manage subscription, reset or sign in is never tapped, and neither are switches, toggles, check boxes or sliders. Nothing is typed. - The reader always ends with Home, even after a failure. On Android it also steps back out of each path it tried.
- Parsing is in
phone-account-reader.tsand never guesses.accountis a visible email or @handle.planis a known plan name for that vendor, shown as “ChatGPT Plus”, “Max plan” or “Plan: Pro”, or as a one-word name right after a “Plan” or “Subscription” label. A screen that shows two different plans, such as a plan comparison, givesnull. Usage windows come from a header such as “Current session” or “Weekly limits”, followed by “34% used” (remaining_pct66), “66% left” or “12 of 40 messages left”, and “Resets in 2 hr 10 min” or “Resets Thu 9:00 AM”. The reset time is turned into ISO in the computer’s local time. Anything else isnull.
signedIn. phoneLink.devices() then returns signedIn, account, plan, usage and accountCheckedAt on each app in apps, plus reader: 'verified' on apps with a path verified on that phone’s platform (the drawer shows Verified reader).
Desktop also checks apps in the background (PhoneAccountScheduler), kept rare because each check opens the app on the phone: every app once when it is first seen (no accountCheckedAt and signedIn: null), signed-in AI chat apps (catalog category AI chat) again every 6 hours for their usage windows, and an app right after the wizard’s Check finds it signed in. Other apps are never re-read on a timer. A timed or first check runs only after the phone has sat on its Home screen for 4 minutes (onHomeScreen: the iPhone tree has no Application root, an Android window belongs to a launcher package), on a phone that works (HEALTHY, or SIGNATURE_RENEWAL_REQUIRED while the signature hasn’t lapsed), that no bot used in the last 10 minutes and whose live screen isn’t open. A check right after the wizard skips the Home-screen wait. One app is checked at a time.
An
ok: true result with null fields means the app opened, but the reader couldn’t find those facts on the screens it reached.
Health state ACCESSIBILITY_OFF
phoneLink.devices() reports health.state: 'ACCESSIBILITY_OFF' for an Android phone whose Phone Link app answers but whose accessibility service is off. The probe sees this from device_info (system.accessibility_enabled: false) or from is_locked failing with the helper’s “accessibility service is not running” error. A screen read that fails this way also sets it, for 5 minutes or until a read succeeds. Its recovery is manual, and its action tells the person to turn on Allternit Phone Link in Settings › Accessibility on the phone, or to run Phone Link setup again. On iPhone, a runner that answers but can’t read the screen is reported as HELPER_NOT_RESPONDING in the same way.