Skip to content

Switching Orgs

A user can belong to multiple organizations. The org used for a given request determines the billing account, rate limits, model access, and visible files.

API keys are scoped to a single org at creation time. The key chooses the org — no extra header needed.

Terminal window
curl https://api.aiand.com/v1/chat/completions \
-H "Authorization: Bearer sk-..." \
-d '{...}'

To act on a different org, use that org’s API key.

The ai& CLI works the same way: its key belongs to the org chosen at sign-in. Keep one profile per org and pick it with --profile, as in aiand --profile work usage.

The console signs you in with a session cookie that holds a JWT, not with a bearer token. The JWT identifies the user, not an org, so the console sends X-Org-ID on every request to select the active org:

X-Org-ID: <org-id>

Requests without X-Org-ID on session-authenticated endpoints return 401. Session auth is for the console; for your own programs, use an API key.

In the console, the organization selector at the top right lists your organizations with your role in each. Select one to switch to it; the console opens it again the next time you sign in. Manage organizations, at the bottom of the list, opens the Organizations page. From a terminal, aiand orgs lists the same organizations. The console reads them from GET /api/v1/users/organizations, which returns each org’s id, name, and your roleName.