Status: BUILDING. The code is in review and not yet in production. See status labels. Sign in with Allternit makes Allternit an OAuth 2.0 authorization server. A person approves your app once. Your app then gets a token that calls Allternit models and bills the person’s own Allternit credits, under a monthly limit the person chooses. This page is for developers who build an app that signs people in. It is not the runtime’s own gizzi sign-in; that is the OAuth API. People who link an app read Apps with access to your account.

Who pays

Your app never holds the person’s password or their Allternit session. It holds a token that can only do what the scopes allow, and the person can revoke it at any time. App-driven spend never triggers auto top-up. When the person’s credits run out, calls fail with 402 user_credits_exhausted.

Register an app

  1. Open platform.allternit.com → OAuth apps and pick a project.
  2. Create the app: name, logo URL, homepage URL, privacy policy URL, and the client type.
  3. Add the redirect URIs your app will use (see Redirect rules).
  4. Copy the client id (oapp_…). For a confidential app the console shows the client secret (alt_ocs_…) once. Only its hash is stored. Rotate secret issues a new one and shows it once.
  5. Add test users (up to 100 email addresses).
  6. When you are ready for anyone to sign in, choose Submit for review. You can withdraw a submission.
The console calls these routes with your signed-in session. The project owner can use them directly. An app object has id, client_id, name, logo_url, homepage_url, privacy_url, client_type, secret_prefix, state, scopes, redirect_uris, created_at and updated_at. Creating an app, and rotating the secret, add client_secret once (null for a public app).

App states and review

Allternit reviews every app before it goes live. Until an Allternit admin approves it, your app stays in testing: only test users and the owner can link it, and nobody can set a limit above $50. A person who is not on the list gets 403 app_not_approved_for_user, both when they approve and on every call. Only an Allternit admin moves an app from in_review to live, or to suspended.

Client types

Use confidential for a server. Use public for a browser app, a mobile app or a local tool. PKCE with S256 is required for every client. plain is refused.

Scopes

If you leave scope out of the authorize URL, it defaults to inference. No other Allternit scope can be reached with an app token.

Redirect rules

  • At most 10 redirect URIs per app.
  • The scheme is https. http is allowed only for localhost, 127.0.0.1 and [::1], on any port.
  • No custom schemes, no fragments, no user info in the URL.
  • The match is exact: no wildcards, no prefixes, and the query string must match.
If client_id or redirect_uri does not match, Allternit shows a 400 error page. It never redirects to an address you did not register.

The flow

1. Send the person to authorize

Other errors, after your redirect URI is trusted, come back as a redirect to redirect_uri with error, error_description and state. Allternit shows the person your app name, logo and homepage, what each scope means in plain words, and a monthly spend limit (suggested $10, no more than $50 while your app is not live). The person taps Allow or Deny. A signed-out person signs in first and comes back to the same request. The request lives 15 minutes.

3. The code

Allow sends the browser to your redirect_uri?code=…&state=…. Deny sends error=access_denied. The code lasts 5 minutes and works once. Using it a second time revokes the tokens it issued.

4. Exchange the code

POST https://api.allternit.com/oauth2/token, form encoded. The response is 200 with Cache-Control: no-store.
The access token lasts one hour. refresh_token is present only when offline_access was granted, and lasts 90 days.

5. Refresh

POST /oauth2/token with grant_type=refresh_token, refresh_token, client_id, and client_secret for confidential apps.
  • Do not send scope. A scope on refresh is invalid_scope. The new token keeps the scopes of the grant.
  • Every refresh gives a new access token and a new refresh token. The old refresh token stops working.
  • If a network retry sends the old refresh token again within 30 seconds, you get the same new pair back.
  • After 30 seconds, the old token counts as stolen. Allternit revokes the whole grant and answers 400 invalid_grant. The person must approve again.
  • The grant must still hold offline_access.

6. Revoke

POST /oauth2/revoke, form encoded: token, client_id, and client_secret for confidential apps. It answers 200 even for a token it does not know. Revoking a refresh token revokes the whole grant and all its access tokens. The person can also revoke from their account.

7. Userinfo

GET /oauth2/userinfo with Authorization: Bearer alt_oat_…. It needs the profile scope (403 insufficient_scope without it).
sub is an opaque id that is stable for one person in your app and different in every other app. It is not the person’s Allternit id. Do not compare it across apps.

8. Usage

GET https://api.allternit.com/api/v1/oauth/usage with an alt_oat_ token that has the usage scope.
The month is UTC. The limit starts again at 00:00 UTC on the first. A change the person makes to the limit applies to the current month at once.

Metadata

GET /.well-known/oauth-authorization-server lists the endpoints, S256, the two auth methods and the four scopes.

Call models

Send the access token to the chat completions endpoint.
Rules for app tokens:
  • Only POST /v1/chat/completions, with the inference scope. App tokens reach nothing else on the Platform API.
  • Models in the open lane, plan models and Copilot models are refused for apps (403). Use the models listed for Allternit credits.
  • Before each call Allternit reserves the most the call could cost (your max_tokens times the model price). If that would pass the monthly limit, it answers 402 app_spend_cap_reached and calls no model. If the person’s credits are too low, it answers 402 user_credits_exhausted and calls no model. After the call it settles to the real cost. Set max_tokens so the reserve is not larger than you need.
  • 60 requests a minute for each grant. Past that, 429 rate_limited with a retry-after header.

Errors

OAuth endpoints use the RFC 6749 shape: {"error": "…", "error_description": "…"}. Other endpoints use {"error": {"code": "…", "message": "…"}}.

Browser apps (CORS)

/oauth2/token, /oauth2/revoke, /oauth2/userinfo and /.well-known/oauth-authorization-server answer Access-Control-Allow-Origin: *, without credentials, and read no cookies. A public app that runs in the browser can call them with PKCE. Keep tokens out of the URL and out of long-lived storage you do not control.

Example: a browser app with PKCE