Settings → Connections (user guide) is built from one list of rows. Two servers answer it, and the app merges the answers. This page is the contract (version 1). To add a row, see Add a connection. Older endpoints that still back parts of the page are in Older endpoints and Desktop bridge.

GET /api/v1/connections

Session auth only. A platform API key gets 403. 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>".
The client merges both lists. A runtime row replaces a cloud row with the same 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 for GET /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):
  • group is null when the request had none; q is null when it was empty.
  • total counts the entries that match q and group. counts gives every group’s total after q, ignoring group, so one limit=0 call tells a client which groups have a More tile.
  • next_cursor is null on the last page (and always with limit=0).
  • A page is sent with Cache-Control: private, max-age=300.
Sources (v1):
  • 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 “Vendor key”, blurb “Your own API key”, ways: ["paste"], runs_on: "server", key_page set, always available. Connect opens the key sheet and submits to POST /api/v1/connections/{id}/submit.
  • apps: the connector snapshot committed in cloud-api (cmd/allternit-cloud-api/src/services/connections_catalog_apps.json, made by services/open-connector/scripts/export-directory.ts). connector_id equals id. Apps signed in with a key or custom credential have ways: ["paste"]; every other app (OAuth, Composio, no sign-in) has ways: ["oauth"]. An empty blurb is the category. Apps run on a computer: while the account has a computer online they are available: true; otherwise available: false, unavailable_reason: "Runs on a computer.", fallbacks: ["this-mac"]. Connect goes to /api/v1/connectors/{connector_id}/connect on the gateway.
  • computers, phones, tools, voice, channels: empty. Every id in those groups is already a row on the page.
The catalog never lists an id the page already shows as a row (Gmail, Google Drive, Slack, GitHub, Notion, Telegram, WhatsApp, Discord, the coding tools and so on), and 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’s version 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.
An unknown id answers 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; Anthropic GET /v1/models with x-api-key and anthropic-version; Google GET /v1beta/models?key=; xAI GET /v1/models; OpenRouter GET /api/v1/key.
  • A 401 from the vendor sets the row to needs with key_rejected.
  • Keys are stored with AES-GCM through CredentialCipher, the same pattern as inference_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 is plan/<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’s chatgpt 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.
  • msg is { "role": "user" | "assistant" | "system", "content": string, "model"?: string }. Content is up to 200,000 characters. Any other role, such as tool, is 400. A stored message also has at, an ISO 8601 UTC time set by the server.
  • A summary is { "id", "title", "model", "message_count", "created_at", "updated_at", "project_id" }. project_id is null when the thread is in no project. Ids start with pth_.
  • model on create must be a plan/…, plan-… or copilot/… id, or allternit/<alias> where the alias is in the Cloud catalog (GET /v1/models, hidden aliases included), otherwise 400. For example allternit/glm-5.3 is accepted and nope is not.
  • An allternit/<alias> thread records a chat with an Allternit Cloud model from an account with no computer. The client sends the turn to POST /v1/chat/completions with the bare alias (glm-5.3, without allternit/), 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_id on 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, otherwise 400. 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, from cmd/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 on window.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 (IPC phone-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 the phone.open_app bot tool (iCTRL launch_app). It always answers signedIn: null.
  • checkApp (IPC phone-link:check-app) opens or foregrounds the app, waits for it to draw, reads its screen through the same path as phone.screen_text (falling back to phone.read_ui), and decides:
    • false when 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.
    • true when the app’s main screen is showing: for the AI chat apps (catalog category AI 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.
    • null otherwise. It looks a second time before answering null.
    account is an email address or an @handle that is shown on the screen, only when signedIn is not false; otherwise null. The result is saved on the phone’s cached app list, so phoneLink.devices() reports the app’s signedIn until the next check.
Both calls are read-only on the phone beyond opening the app: they never type, never tap a sign-in button and never read a password field. The code is in 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.
How it reads:
  • Every read starts with the sign-in check (classifySignIn on the app’s first screen, one more look while it is still drawing). A sign-in screen ends the read with signedIn: 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.ts then 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>, or re:<pattern> for a label that carries the person’s name (Discord’s “<name>, Online”). A tap step with scroll: n swipes up at most n times looking for its row. A path marked verifiedOn: '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 account rule list: email, handle (a whole-label @handle), match (a pattern), or after / before an 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_tap with 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 with phone.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.ts and never guesses. account is a visible email or @handle. plan is 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, gives null. Usage windows come from a header such as “Current session” or “Weekly limits”, followed by “34% used” (remaining_pct 66), “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 is null.
A read that saw anything is saved on the phone’s app record; a read that saw nothing keeps the last account, plan and usage and only updates 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.