Skip to content

SDK Organization and Project Selection

One ServiceClient creates or resumes one Session. A Session belongs to one organization and one project, and may contain multiple Training Runs. Checkpoints belong to a Training Run.

Scope discovery and name-based selection require nex-weaver 1.10 or newer. Until that SDK release is available in your package index, use canonical organization_id and project_id fields through the supported server API, or install an explicitly reviewed SDK commit.

Discover available scopes

The CLI prints full IDs so they can be copied safely:

bash
weaver organizations list
weaver projects list --organization research
weaver scope resolve --organization research --project alignment

Use --format json for scripts:

bash
weaver organizations list --format json
weaver projects list --organization-id <organization-uuid> --format json

These discovery commands do not create a Session. organizations list returns only explicit memberships; projects list returns only projects accessible directly, through an organization-admin role, or through a Team grant.

Select by name, slug, or ID

python
from weaver import ServiceClient

with ServiceClient(organization="research", project="alignment") as client:
    training_client = client.create_model(base_model="Qwen/Qwen3-30B-A3B-Base:262144")

organization accepts a UUID, globally unique slug, or globally unique display name. project accepts a UUID, organization-local slug, or display name; project names are unique inside their organization. Resolution order is UUID, slug, then display name. The server still returns structured 409 ambiguous_scope_reference for ambiguous legacy data; the SDK never guesses.

For canonical IDs:

python
with ServiceClient(
    organization_id="<organization-uuid>",
    project_id="<project-uuid>",
) as client:
    ...

The asynchronous client accepts the same arguments.

Environment variables and precedence

bash
export WEAVER_ORGANIZATION_ID=<organization-uuid>
export WEAVER_PROJECT_ID=<project-uuid>

# Or use human-readable references:
export WEAVER_ORGANIZATION=research
export WEAVER_PROJECT=alignment

Precedence is:

  1. explicit constructor canonical ID;
  2. canonical ID environment variable;
  3. explicit constructor name/slug reference;
  4. name/slug environment variable;
  5. server fallback.

Canonical IDs bypass name resolution. Do not provide conflicting ID and name options in the CLI.

Empty and partial scope fallback

Missing, empty, or whitespace-only scope values are omitted from Session creation; the SDK does not serialize them as invalid IDs. The server then applies a stable fallback:

  • no organization and no project: the caller's first accessible organization and its default project;
  • organization only: that organization's default project;
  • project only: the server resolves and validates the owning organization.

The fallback never chooses an inaccessible organization or project. The selected project must belong to the selected organization and must not be archived. To make automation independent of membership ordering, prefer canonical IDs or globally unique slugs rather than relying on the default.

Quota methods use organization scope

Quota balance and requests are scoped to the current user inside an organization. SDK 1.10+ uses the client's organization unless a method-level organization ID is supplied. Project selection affects billing views and usage attribution, but quota approval grants balance to that user's account in the organization.

See Usage, Billing, and Quota for admission and error behavior.

Weaver API Documentation