A Workspace is an immutable account and environment
identity. Its canonical path is {account}/{environment}, for example
acme/research. Account and environment IDs remain the authoritative
identifiers; the path is the readable form used by the SDK and CLI.
Use PlatformClient to manage platform context. The
biolm.workspaces module re-exports PlatformClient and Workspace for
compatibility.
Workspace API
PlatformClient provides:
get_current_user()— return the authenticated user’s identitylist_workspaces()— list personal and organization workspacescurrent_workspace()— inspect the active account/environment contextget_workspace(path)— resolve an exactaccount/environmentpathswitch_workspace(path)— change the active account and environmentcreate_workspace(name, account=None)— create an environment in the current account or a named account
Creating a workspace creates an environment under an account. The platform has no workspace delete endpoint.
Organizations, environments, and budgets
The same client exposes the underlying platform resources:
Organizations:
list_organizations(),get_organization(),create_organization(), andinvite_to_organization()Environments:
list_environments()andcreate_environment()Active-account budgets:
get_budget()andset_budget()Monthly usage:
get_usage_summary(year=None, month=None, environment_id=None, account=None)API keys:
create_api_key(account=None)anddelete_api_key(token_or_prefix)
get_organization(identifier) and
invite_to_organization(identifier, email, role="member") resolve
identifier against exact organization names and slugs before calling
numeric-ID platform endpoints. Numeric IDs and all-digit strings remain
accepted for compatibility; all-digit values prefer an exact ID match.
get_usage_summary() returns the platform’s monthly usage dictionary,
including effective account scope, environment usage, and model charges. It
uses the current month and account by default. Pass account to select an
organization or personal account within the same client session.
create_api_key() returns the one-time token secret and owns the key with the
active account, or the account named by account. The secret is not stored by
the SDK. delete_api_key() revokes a key by full token or eight-character
prefix. The platform has no API-key listing endpoint.
Session-scoped usage
Account context is session-scoped. Reuse one client for related operations, or use it as a context manager:
from biolm import PlatformClient
with PlatformClient() as platform:
current = platform.current_workspace()
workspaces = platform.list_workspaces()
target = platform.get_workspace("acme/research")
platform.switch_workspace(target)
created = platform.create_workspace("experiments", account="acme")
usage = platform.get_usage_summary(year=2026, month=7, account="acme")
The client handles OAuth/token credentials and persists the session cookies
needed for account-context switches. Run biolm account login once when
using OAuth; application code does not need to copy or manage those cookies.
Platform API reference
- class biolm.platform.Workspace(account_type: str, account_id: int, environment_id: int, account: str, environment: str)
Immutable account + environment pair.
account/environmentare path segments (org slug or personal label, and environment slug from the APInamefield). IDs remain authoritative.- account: str
- account_id: int
- account_type: str
- environment: str
- environment_id: int
- property path: str
- class biolm.platform.PlatformClient(api_key: str | None = None, base_url: str | None = None, timeout: float = 30.0, transport: BaseTransport | None = None, client: Client | None = None)
Sync client for BioLM platform (orgs, environments, budgets, workspaces).
Instances retain session cookies and active account context. They are stateful, session-scoped, and not safe for concurrent use across threads.
- create_api_key(account: str | None = None) → Dict[str, str]
Create an API key and return its one-time secret.
The key is owned by the active server-side account context. Pass
account(an org slug or the personal label) to create the key under a different account; the switch and creation happen in this one session so organization ownership cannot silently fall back to personal. The original context is restored afterward. The returnedtokenis shown only once and is not stored by the SDK.
- delete_api_key(token_or_prefix: str) → None
Revoke an API key by full token or eight-character prefix.
- get_usage_summary(year: int | None = None, month: int | None = None, environment_id: int | None = None, account: str | None = None) → Dict[str, Any]
Return monthly usage for the current or named account.
- get_workspace(path: str) → Workspace
Resolve and return the workspace matching an exact path.
- list_workspaces() → List[Workspace]
List personal and organization workspaces, restoring prior context.
The environments endpoint is session-scoped, so enumeration must switch the backend account context for each account. Those switches may cause the backend to ensure or select a default environment; there is no context-free environment listing endpoint available.
Workspace documentation
biolm workspace — workspace CLI
biolm package —
biolm.platformmodule reference