docs/factory.md
Factory (displayed as "Droid") supports API-key and web-based auth. Source mode can be auto, api, or web.
api)~/.codexbar/config.json providers[].apiKey for factory (also via Settings or
codexbar config set-api-key --provider factory)FACTORY_API_KEY~/.factory/.env (FACTORY_API_KEY=… or export FACTORY_API_KEY=…)Authorization: Bearer <apiKey> (same billing-limits / bearer path as session tokens).web)Fetch attempts run in this exact order:
com.steipete.codexbar.cache, account cookie.factory).~/Library/Application Support/CodexBar/factory-session.json).If a step succeeds, we cache cookies/tokens back into the session store.
Manual option:
Cookie: header from app.factory.ai.auto)api mode stays strict and does not fall back to web.web (or api) to pin account precedence.Auto, API key, Browser cookiesFACTORY_API_KEY / ~/.factory/.envprintf '%s' "$FACTORY_API_KEY" | codexbar config set-api-key --provider factory --stdin
codexbar usage --provider factory --source api
codexbar usage --provider factory --source web
factory.ai, app.factory.ai, auth.factory.ai.wos-session__Secure-next-auth.session-tokennext-auth.session-token__Secure-authjs.session-token__Host-authjs.csrf-tokenauthjs.session-tokensessionaccess-tokenaccess-token, __recent_auth.https://auth.factory.aihttps://api.factory.aihttps://app.factory.aibaseURL (default https://app.factory.ai)All requests set:
Accept: application/jsonContent-Type: application/jsonOrigin: https://app.factory.aiReferer: https://app.factory.ai/x-factory-client: web-appAuthorization: Bearer <token> when a bearer token / API key is available.Cookie: <session cookies> when cookies are available.Endpoints:
GET https://api.factory.ai/api/billing/limits
GET <baseURL>/api/app/auth/me
GET <baseURL>/api/organization/subscription/usage
useCache=true and optional userIdPOST https://api.workos.com/user_management/authenticateclient_id: one of
client_01HXRMBQ9BJ3E7QSTQ9X2PHVB7client_01HNM792M5G5G1A2THWPXKFMXBgrant_type: refresh_tokenrefresh_token: from local storage or session storeorganization_iduseCookie: true + Cookie: <workos.com cookies>~/Library/Containers/com.apple.Safari/Data/Library/WebKit/WebsiteData/Defaultorigin files containing app.factory.ai or auth.factory.ai, then reads
LocalStorage/localstorage.sqlite3.~/Library/Application Support/<Browser>/User Data/<Profile>/Local Storage/leveldb.~/Library/Application Support/net.imput.helium/<Profile>/Local Storage/leveldb (no User Data).workos:refresh-token and workos:access-token.workos:refresh-token (required)workos:access-token (optional)~/Library/Application Support/CodexBar/factory-session.jsonFACTORY_API_KEY, Settings → Droid → API key, or codexbar config set-api-key --provider factory.Sources/CodexBarCore/Providers/Factory/FactoryProviderDescriptor.swiftSources/CodexBarCore/Providers/Factory/FactorySettingsReader.swiftSources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swiftSources/CodexBarCore/Providers/Factory/FactoryLocalStorageImporter.swift