> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Baseten API reference

> API reference for the Baseten plugin in Corsair: every `baseten.api.*` operation with its input and output types, taken from the plugin's Zod schemas.

> [!NOTE]
>
> **New to Corsair?** See [API access](https://docs.corsair.dev/concepts/api.md), [authentication](https://docs.corsair.dev/concepts/auth.md), and [error handling](https://docs.corsair.dev/concepts/error-handling).

## Access

### assignments.create

`access.assignments.create`

Assigns a role. Gives a user, service account, or directory group a role, for the organization or in a team. Needs access.member.write there, or access.group.write for a directory group. A service account's roles also need service\_account.write where the account belongs.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.access.assignments.create({ role_id: 'example', subject_type: 'USER', subject_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `role_id` | `string` | Yes | ID of the role to assign |
| `subject_type` | `USER \| SERVICE_ACCOUNT \| DIRECTORY_GROUP` | Yes | Who holds a role. |
| `subject_id` | `string` | Yes | ID of the user, service account, or directory group to give the role to |
| `team_id` | `string \| null` | No | ID of the team to assign a team role in. Omit for an organization role. |
| `resource_sets` | `object[] \| null` | No | Sets of resources the role applies to. It applies to what any set matches, and a set matches what every resource in its `all_of` matches. For example, one set for a model in staging and another for a different model in production. An environment name no deployment uses yet applies once one does. Omit for every resource where the role applies. |

> [accordion] resource\_sets full type
>
> ```ts theme={null}
> {
>   all_of: {
>     type: CHAIN | ENVIRONMENT | GATEWAY_ENDPOINT | GATEWAY_GROUP | GATEWAY_KEY | GRID_CONNECTION | GRID_ROUTE | LIBRARY_LISTING | MODEL | MODEL_API | SANDBOX | SECRET | SERVICE_ACCOUNT | TRAINING_JOB | TRAINING_LOOP | TRAINING_PROJECT | VOLUME | WEBHOOK_SECRET,
>     identifier: string
>   }[]
> }[] | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null \| null` | No | Unique identifier of the role assignment. Null for a built-in role held through organization or team membership. |
| `granted_via` | `string \| null` | No | How a role is held. |
| `role_id` | `string \| null` | No | ID of the role |
| `role_name` | `string \| null` | No | Name of the role |
| `subject_type` | `string \| null` | No | Who holds a role. |
| `subject_id` | `string \| null` | No | ID of the user, service account, or directory group that holds the role |
| `subject_name` | `string \| null` | No | Name of the user, service account, or directory group that holds the role |
| `team_id` | `string \| null \| null` | No | ID of the team the role applies in. Null for the organization. |
| `team_name` | `string \| null \| null` | No | Name of the team the role applies in. Null for the organization. |
| `resource_sets` | `object[] \| null` | No | Sets of resources the role applies to. It applies to what any set matches, and a set matches what every resource in its `all_of` matches. Empty for every resource where it applies. |
| `created_by` | `string \| null \| null` | No | ID of the user who assigned the role. Null for a role held through membership, or one no user assigned. |
| `created_at` | `string \| null \| null` | No | Time the role was assigned. Null for a role held through membership. |

> [accordion] resource\_sets full type
>
> ```ts theme={null}
> {
>   all_of?: {
>     type?: string | null,
>     identifier?: string | null
>   }[] | null
> }[] | null
> ```

***

### assignments.delete

`access.assignments.delete`

Removes a role assignment. Needs access.member.delete where the role applies, or access.group.write for a directory group. A service account's roles also need service\_account.write where the account belongs. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.access.assignments.delete({ assignment_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `assignment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the removed role assignment |

***

### assignments.get

`access.assignments.get`

Gets a role assignment. Needs access.member.read where the role applies.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.access.assignments.get({ assignment_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `assignment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null \| null` | No | Unique identifier of the role assignment. Null for a built-in role held through organization or team membership. |
| `granted_via` | `string \| null` | No | How a role is held. |
| `role_id` | `string \| null` | No | ID of the role |
| `role_name` | `string \| null` | No | Name of the role |
| `subject_type` | `string \| null` | No | Who holds a role. |
| `subject_id` | `string \| null` | No | ID of the user, service account, or directory group that holds the role |
| `subject_name` | `string \| null` | No | Name of the user, service account, or directory group that holds the role |
| `team_id` | `string \| null \| null` | No | ID of the team the role applies in. Null for the organization. |
| `team_name` | `string \| null \| null` | No | Name of the team the role applies in. Null for the organization. |
| `resource_sets` | `object[] \| null` | No | Sets of resources the role applies to. It applies to what any set matches, and a set matches what every resource in its `all_of` matches. Empty for every resource where it applies. |
| `created_by` | `string \| null \| null` | No | ID of the user who assigned the role. Null for a role held through membership, or one no user assigned. |
| `created_at` | `string \| null \| null` | No | Time the role was assigned. Null for a role held through membership. |

> [accordion] resource\_sets full type
>
> ```ts theme={null}
> {
>   all_of?: {
>     type?: string | null,
>     identifier?: string | null
>   }[] | null
> }[] | null
> ```

***

### assignments.list

`access.assignments.list`

Lists role assignments. Needs access.member.read for the organization, or in the team you pass as team\_id. Roles held through organization and team membership aren't listed.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.access.assignments.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `team_id` | `string \| null` | No | ID of a team. Lists only the assignments in it. |
| `role_id` | `string \| null` | No | ID of a role. Lists only its assignments. |
| `subject_type` | `USER \| SERVICE_ACCOUNT \| DIRECTORY_GROUP \| null` | No | Lists only the assignments to this type of subject |
| `subject_id` | `string \| null` | No | ID of a user, service account, or directory group. Lists only its assignments. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null | null,
>   granted_via?: string | null,
>   role_id?: string | null,
>   role_name?: string | null,
>   subject_type?: string | null,
>   subject_id?: string | null,
>   subject_name?: string | null,
>   team_id?: string | null | null,
>   team_name?: string | null | null,
>   resource_sets?: {
>     all_of?: {
>       type?: string | null,
>       identifier?: string | null
>     }[] | null
>   }[] | null,
>   created_by?: string | null | null,
>   created_at?: string | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### check

`access.check`

Checks whether you hold permissions. Answers each check as fine-grained authorization decides it. Users and service accounts can call it, with the same access as GET /v1/users/me/access. Returns 503 while authorization is unavailable.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.access.check({
	checks: [{ permission: 'example' }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `checks` | `object[]` | Yes | Permissions to check, at most 100 |

> [accordion] checks full type
>
> ```ts theme={null}
> {
>   permission: string,
>   team_id?: string | null,
>   resource_set?: {
>     type: CHAIN | ENVIRONMENT | GATEWAY_ENDPOINT | GATEWAY_GROUP | GATEWAY_KEY | GRID_CONNECTION | GRID_ROUTE | LIBRARY_LISTING | MODEL | MODEL_API | SANDBOX | SECRET | SERVICE_ACCOUNT | TRAINING_JOB | TRAINING_LOOP | TRAINING_PROJECT | VOLUME | WEBHOOK_SECRET,
>     identifier: string
>   }[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `results` | `object[] \| null` | No | One result per check, in the order you sent them |

> [accordion] results full type
>
> ```ts theme={null}
> {
>   permission?: string | null,
>   team_id?: string | null | null,
>   resource_set?: {
>     type?: string | null,
>     identifier?: string | null
>   }[] | null,
>   allowed?: boolean | null
> }[] | null
> ```

***

### identityProviders.create

`access.identityProviders.create`

Adds an identity provider. Adds a predefined or custom identity provider to the organization. For a predefined provider with a per-customer issuer, the issuer must match the provider's format. A custom provider needs a name and an issuer that no predefined provider uses.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.access.identityProviders.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Name, unique in the organization. Required for a custom provider. A predefined provider defaults to its display name, so pass one when adding a second issuer of the same provider. |
| `description` | `string \| null` | No | Optional description |
| `predefined` | `object \| null` | No | The predefined provider to add. Pass this or `custom`. |
| `custom` | `object \| null` | No | The custom provider to add. Pass this or `predefined`. |

> [accordion] predefined full type
>
> ```ts theme={null}
> {
>   kind: GITHUB_ACTIONS | GCP | BASETEN | AWS_IAM | AWS_EKS | AZURE_MANAGED_IDENTITY_V1 | AZURE_MANAGED_IDENTITY_V2 | AZURE_AKS,
>   issuer_url?: string | null
> } | null
> ```

> [accordion] custom full type
>
> ```ts theme={null}
> {
>   issuer_url: string,
>   jwks: {
>     type: DISCOVERY | EXPLICIT_URL | INLINE,
>     url?: string | null,
>     keys?: {
>     }[] | null
>   }
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Identity provider ID |
| `name` | `string \| null` | No | Name, unique in the organization |
| `description` | `string \| null \| null` | No | Description |
| `predefined` | `object \| null` | No | Settings of a predefined provider. Null for a custom one. |
| `custom` | `object \| null` | No | Settings of a custom provider. Null for a predefined one. |
| `created_by` | `string \| null` | No | ID of the user who added the provider |
| `created_at` | `string \| null` | No | Time the provider was added |
| `updated_at` | `string \| null` | No | Time the provider was last updated |

> [accordion] predefined full type
>
> ```ts theme={null}
> {
>   kind?: string | null,
>   issuer_url?: string | null | null
> } | null | null
> ```

> [accordion] custom full type
>
> ```ts theme={null}
> {
>   issuer_url?: string | null,
>   jwks?: {
>     type?: string | null,
>     url?: string | null | null,
>     keys?: {
>     }[] | null | null
>   } | null
> } | null | null
> ```

***

### identityProviders.delete

`access.identityProviders.delete`

Deletes an identity provider. Removes the identity provider from the organization. Returns 409 while a trust rule uses it. Only organization admins can call this endpoint. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.access.identityProviders.delete({ identity_provider_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `identity_provider_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | ID of the deleted identity provider |
| `deleted` | `boolean \| null` | No | Always true |

***

### identityProviders.get

`access.identityProviders.get`

Gets an identity provider. (GET /v1/access/identity\_providers/\{identity\_provider\_id})

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.access.identityProviders.get({ identity_provider_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `identity_provider_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Identity provider ID |
| `name` | `string \| null` | No | Name, unique in the organization |
| `description` | `string \| null \| null` | No | Description |
| `predefined` | `object \| null` | No | Settings of a predefined provider. Null for a custom one. |
| `custom` | `object \| null` | No | Settings of a custom provider. Null for a predefined one. |
| `created_by` | `string \| null` | No | ID of the user who added the provider |
| `created_at` | `string \| null` | No | Time the provider was added |
| `updated_at` | `string \| null` | No | Time the provider was last updated |

> [accordion] predefined full type
>
> ```ts theme={null}
> {
>   kind?: string | null,
>   issuer_url?: string | null | null
> } | null | null
> ```

> [accordion] custom full type
>
> ```ts theme={null}
> {
>   issuer_url?: string | null,
>   jwks?: {
>     type?: string | null,
>     url?: string | null | null,
>     keys?: {
>     }[] | null | null
>   } | null
> } | null | null
> ```

***

### identityProviders.list

`access.identityProviders.list`

Lists identity providers. Lists the organization's identity providers. Organization and team admins can list them.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.access.identityProviders.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `name` | `string \| null` | No | Only the provider with this name, ignoring case |
| `predefined_kind` | `GITHUB_ACTIONS \| GCP \| BASETEN \| AWS_IAM \| AWS_EKS \| AZURE_MANAGED_IDENTITY_V1 \| AZURE_MANAGED_IDENTITY_V2 \| AZURE_AKS \| null` | No | Only this predefined provider's issuers |
| `type` | `PREDEFINED \| CUSTOM \| null` | No | Only predefined or only custom providers |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null | null,
>   predefined?: {
>     kind?: string | null,
>     issuer_url?: string | null | null
>   } | null | null,
>   custom?: {
>     issuer_url?: string | null,
>     jwks?: {
>       type?: string | null,
>       url?: string | null | null,
>       keys?: {
>       }[] | null | null
>     } | null
>   } | null | null,
>   created_by?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### identityProviders.listPredefined

`access.identityProviders.listPredefined`

Lists predefined identity providers. Lists the identity providers Baseten supports, with the issuer format for those where each account, tenant, or cluster has its own issuer.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.access.identityProviders.listPredefined({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Identity providers Baseten supports |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   kind?: string | null,
>   name?: string | null,
>   issuer_url?: string | null | null,
>   issuer_url_example?: string | null | null
> }[] | null
> ```

***

### identityProviders.update

`access.identityProviders.update`

Updates an identity provider. Updates the fields you send. The provider and issuer can't change; a custom provider's jwks can, and new keys are read before they're saved. Only organization admins can call this endpoint.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.access.identityProviders.update({ identity_provider_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `identity_provider_id` | `string` | Yes | — |
| `name` | `string \| null` | No | Name, unique in the organization |
| `description` | `string \| null` | No | Description; null clears it |
| `custom` | `object \| null` | No | A custom provider's settings to change. A predefined provider's can't be changed. |

> [accordion] custom full type
>
> ```ts theme={null}
> {
>   jwks: {
>     type: DISCOVERY | EXPLICIT_URL | INLINE,
>     url?: string | null,
>     keys?: {
>     }[] | null
>   }
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Identity provider ID |
| `name` | `string \| null` | No | Name, unique in the organization |
| `description` | `string \| null \| null` | No | Description |
| `predefined` | `object \| null` | No | Settings of a predefined provider. Null for a custom one. |
| `custom` | `object \| null` | No | Settings of a custom provider. Null for a predefined one. |
| `created_by` | `string \| null` | No | ID of the user who added the provider |
| `created_at` | `string \| null` | No | Time the provider was added |
| `updated_at` | `string \| null` | No | Time the provider was last updated |

> [accordion] predefined full type
>
> ```ts theme={null}
> {
>   kind?: string | null,
>   issuer_url?: string | null | null
> } | null | null
> ```

> [accordion] custom full type
>
> ```ts theme={null}
> {
>   issuer_url?: string | null,
>   jwks?: {
>     type?: string | null,
>     url?: string | null | null,
>     keys?: {
>     }[] | null | null
>   } | null
> } | null | null
> ```

***

### identityProviders.verify

`access.identityProviders.verify`

Checks an identity provider before adding it. Runs the checks that adding the identity provider runs, without adding it: the issuer's format, that the organization doesn't have it yet, and, for a provider with a per-customer issuer or a custom provider, that its signing keys can be read.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.access.identityProviders.verify({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `predefined` | `object \| null` | No | The predefined provider to check, as you'd pass it when adding it. Pass this or `custom`. |
| `custom` | `object \| null` | No | The custom provider to check, as you'd pass it when adding it. Pass this or `predefined`. |

> [accordion] predefined full type
>
> ```ts theme={null}
> {
>   kind: GITHUB_ACTIONS | GCP | BASETEN | AWS_IAM | AWS_EKS | AZURE_MANAGED_IDENTITY_V1 | AZURE_MANAGED_IDENTITY_V2 | AZURE_AKS,
>   issuer_url?: string | null
> } | null
> ```

> [accordion] custom full type
>
> ```ts theme={null}
> {
>   issuer_url: string,
>   jwks: {
>     type: DISCOVERY | EXPLICIT_URL | INLINE,
>     url?: string | null,
>     keys?: {
>     }[] | null
>   }
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `valid` | `boolean \| null` | No | Whether the input passes every check |
| `error` | `string \| null \| null` | No | Why the input fails, as creating it would report. Null when it's valid. |

***

### permissions.list

`access.permissions.list`

Lists permissions and their categories. Every caller gets the same permissions and categories; only available depends on your organization. Users and service accounts can call it, with the same access as GET /v1/users/me/access.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.access.permissions.list({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `categories` | `object[] \| null` | No | Every permission category |
| `permissions` | `object[] \| null` | No | Every permission, including those for features your organization doesn't have. Only `available` differs between organizations. |

> [accordion] categories full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   display_name?: string | null,
>   description?: string | null,
>   resource_types?: string[] | null,
>   supports_environments?: boolean | null
> }[] | null
> ```

> [accordion] permissions full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   category?: string | null,
>   display_name?: string | null,
>   description?: string | null,
>   role_kinds?: string[] | null,
>   reserved?: boolean | null,
>   available?: boolean | null
> }[] | null
> ```

***

### roles.create

`access.roles.create`

Creates a custom role. Needs access.role.write for the organization, or in the role's team while your organization lets team admins manage roles. Unknown, reserved, or unavailable permissions return 400 with the reason in the error details.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.access.roles.create({ name: 'example', kind: 'ORGANIZATION' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | Name of the role, unique in your organization |
| `kind` | `ORGANIZATION \| TEAM \| MEMBERSHIP` | Yes | Where a role is assigned. |
| `team_id` | `string \| null` | No | For a team role, ID of the only team it can be assigned in. Omit to let any team use it. |
| `description` | `string` | No | Description of the role |
| `permissions` | `string[]` | No | Names of the permissions the role grants |
| `include_role_ids` | `string[]` | No | IDs of built-in roles whose permissions the role also grants, such as `baseten:reader` |
| `template_role_id` | `string \| null` | No | ID of a built-in role whose current permissions to copy into `permissions` once, leaving out those the role's kind can't hold and those not available to your organization. Unlike `include_role_ids`, later changes to that role don't apply. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the role. Built-in role IDs start with `baseten:`, such as `baseten:reader`. |
| `name` | `string \| null` | No | Name of the role |
| `description` | `string \| null` | No | Description of the role |
| `built_in` | `boolean \| null` | No | Whether Baseten defines the role. Built-in roles are read-only. |
| `kind` | `string \| null` | No | Where a role is assigned. |
| `team_id` | `string \| null \| null` | No | ID of the only team a team role can be assigned in. Null when any team can use it, and for other kinds of role. |
| `team_name` | `string \| null \| null` | No | Name of the only team a team role can be assigned in |
| `permissions` | `string[] \| null` | No | Names of the role's own permissions |
| `include_roles` | `object[] \| null` | No | Built-in roles whose permissions this role also grants, including permissions Baseten adds to them later, each with the roles it includes |

> [accordion] include\_roles full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   built_in?: boolean | null,
>   kind?: string | null,
>   team_id?: string | null | null,
>   team_name?: string | null | null,
>   permissions?: string[] | null,
>   include_roles?: (recursive)[] | null
> }[] | null
> ```

***

### roles.delete

`access.roles.delete`

Deletes a custom role. Needs access.role.delete where the role applies; for a team's role, for the organization unless it lets team admins manage roles. While any assignment uses the role, it returns 409 with reason ROLE\_IN\_USE. Built-in roles return 400. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.access.roles.delete({ role_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `role_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the deleted role |

***

### roles.get

`access.roles.get`

Gets a role. Needs access.role.read, or access.role.write in the role's team. Pass team\_id to get the role as that team's role list shows it: access.role.write in that team is then enough, and a role the list leaves out returns 404.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.access.roles.get({ role_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `role_id` | `string` | Yes | — |
| `team_id` | `string \| null` | No | ID of a team. Gets the role only if `GET /v1/access/roles` lists it for that team, and checks your access in that team. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the role. Built-in role IDs start with `baseten:`, such as `baseten:reader`. |
| `name` | `string \| null` | No | Name of the role |
| `description` | `string \| null` | No | Description of the role |
| `built_in` | `boolean \| null` | No | Whether Baseten defines the role. Built-in roles are read-only. |
| `kind` | `string \| null` | No | Where a role is assigned. |
| `team_id` | `string \| null \| null` | No | ID of the only team a team role can be assigned in. Null when any team can use it, and for other kinds of role. |
| `team_name` | `string \| null \| null` | No | Name of the only team a team role can be assigned in |
| `permissions` | `string[] \| null` | No | Names of the role's own permissions |
| `include_roles` | `object[] \| null` | No | Built-in roles whose permissions this role also grants, including permissions Baseten adds to them later, each with the roles it includes |

> [accordion] include\_roles full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   built_in?: boolean | null,
>   kind?: string | null,
>   team_id?: string | null | null,
>   team_name?: string | null | null,
>   permissions?: string[] | null,
>   include_roles?: (recursive)[] | null
> }[] | null
> ```

***

### roles.list

`access.roles.list`

Lists roles. Lists built-in roles and your organization's custom roles, sorted by name. Needs access.role.read, or access.role.write in the team you pass as team\_id.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.access.roles.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `team_id` | `string \| null` | No | ID of a team. Lists only the roles available there: built-in roles and the team roles it can use. |
| `name` | `string \| null` | No | Lists only the roles with this name |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   built_in?: boolean | null,
>   kind?: string | null,
>   team_id?: string | null | null,
>   team_name?: string | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### roles.update

`access.roles.update`

Updates a custom role. Changes the fields you send. permissions and include\_role\_ids add to the role's lists, and the \_to\_delete fields remove from them. Needs access.role.write where the role applies; for a team's role, for the organization unless it lets team admins manage roles. Built-in roles return 400.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.access.roles.update({ role_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `role_id` | `string` | Yes | — |
| `name` | `string \| null` | No | New name of the role |
| `description` | `string \| null` | No | New description of the role |
| `permissions` | `string[]` | No | Names of permissions to add to the role |
| `permissions_to_delete` | `string[]` | No | Names of permissions to remove from the role |
| `include_role_ids` | `string[]` | No | IDs of built-in roles for the role to include |
| `include_role_ids_to_delete` | `string[]` | No | IDs of built-in roles for the role to stop including |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the role. Built-in role IDs start with `baseten:`, such as `baseten:reader`. |
| `name` | `string \| null` | No | Name of the role |
| `description` | `string \| null` | No | Description of the role |
| `built_in` | `boolean \| null` | No | Whether Baseten defines the role. Built-in roles are read-only. |
| `kind` | `string \| null` | No | Where a role is assigned. |
| `team_id` | `string \| null \| null` | No | ID of the only team a team role can be assigned in. Null when any team can use it, and for other kinds of role. |
| `team_name` | `string \| null \| null` | No | Name of the only team a team role can be assigned in |
| `permissions` | `string[] \| null` | No | Names of the role's own permissions |
| `include_roles` | `object[] \| null` | No | Built-in roles whose permissions this role also grants, including permissions Baseten adds to them later, each with the roles it includes |

> [accordion] include\_roles full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   built_in?: boolean | null,
>   kind?: string | null,
>   team_id?: string | null | null,
>   team_name?: string | null | null,
>   permissions?: string[] | null,
>   include_roles?: (recursive)[] | null
> }[] | null
> ```

***

### trustRules.create

`access.trustRules.create`

Creates a trust rule. Creates a rule that lets tokens from an identity provider act as a service account. Organization admins can create rules for any service account, team admins for their own team's. An organization API key manager key can't target organization accounts.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.access.trustRules.create({
	name: 'example',
	identity_provider_id: 'example',
	service_account_id: 'example',
	condition: 'example',
	audience: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | Name, unique in the organization. Can be changed later. |
| `description` | `string \| null` | No | Optional description |
| `identity_provider_id` | `string` | Yes | Whose tokens the rule accepts. Can't be changed. |
| `service_account_id` | `string` | Yes | The service account its tokens act as. Can be changed later. |
| `condition` | `string` | Yes | A CEL expression over the token's `claims` that must evaluate to true. It must pin a specific `claims.sub` in a top-level `&&` clause, plus any provider-required checks. Up to 4,096 characters. Can be changed later. |
| `audience` | `string` | Yes | The token's `aud` must equal this, or contain it when `aud` is a list. Up to 1,024 characters. Can be changed later. |
| `max_access_token_lifetime_seconds` | `number` | No | Longest lifetime of a token the rule issues, 60 to 3600 seconds. Can be changed later. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Trust rule ID. Workloads pass it when they exchange a token. |
| `name` | `string \| null` | No | Name, unique in the organization |
| `description` | `string \| null \| null` | No | Description |
| `identity_provider_id` | `string \| null` | No | The identity provider whose tokens it accepts |
| `identity_provider_name` | `string \| null` | No | Name of the identity provider |
| `service_account_id` | `string \| null` | No | The service account its tokens act as |
| `service_account_name` | `string \| null` | No | Name of the service account |
| `team_id` | `string \| null \| null` | No | The service account's team. Null for an organization service account. |
| `team_name` | `string \| null \| null` | No | Name of the service account's team. Null for an organization service account. |
| `condition` | `string \| null` | No | A CEL expression over the token's `claims` that must evaluate to true. It must pin a specific `claims.sub` in a top-level `&&` clause, plus any provider-required checks. Up to 4,096 characters. |
| `audience` | `string \| null` | No | The token's `aud` must equal this, or contain it when `aud` is a list. Up to 1,024 characters. |
| `max_access_token_lifetime_seconds` | `number \| null` | No | Longest lifetime of a token the rule issues, in seconds |
| `last_used_at` | `string \| null \| null` | No | Last time a request authenticated with a token the rule issued, to within an hour. Null until the first. |
| `created_by` | `string \| null` | No | ID of the user who created the rule |
| `created_at` | `string \| null` | No | Time the rule was created |
| `updated_at` | `string \| null` | No | Time the rule was last updated |

***

### trustRules.delete

`access.trustRules.delete`

Deletes a trust rule. New exchanges through the rule fail at once; tokens already issued keep working until they expire. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.access.trustRules.delete({ trust_rule_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trust_rule_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | ID of the deleted trust rule |
| `deleted` | `boolean \| null` | No | Always true |

***

### trustRules.get

`access.trustRules.get`

Gets a trust rule. (GET /v1/access/trust\_rules/\{trust\_rule\_id})

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.access.trustRules.get({ trust_rule_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trust_rule_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Trust rule ID. Workloads pass it when they exchange a token. |
| `name` | `string \| null` | No | Name, unique in the organization |
| `description` | `string \| null \| null` | No | Description |
| `identity_provider_id` | `string \| null` | No | The identity provider whose tokens it accepts |
| `identity_provider_name` | `string \| null` | No | Name of the identity provider |
| `service_account_id` | `string \| null` | No | The service account its tokens act as |
| `service_account_name` | `string \| null` | No | Name of the service account |
| `team_id` | `string \| null \| null` | No | The service account's team. Null for an organization service account. |
| `team_name` | `string \| null \| null` | No | Name of the service account's team. Null for an organization service account. |
| `condition` | `string \| null` | No | A CEL expression over the token's `claims` that must evaluate to true. It must pin a specific `claims.sub` in a top-level `&&` clause, plus any provider-required checks. Up to 4,096 characters. |
| `audience` | `string \| null` | No | The token's `aud` must equal this, or contain it when `aud` is a list. Up to 1,024 characters. |
| `max_access_token_lifetime_seconds` | `number \| null` | No | Longest lifetime of a token the rule issues, in seconds |
| `last_used_at` | `string \| null \| null` | No | Last time a request authenticated with a token the rule issued, to within an hour. Null until the first. |
| `created_by` | `string \| null` | No | ID of the user who created the rule |
| `created_at` | `string \| null` | No | Time the rule was created |
| `updated_at` | `string \| null` | No | Time the rule was last updated |

***

### trustRules.list

`access.trustRules.list`

Lists trust rules. Lists the trust rules you administer: every rule for an organization admin, and rules for your teams' service accounts for a team admin.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.access.trustRules.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `name` | `string \| null` | No | Only the rule with this name, ignoring case |
| `identity_provider_id` | `string \| null` | No | Only this provider's rules |
| `service_account_id` | `string \| null` | No | Only rules for this service account |
| `team_id` | `string \| null` | No | Only rules for this team's service accounts |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null | null,
>   identity_provider_id?: string | null,
>   identity_provider_name?: string | null,
>   service_account_id?: string | null,
>   service_account_name?: string | null,
>   team_id?: string | null | null,
>   team_name?: string | null | null,
>   condition?: string | null,
>   audience?: string | null,
>   max_access_token_lifetime_seconds?: number | null,
>   last_used_at?: string | null | null,
>   created_by?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### trustRules.update

`access.trustRules.update`

Updates a trust rule. Updates the fields you send. Changes apply to new exchanges only. The identity provider can't change.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.access.trustRules.update({ trust_rule_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trust_rule_id` | `string` | Yes | — |
| `name` | `string \| null` | No | Name, unique in the organization |
| `description` | `string \| null` | No | Description; null clears it |
| `condition` | `string \| null` | No | A CEL expression over the token's `claims` that must evaluate to true. It must pin a specific `claims.sub` in a top-level `&&` clause, plus any provider-required checks. Up to 4,096 characters. |
| `audience` | `string \| null` | No | The token's `aud` must equal this, or contain it when `aud` is a list. Up to 1,024 characters. |
| `max_access_token_lifetime_seconds` | `number \| null` | No | Longest lifetime of a token the rule issues, 60 to 3600 seconds. Tokens already issued keep their lifetime. |
| `service_account_id` | `string \| null` | No | Moves the rule to another service account. Tokens already issued keep the old account until they expire. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Trust rule ID. Workloads pass it when they exchange a token. |
| `name` | `string \| null` | No | Name, unique in the organization |
| `description` | `string \| null \| null` | No | Description |
| `identity_provider_id` | `string \| null` | No | The identity provider whose tokens it accepts |
| `identity_provider_name` | `string \| null` | No | Name of the identity provider |
| `service_account_id` | `string \| null` | No | The service account its tokens act as |
| `service_account_name` | `string \| null` | No | Name of the service account |
| `team_id` | `string \| null \| null` | No | The service account's team. Null for an organization service account. |
| `team_name` | `string \| null \| null` | No | Name of the service account's team. Null for an organization service account. |
| `condition` | `string \| null` | No | A CEL expression over the token's `claims` that must evaluate to true. It must pin a specific `claims.sub` in a top-level `&&` clause, plus any provider-required checks. Up to 4,096 characters. |
| `audience` | `string \| null` | No | The token's `aud` must equal this, or contain it when `aud` is a list. Up to 1,024 characters. |
| `max_access_token_lifetime_seconds` | `number \| null` | No | Longest lifetime of a token the rule issues, in seconds |
| `last_used_at` | `string \| null \| null` | No | Last time a request authenticated with a token the rule issued, to within an hour. Null until the first. |
| `created_by` | `string \| null` | No | ID of the user who created the rule |
| `created_at` | `string \| null` | No | Time the rule was created |
| `updated_at` | `string \| null` | No | Time the rule was last updated |

***

### trustRules.verify

`access.trustRules.verify`

Checks a trust rule's condition and audience. Runs the checks that creating or updating a trust rule runs on its condition and audience, without saving anything: that the condition compiles and pins the claims the identity provider requires. A failed check returns 200 with valid false and the reason.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.access.trustRules.verify({ identity_provider_id: 'example', condition: 'example', audience: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `identity_provider_id` | `string` | Yes | The identity provider the rule is for, which decides the claims it must pin |
| `condition` | `string` | Yes | A CEL expression over the token's `claims` that must evaluate to true. It must pin a specific `claims.sub` in a top-level `&&` clause, plus any provider-required checks. Up to 4,096 characters. |
| `audience` | `string` | Yes | The token's `aud` must equal this, or contain it when `aud` is a list. Up to 1,024 characters. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `valid` | `boolean \| null` | No | Whether the input passes every check |
| `error` | `string \| null \| null` | No | Why the input fails, as creating it would report. Null when it's valid. |

***

## Api Keys

### create

`apiKeys.create`

Creates an API key. Creates an API key with the provided name and type. The API key is returned in the response. Returns the new key's secret once.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.apiKeys.create({ type: 'PERSONAL' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Optional name for the API key |
| `type` | `PERSONAL \| GRID \| WORKSPACE_MANAGE_ALL \| WORKSPACE_EXPORT_METRICS \| WORKSPACE_INVOKE \| WORKSPACE_MANAGE_API_KEYS` | Yes | Enum representing the category of an API key. |
| `model_ids` | `string[] \| null` | No | List of model IDs to scope the API key to, only present if type is 'WORKSPACE\_EXPORT\_METRICS' or 'WORKSPACE\_INVOKE' |
| `expires_at` | `string \| null` | No | Expiration time in UTC. Must be in the future. Personal keys must expire within 90 days, or sooner if your organization sets a lower limit. Team and organization keys require an expiration within your organization's limit when one is set; otherwise they may omit it or use null. Organization lifetime limits do not apply to Grid keys. |
| `team_id` | `string \| null` | No | Team ID for a team-scoped key. When omitted, uses the team in the URL if present, otherwise your organization's default team. Must match the URL team when both are provided. Not supported for PERSONAL or WORKSPACE\_MANAGE\_API\_KEYS keys. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `api_key` | `string \| null` | No | The API key string |

***

### delete

`apiKeys.delete`

Deletes an API key by prefix. Deletes an API key by prefix and returns info about the API key. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.apiKeys.delete({ api_key_prefix: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `api_key_prefix` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `prefix` | `string \| null` | No | Unique prefix of the API key |

***

### list

`apiKeys.list`

Lists API keys (metadata only, no plain text keys). Returns metadata for your personal API keys and the workspace and team API keys you can manage. Organization admins also receive every member's personal API keys, each with an owner identifying the member it belongs to. Prefixes and metadata only: key secrets are never returned.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.apiKeys.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `type` | `PERSONAL \| GRID \| WORKSPACE_MANAGE_ALL \| WORKSPACE_EXPORT_METRICS \| WORKSPACE_INVOKE \| WORKSPACE_MANAGE_API_KEYS \| null` | No | Filter by API key type |
| `created_by_me` | `boolean` | No | Return only keys created by the authenticated user |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `keys` | `object[] \| null` | No | A list of API key information |

> [accordion] keys full type
>
> ```ts theme={null}
> {
>   prefix?: string | null,
>   name?: string | null | null,
>   type?: string | null,
>   model_ids?: string[] | null | null,
>   team_name?: string | null | null,
>   created_at?: string | null,
>   expires_at?: string | null | null,
>   last_used_at?: string | null | null,
>   owner?: {
>     user_id?: string | null,
>     email?: string | null | null,
>     name?: string | null | null
>   } | null | null
> }[] | null
> ```

***

## Audit Logs

### list

`auditLogs.list`

Gets the audit log for the workspace. Returns audit-log entries across the workspace, newest first, covering models, chains, and workspace-level actions. Use the filters to narrow by event type, actor, resource, environment, source, or time window, and the cursor to page.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.auditLogs.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of entries to return per page. Defaults to 20, and must be between 1 and 200. |
| `direction` | `DESC \| ASC` | No | Sort order of returned entries, by creation time. |
| `search` | `string \| null` | No | Case-insensitive substring matched against resource names and IDs in the entry. |
| `event_type_groups` | `(DEPLOYED \| PROMOTED \| ACTIVATED_DEACTIVATED \| AUTOSCALING_SETTINGS \| REQUEST_BACKPRESSURE_SETTINGS \| INSTANCE_TYPE_CHANGED \| ENVIRONMENT_SETTINGS \| REPLICA_TERMINATED \| DELETED \| METADATA \| SECRETS \| API_KEYS \| GATEWAY \| GRID \| WEBHOOK_SIGNING_SECRETS \| USER_MANAGEMENT \| DIRECTORY_GROUP_MANAGEMENT \| SSH \| TELEMETRY_EXPORT \| WORKLOAD_IDENTITY \| ACCESS_CONTROL)[]` | No | When set, returns only entries whose event type falls in one of these groups. |
| `user_ids` | `string[]` | No | When set, returns only entries whose acting user is one of these IDs. |
| `deployment_ids` | `string[]` | No | When set, returns only entries referencing one of these model deployment IDs. |
| `chain_deployment_ids` | `string[]` | No | When set, returns only entries referencing one of these chain deployment IDs. |
| `environment_names` | `string[]` | No | When set, returns only entries for one of these environments. |
| `sources` | `(UI \| API \| MCP \| SYSTEM \| OTHER)[]` | No | When set, returns only entries issued from one of these surfaces. |
| `start_epoch_millis` | `number \| null` | No | Epoch milliseconds for the start of the window. Defaults to the beginning of the audit-log history. |
| `end_epoch_millis` | `number \| null` | No | Epoch milliseconds for the end of the window. Defaults to the current time. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created?: string | null,
>   event_type?: string | null,
>   event_data?: {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     scale_previous_to_zero?: boolean | null,
>     trusted?: boolean | null,
>     publish?: boolean | null,
>     environment_name?: string | null | null,
>     region_update?: string | null | null,
>     instance_type_id_update?: string | null | null,
>     promotion_settings_override?: {
>       redeploy_on_promotion?: boolean | null | null,
>       rolling_deploy?: boolean | null | null,
>       rolling_deploy_strategy?: string | null | null,
>       max_unavailable_percent?: number | null | null,
>       max_surge_percent?: number | null | null,
>       stabilization_time_seconds?: number | null | null,
>       replica_overhead_percent?: number | null | null,
>       promotion_cleanup_strategy?: string | null | null
>     } | null | null,
>     autoscaling_settings_update?: {
>       min_replica?: number | null | null,
>       max_replica?: number | null | null,
>       concurrency_target?: number | null | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     request_backpressure_settings_update?: {
>       policy?: string | null | null
>     } | null | null,
>     autoscaling_schedule_settings_update?: {
>       timezone?: string | null | null,
>       schedules?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null,
>         schedule_id?: string | null | null
>       }[] | null,
>       delete_schedule_ids?: string[] | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     retried?: boolean | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     environment_name?: string | null | null,
>     environment_id?: string | null | null,
>     region_update?: string | null | null,
>     instance_type_id_update?: string | null | null,
>     promotion_settings_override?: {
>       redeploy_on_promotion?: boolean | null | null,
>       rolling_deploy?: boolean | null | null,
>       rolling_deploy_strategy?: string | null | null,
>       max_unavailable_percent?: number | null | null,
>       max_surge_percent?: number | null | null,
>       stabilization_time_seconds?: number | null | null,
>       replica_overhead_percent?: number | null | null,
>       promotion_cleanup_strategy?: string | null | null
>     } | null | null,
>     autoscaling_settings_update?: {
>       min_replica?: number | null | null,
>       max_replica?: number | null | null,
>       concurrency_target?: number | null | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     request_backpressure_settings_update?: {
>       policy?: string | null | null
>     } | null | null,
>     autoscaling_schedule_settings_update?: {
>       timezone?: string | null | null,
>       schedules?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null,
>         schedule_id?: string | null | null
>       }[] | null,
>       delete_schedule_ids?: string[] | null
>     } | null | null
>   } | {
>     schedules?: {
>       action?: string | null,
>       schedule_id?: string | null,
>       previous?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null
>       } | null | null,
>       current?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null
>       } | null | null
>     }[] | null | null,
>     min_replica?: number | null,
>     max_replica?: number | null,
>     concurrency_target?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null,
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     deployment_type?: string | null | null,
>     previous_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       concurrency_target?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     policy?: string | null | null,
>     previous_policy?: string | null | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     instance_type_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     previous_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null,
>     is_primary?: boolean | null,
>     publish?: boolean | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null,
>     environment_name?: string | null | null,
>     environment_id?: string | null | null
>   } | {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     concurrency_target?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null,
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null,
>     chainlet_name?: string | null,
>     chainlet_id?: string | null,
>     previous_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       concurrency_target?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null,
>     chainlet_name?: string | null,
>     chainlet_id?: string | null,
>     instance_type_name?: string | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     deployment_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     environment_name?: string | null,
>     redeploy_on_promotion?: boolean | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     environment_name?: string | null,
>     redeploy_on_promotion?: boolean | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null
>   } | {
>     event_type?: string | null,
>     secret_id?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     secret_id?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     api_key_id?: string | null,
>     api_key_type?: string | null,
>     prefix?: string | null
>   } | {
>     event_type?: string | null,
>     api_key_id?: string | null,
>     api_key_type?: string | null,
>     prefix?: string | null,
>     revocation_reason?: string | null | null
>   } | {
>     event_type?: string | null,
>     organization_id?: string | null,
>     previous_personal_limit_days?: number | null | null,
>     new_personal_limit_days?: number | null | null,
>     previous_team_limit_days?: number | null | null,
>     new_team_limit_days?: number | null | null
>   } | {
>     event_type?: string | null,
>     organization_id?: string | null,
>     previous_allow_personal_api_keys?: boolean | null,
>     new_allow_personal_api_keys?: boolean | null,
>     previous_allow_service_account_api_keys?: boolean | null,
>     new_allow_service_account_api_keys?: boolean | null
>   } | {
>     event_type?: string | null,
>     gateway_endpoint_id?: string | null,
>     slug?: string | null
>   } | {
>     event_type?: string | null,
>     gateway_endpoint_id?: string | null,
>     slug?: string | null,
>     previous_slug?: string | null | null
>   } | {
>     event_type?: string | null,
>     gateway_endpoint_id?: string | null,
>     slug?: string | null
>   } | {
>     event_type?: string | null,
>     provider_connection_id?: string | null,
>     provider?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     provider_connection_id?: string | null,
>     provider?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     provider_connection_id?: string | null,
>     provider?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     machine_user_id?: string | null,
>     machine_user_name?: string | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     machine_user_id?: string | null,
>     machine_user_name?: string | null,
>     previous_machine_user_name?: string | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     machine_user_id?: string | null,
>     machine_user_name?: string | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     grid_guardrail_id?: string | null,
>     guardrail_name?: string | null,
>     provider?: string | null,
>     provider_guardrail_id?: string | null | null,
>     provider_guardrail_version?: string | null | null,
>     enabled?: boolean | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     grid_guardrail_id?: string | null,
>     guardrail_name?: string | null,
>     provider?: string | null,
>     provider_guardrail_id?: string | null | null,
>     provider_guardrail_version?: string | null | null,
>     enabled?: boolean | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     grid_guardrail_id?: string | null,
>     guardrail_name?: string | null,
>     provider?: string | null,
>     provider_guardrail_id?: string | null | null,
>     provider_guardrail_version?: string | null | null,
>     enabled?: boolean | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     invited_user_email?: string | null,
>     role_name?: string | null
>   } | {
>     event_type?: string | null,
>     new_user_email?: string | null,
>     user_id?: string | null
>   } | {
>     event_type?: string | null,
>     webhook_signing_secret_id?: string | null
>   } | {
>     event_type?: string | null,
>     webhook_signing_secret_id?: string | null
>   } | {
>     event_type?: string | null,
>     webhook_signing_secret_id?: string | null
>   } | {
>     event_type?: string | null,
>     user_id?: string | null,
>     user_email?: string | null,
>     new_role_name?: string | null
>   } | {
>     event_type?: string | null,
>     user_id?: string | null,
>     user_email?: string | null,
>     team_id?: string | null,
>     team_name?: string | null,
>     new_role_name?: string | null
>   } | {
>     event_type?: string | null,
>     removed_user_email?: string | null
>   } | {
>     event_type?: string | null,
>     directory_group_id?: string | null,
>     directory_group_name?: string | null,
>     new_role_name?: string | null,
>     team_id?: string | null | null,
>     team_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     organization_id?: string | null
>   } | {
>     redeploy_on_promotion?: boolean | null | null,
>     rolling_deploy?: boolean | null | null,
>     rolling_deploy_strategy?: string | null | null,
>     max_unavailable_percent?: number | null | null,
>     max_surge_percent?: number | null | null,
>     stabilization_time_seconds?: number | null | null,
>     replica_overhead_percent?: number | null | null,
>     promotion_cleanup_strategy?: string | null | null,
>     min_replica?: number | null,
>     max_replica?: number | null,
>     concurrency_target?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null,
>     ramp_up_step_size?: number | null | null,
>     request_backpressure_policy?: string | null | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     environment_name?: string | null,
>     deployment_type?: string | null | null,
>     event_type?: string | null
>   } | {
>     schedules?: {
>       action?: string | null,
>       schedule_id?: string | null,
>       previous?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null
>       } | null | null,
>       current?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null
>       } | null | null
>     }[] | null | null,
>     redeploy_on_promotion?: boolean | null | null,
>     rolling_deploy?: boolean | null | null,
>     rolling_deploy_strategy?: string | null | null,
>     max_unavailable_percent?: number | null | null,
>     max_surge_percent?: number | null | null,
>     stabilization_time_seconds?: number | null | null,
>     replica_overhead_percent?: number | null | null,
>     promotion_cleanup_strategy?: string | null | null,
>     min_replica?: number | null,
>     max_replica?: number | null,
>     concurrency_target?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null,
>     ramp_up_step_size?: number | null | null,
>     request_backpressure_policy?: string | null | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     environment_name?: string | null,
>     deployment_type?: string | null | null,
>     event_type?: string | null,
>     previous_settings?: {
>       redeploy_on_promotion?: boolean | null | null,
>       rolling_deploy?: boolean | null | null,
>       rolling_deploy_strategy?: string | null | null,
>       max_unavailable_percent?: number | null | null,
>       max_surge_percent?: number | null | null,
>       stabilization_time_seconds?: number | null | null,
>       replica_overhead_percent?: number | null | null,
>       promotion_cleanup_strategy?: string | null | null,
>       min_replica?: number | null,
>       max_replica?: number | null,
>       concurrency_target?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null,
>       ramp_up_while_promoting?: boolean | null | null,
>       ramp_up_duration_seconds?: number | null | null,
>       ramp_up_step_size?: number | null | null,
>       request_backpressure_policy?: string | null | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     environment_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     replica_id?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     environment_name?: string | null,
>     environment_id?: string | null | null,
>     action?: string | null
>   } | {
>     event_type?: string | null,
>     workload_type?: string | null,
>     workload_id?: string | null,
>     project_id?: string | null,
>     replica_id?: string | null,
>     proxy_address?: string | null,
>     expires_at?: string | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     namespace?: string | null,
>     volume_name?: string | null,
>     versions_deleted?: number | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     namespace?: string | null,
>     volume_name?: string | null,
>     version?: string | null,
>     digest?: string | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     namespace?: string | null,
>     volume_name?: string | null,
>     version?: string | null,
>     digest?: string | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     tag?: string | null,
>     digest?: string | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     tag?: string | null,
>     deleted?: boolean | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     expires_at?: string | null | null,
>     previous_expires_at?: string | null | null
>   } | {
>     telemetry_export_configuration_id?: string | null,
>     event_type?: string | null
>   } | {
>     telemetry_export_configuration_id?: string | null,
>     event_type?: string | null,
>     credential_rotated?: boolean | null,
>     enabled?: boolean | null | null
>   } | {
>     telemetry_export_configuration_id?: string | null,
>     event_type?: string | null
>   } | {
>     event_type?: string | null,
>     service_account_id?: string | null,
>     name?: string | null,
>     description?: string | null | null,
>     owner_team_id?: string | null | null,
>     preset_permissions?: {
>       api_key_type?: string | null,
>       model_ids?: string[] | null,
>       environment_names?: string[] | null,
>       model_api_slugs?: string[] | null
>     } | null
>   } | {
>     event_type?: string | null,
>     service_account_id?: string | null,
>     name?: string | null,
>     changes?: Record<string, {
>       old?: any | null,
>       new?: any | null
>     }> | null
>   } | {
>     event_type?: string | null,
>     service_account_id?: string | null,
>     name?: string | null
>   } | {
>     event_type?: string | null,
>     identity_provider_id?: string | null,
>     name?: string | null,
>     description?: string | null | null,
>     predefined?: {
>       kind?: string | null,
>       issuer_url?: string | null
>     } | null | null,
>     custom?: {
>       issuer_url?: string | null,
>       jwks?: {
>       } | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     identity_provider_id?: string | null,
>     name?: string | null,
>     changes?: Record<string, {
>       old?: any | null,
>       new?: any | null
>     }> | null
>   } | {
>     event_type?: string | null,
>     identity_provider_id?: string | null,
>     name?: string | null
>   } | {
>     event_type?: string | null,
>     trust_rule_id?: string | null,
>     name?: string | null,
>     description?: string | null | null,
>     identity_provider_id?: string | null,
>     service_account_id?: string | null,
>     condition?: string | null,
>     audience?: string | null,
>     max_access_token_lifetime_seconds?: number | null
>   } | {
>     event_type?: string | null,
>     trust_rule_id?: string | null,
>     name?: string | null,
>     changes?: Record<string, {
>       old?: any | null,
>       new?: any | null
>     }> | null
>   } | {
>     event_type?: string | null,
>     trust_rule_id?: string | null,
>     name?: string | null
>   } | {
>     event_type?: string | null,
>     role_id?: string | null,
>     name?: string | null,
>     kind?: string | null,
>     team_id?: string | null | null,
>     description?: string | null | null,
>     permissions?: string[] | null,
>     includes?: string[] | null
>   } | {
>     event_type?: string | null,
>     role_id?: string | null,
>     name?: string | null,
>     changes?: Record<string, {
>       old?: any | null,
>       new?: any | null
>     }> | null
>   } | {
>     event_type?: string | null,
>     role_id?: string | null,
>     name?: string | null
>   } | {
>     event_type?: string | null,
>     role_assignment_id?: string | null,
>     role_id?: string | null,
>     role_name?: string | null,
>     subject_type?: string | null,
>     subject_id?: string | null,
>     team_id?: string | null | null,
>     resource_sets?: {
>       all_of?: {
>         resource_type?: string | null,
>         resource_id?: string | null
>       }[] | null
>     }[] | null
>   } | {
>     event_type?: string | null,
>     role_assignment_id?: string | null,
>     role_id?: string | null,
>     subject_type?: string | null,
>     subject_id?: string | null,
>     team_id?: string | null | null
>   } | {
>     event_type?: string | null,
>     organization_id?: string | null,
>     previous_allow_team_admins_to_manage_roles?: boolean | null,
>     new_allow_team_admins_to_manage_roles?: boolean | null
>   } | null,
>   source?: string | null | null,
>   actor?: {
>     type?: string | null,
>     email?: string | null | null,
>     api_key_prefix?: string | null | null,
>     api_key_name?: string | null | null,
>     service_account_id?: string | null | null,
>     service_account_name?: string | null | null,
>     trust_rule_id?: string | null | null
>   } | null,
>   client_name?: string | null | null,
>   client_version?: string | null | null,
>   client_session_id?: string | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

## Billing

### getModelApiCosts

`billing.getModelApiCosts`

Gets daily Model APIs costs. Returns daily Model API costs in USD for the teams you can manage, with optional filtering and grouping by API key, user, model, service tier, and team.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.billing.getModelApiCosts({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Number of daily cost buckets to return. Defaults to 7; maximum 31. |
| `start_date` | `string \| null` | No | Inclusive UTC calendar day at the start of the query range. Defaults to the previous UTC date, cannot be before 2026-08-05, and is ignored when you pass a cursor. |
| `end_date` | `string \| null` | No | Exclusive UTC calendar day at the end of the query range. Defaults to the day after the current UTC date so current-day usage is included. The date range cannot exceed 90 days. |
| `group_by` | `(api_key_prefix \| user \| model \| service_tier \| team)[]` | No | Dimensions to break costs down by, repeated once per dimension: api\_key\_prefix, user, model, service\_tier, or team. Each result represents one observed combination of the requested dimensions within that day. For example, grouping by api\_key\_prefix and user returns each API-key and user pair that had usage. Combinations without usage are omitted, so result counts can differ between days. Omit for daily totals across all teams you can manage. |
| `api_key_prefixes` | `string[]` | No | Return only costs for these exact API key prefixes, repeated once per prefix. |
| `user_ids` | `string[]` | No | Return only costs attributed to these exact user IDs, repeated once per ID. |
| `models` | `string[]` | No | Return only costs for these exact model identifiers, repeated once per model. |
| `service_tiers` | `string[]` | No | Return only costs for these exact service tiers, repeated once per tier. |
| `team_ids` | `string[]` | No | Return only costs attributed to these teams, repeated once per team. Defaults to all teams you can manage. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   date?: string | null,
>   results?: {
>     api_key_prefixes?: string[] | null | null,
>     user_id?: string | null | null,
>     model?: string | null | null,
>     service_tier?: string | null | null,
>     team_id?: string | null | null,
>     subtotal?: string | null
>   }[] | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### getToolCallUsage

`billing.getToolCallUsage`

Gets server-side tool call usage. Returns your organization's server-side tool call usage (web search and fetch tools Baseten executes on your behalf) as daily rows grouped by provider, charge unit (sku), and model. Defaults to teams you can manage; org admins include all organization history.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.billing.getToolCallUsage({ start_date: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `start_date` | `string` | Yes | Inclusive UTC calendar day at the start of the query range. |
| `end_date` | `string \| null` | No | Exclusive UTC calendar day at the end of the query range. Defaults to the day after the current UTC date so current-day usage is included. The date range cannot exceed 90 days. |
| `team_ids` | `string[]` | No | Return only usage for these teams, repeated once per team. Defaults to all teams you can manage. An unauthorized team ID causes a 403 response. |
| `group_by` | `TEAM[]` | No | Pass TEAM to split daily rows by team. Defaults to aggregating across teams. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   date?: string | null,
>   provider?: string | null,
>   sku?: string | null,
>   model?: string | null,
>   calls?: number | null,
>   quantity?: number | null,
>   team_id?: string | null | null
> }[] | null
> ```

***

### getUsageSummary

`billing.getUsageSummary`

Gets billing usage summary for a date range. Returns billing usage within \[start\_date, end\_date): the start date is inclusive and the end date is exclusive. Both dates are normalized to midnight UTC. Includes dedicated model serving, training, and model APIs usage. For multi-team organizations, Model APIs usage is split by team.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.billing.getUsageSummary({ start_date: 'example', end_date: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `start_date` | `string` | Yes | Inclusive start date (ISO 8601, normalized to midnight UTC). Earliest queryable: 2026-01-01. |
| `end_date` | `string` | Yes | Exclusive end date (ISO 8601, normalized to midnight UTC). Date range cannot exceed 31 days. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `dedicated_usage` | `object \| null` | No | Dedicated model serving usage |
| `training_usage` | `object \| null` | No | Training usage |
| `model_apis_usage` | `object \| null` | No | Model APIs usage |
| `loops_usage` | `object \| null` | No | Serverless Loops usage, billed per token. Loops usage on dedicated trainers and samplers is billed by the minute and is part of training usage. |

> [accordion] dedicated\_usage full type
>
> ```ts theme={null}
> {
>   subtotal?: number | string | null,
>   credits_used?: number | string | null,
>   total?: number | string | null,
>   minutes?: number | null,
>   breakdown?: {
>     billable_resource?: {
>       id?: string | null,
>       kind?: string | null,
>       name?: string | null | null,
>       model_id?: string | null | null,
>       model_name?: string | null | null,
>       is_deleted?: boolean | null,
>       instance_type?: string | null | null,
>       base_model?: string | null | null,
>       environment_name?: string | null | null,
>       chain_metadata?: {
>         chain_id?: string | null,
>         chain_name?: string | null | null,
>         chain_deployment_id?: string | null
>       } | null | null,
>       team_id?: string | null | null,
>       team_name?: string | null | null
>     } | null,
>     subtotal?: number | string | null,
>     compute_cost?: number | string | null,
>     surcharge_cost?: number | string | null,
>     minutes?: number | null,
>     inference_requests?: number | null,
>     daily?: {
>       date?: string | null,
>       subtotal?: number | string | null,
>       compute_cost?: number | string | null,
>       surcharge_cost?: number | string | null,
>       minutes?: number | null,
>       inference_requests?: number | null
>     }[] | null
>   }[] | null
> } | null | null
> ```

> [accordion] training\_usage full type
>
> ```ts theme={null}
> {
>   subtotal?: number | string | null,
>   credits_used?: number | string | null,
>   total?: number | string | null,
>   minutes?: number | null,
>   breakdown?: {
>     billable_resource?: {
>       id?: string | null,
>       kind?: string | null,
>       name?: string | null | null,
>       model_id?: string | null | null,
>       model_name?: string | null | null,
>       is_deleted?: boolean | null,
>       instance_type?: string | null | null,
>       base_model?: string | null | null,
>       environment_name?: string | null | null,
>       chain_metadata?: {
>         chain_id?: string | null,
>         chain_name?: string | null | null,
>         chain_deployment_id?: string | null
>       } | null | null,
>       team_id?: string | null | null,
>       team_name?: string | null | null
>     } | null,
>     subtotal?: number | string | null,
>     minutes?: number | null,
>     daily?: {
>       date?: string | null,
>       subtotal?: number | string | null,
>       minutes?: number | null
>     }[] | null
>   }[] | null
> } | null | null
> ```

> [accordion] model\_apis\_usage full type
>
> ```ts theme={null}
> {
>   subtotal?: number | string | null,
>   credits_used?: number | string | null,
>   total?: number | string | null,
>   breakdown?: {
>     model_name?: string | null,
>     model_family?: string | null | null,
>     subtotal?: number | string | null,
>     team_id?: string | null | null,
>     team_name?: string | null | null,
>     input_tokens?: number | null,
>     output_tokens?: number | null,
>     cached_input_tokens?: number | null,
>     daily?: {
>       date?: string | null,
>       subtotal?: number | string | null,
>       input_tokens?: number | null,
>       output_tokens?: number | null,
>       cached_input_tokens?: number | null
>     }[] | null
>   }[] | null
> } | null | null
> ```

> [accordion] loops\_usage full type
>
> ```ts theme={null}
> {
>   subtotal?: number | string | null,
>   credits_used?: number | string | null,
>   total?: number | string | null,
>   breakdown?: {
>     subtotal?: number | string | null,
>     uncached_prefill?: {
>       tokens?: number | null,
>       subtotal?: number | string | null
>     } | null,
>     cached_prefill?: {
>       tokens?: number | null,
>       subtotal?: number | string | null
>     } | null,
>     sample?: {
>       tokens?: number | null,
>       subtotal?: number | string | null
>     } | null,
>     train?: {
>       tokens?: number | null,
>       subtotal?: number | string | null
>     } | null,
>     base_model?: string | null,
>     daily?: {
>       subtotal?: number | string | null,
>       uncached_prefill?: {
>         tokens?: number | null,
>         subtotal?: number | string | null
>       } | null,
>       cached_prefill?: {
>         tokens?: number | null,
>         subtotal?: number | string | null
>       } | null,
>       sample?: {
>         tokens?: number | null,
>         subtotal?: number | string | null
>       } | null,
>       train?: {
>         tokens?: number | null,
>         subtotal?: number | string | null
>       } | null,
>       date?: string | null
>     }[] | null,
>     breakdown?: {
>       subtotal?: number | string | null,
>       uncached_prefill?: {
>         tokens?: number | null,
>         subtotal?: number | string | null
>       } | null,
>       cached_prefill?: {
>         tokens?: number | null,
>         subtotal?: number | string | null
>       } | null,
>       sample?: {
>         tokens?: number | null,
>         subtotal?: number | string | null
>       } | null,
>       train?: {
>         tokens?: number | null,
>         subtotal?: number | string | null
>       } | null,
>       billable_resource?: {
>         id?: string | null,
>         kind?: string | null,
>         name?: string | null | null,
>         model_id?: string | null | null,
>         model_name?: string | null | null,
>         is_deleted?: boolean | null,
>         instance_type?: string | null | null,
>         base_model?: string | null | null,
>         environment_name?: string | null | null,
>         chain_metadata?: {
>           chain_id?: string | null,
>           chain_name?: string | null | null,
>           chain_deployment_id?: string | null
>         } | null | null,
>         team_id?: string | null | null,
>         team_name?: string | null | null
>       } | null,
>       daily?: {
>         subtotal?: number | string | null,
>         uncached_prefill?: {
>           tokens?: number | null,
>           subtotal?: number | string | null
>         } | null,
>         cached_prefill?: {
>           tokens?: number | null,
>           subtotal?: number | string | null
>         } | null,
>         sample?: {
>           tokens?: number | null,
>           subtotal?: number | string | null
>         } | null,
>         train?: {
>           tokens?: number | null,
>           subtotal?: number | string | null
>         } | null,
>         date?: string | null
>       }[] | null
>     }[] | null
>   }[] | null
> } | null | null
> ```

***

## Blobs

### getModelCredentials

`blobs.getModelCredentials`

Gets blob credentials for models. (GET /v1/blobs/credentials/model)

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.blobs.getModelCredentials({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `creds` | `object \| null` | No | AWS credentials |
| `s3_key` | `string \| null` | No | The S3 key to upload the blob to |
| `s3_bucket` | `string \| null` | No | The S3 bucket to upload the blob to |

> [accordion] creds full type
>
> ```ts theme={null}
> {
>   aws_access_key_id?: string | null,
>   aws_secret_access_key?: string | null,
>   aws_session_token?: string | null
> } | null
> ```

***

### getTrainingCredentials

`blobs.getTrainingCredentials`

Gets blob credentials for training. (GET /v1/blobs/credentials/train)

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.blobs.getTrainingCredentials({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `creds` | `object \| null` | No | AWS credentials |
| `s3_key` | `string \| null` | No | The S3 key to upload the blob to |
| `s3_bucket` | `string \| null` | No | The S3 bucket to upload the blob to |

> [accordion] creds full type
>
> ```ts theme={null}
> {
>   aws_access_key_id?: string | null,
>   aws_secret_access_key?: string | null,
>   aws_session_token?: string | null
> } | null
> ```

***

## Chains

### delete

`chains.delete`

Deletes a chain by ID. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.chains.delete({ chain_id: 'chn12345' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the chain |
| `deleted` | `boolean \| null` | No | Whether the chain was deleted |

***

### deployments.deactivate

`chains.deployments.deactivate`

Deactivates a chain deployment. Deactivates a chain deployment and returns the deactivation status.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.chains.deployments.deactivate({ chain_id: 'chn12345', chain_deployment_id: 'cdp12345' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |
| `chain_deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the deployment was successfully deactivated |
| `no_op` | `boolean \| null` | No | Whether the request did nothing because the deployment was already inactive |

***

### deployments.delete

`chains.deployments.delete`

Deletes a chain deployment by ID. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.chains.deployments.delete({ chain_id: 'chn12345', chain_deployment_id: 'cdp12345' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |
| `chain_deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the chain deployment |
| `deleted` | `boolean \| null` | No | Whether the chain deployment was deleted |
| `chain_id` | `string \| null` | No | Unique identifier of the chain |

***

### deployments.get

`chains.deployments.get`

Gets a chain deployment by ID. (GET /v1/chains/\{chain\_id}/deployments/\{chain\_deployment\_id})

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.chains.deployments.get({ chain_id: 'chn12345', chain_deployment_id: 'cdp12345' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |
| `chain_deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the chain deployment |
| `created_at` | `string \| null` | No | Time the chain deployment was created in ISO 8601 format |
| `chain_id` | `string \| null` | No | Unique identifier of the chain |
| `environment` | `string \| null \| null` | No | Environment the chain deployment is deployed in |
| `chainlets` | `object[] \| null` | No | Chainlets in the chain deployment |
| `status` | `string \| null` | No | The status of a deployment. |

> [accordion] chainlets full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type_name?: string | null,
>   active_replica_count?: number | null,
>   status?: string | null
> }[] | null
> ```

***

### deployments.getChainletLogs

`chains.deployments.getChainletLogs`

Gets the logs for a chainlet within a chain deployment. Resolves the chainlet (by ID, scoped to the given chain deployment) to its underlying model deployment and returns its logs in the given time range.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.chains.deployments.getChainletLogs({ chain_id: 'chn12345', chain_deployment_id: 'cdp12345', chainlet_id: 'clt12345' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |
| `chain_deployment_id` | `string` | Yes | — |
| `chainlet_id` | `string` | Yes | — |
| `start_epoch_millis` | `number \| null` | No | Epoch milliseconds at which to start fetching logs. Defaults to 30 minutes before the end. The window from start to end must not exceed 7 days. |
| `end_epoch_millis` | `number \| null` | No | Epoch milliseconds at which to stop fetching logs. Defaults to the current time. |
| `direction` | `asc \| desc \| null` | No | Sort order for logs |
| `limit` | `number \| null` | No | Limit of logs to fetch in a single request |
| `min_level` | `DEBUG \| INFO \| WARNING \| ERROR \| null` | No | Minimum log severity to include. Omit to return all log lines, including lines that have no level. Any explicit value returns lines at or above that severity and drops lines without a level. |
| `replica` | `string \| null` | No | Only return logs emitted by this replica (5-char short ID). |
| `request_id` | `string \| null` | No | Only return logs tagged with this inference request ID. |
| `component` | `string \| null` | No | Only return logs from this component. |
| `search_pattern` | `string \| null` | No | RE2 regular expression matched against the log message. Prefer `includes` and `excludes` for plain substring matches. |
| `includes` | `string[]` | No | Case-sensitive substrings that must all appear in the log message. |
| `excludes` | `string[]` | No | Case-sensitive substrings; lines containing any of these are dropped. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `logs` | `object[] \| null` | No | Logs for a specific entity. |

> [accordion] logs full type
>
> ```ts theme={null}
> {
>   timestamp?: string | null,
>   message?: string | null,
>   replica?: string | null | null,
>   request_id?: string | null | null,
>   level?: string | null | null
> }[] | null
> ```

***

### deployments.list

`chains.deployments.list`

Gets all chain deployments. (GET /v1/chains/\{chain\_id}/deployments)

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.chains.deployments.list({ chain_id: 'chn12345' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deployments` | `object[] \| null` | No | A list of chain deployments |

> [accordion] deployments full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   chain_id?: string | null,
>   environment?: string | null | null,
>   chainlets?: {
>     id?: string | null,
>     name?: string | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     instance_type_name?: string | null,
>     active_replica_count?: number | null,
>     status?: string | null
>   }[] | null,
>   status?: string | null
> }[] | null
> ```

***

### environments.create

`chains.environments.create`

Creates a chain environment. Creates a chain environment. Returns the resulting environment.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.chains.environments.create({ chain_id: 'chn12345', name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |
| `name` | `string` | Yes | Name of the environment |
| `promotion_settings` | `object \| null` | No | Promotion settings for the environment |
| `chainlet_settings` | `object[] \| null` | No | Mapping of chainlet name to the desired chainlet environment settings |

> [accordion] promotion\_settings full type
>
> ```ts theme={null}
> {
>   redeploy_on_promotion?: boolean | null,
>   rolling_deploy?: boolean | null,
>   promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>   rolling_deploy_config?: {
>     rolling_deploy_strategy?: REPLICA | null,
>     max_surge_percent?: number | null,
>     max_unavailable_percent?: number | null,
>     stabilization_time_seconds?: number | null,
>     replica_overhead_percent?: number | null
>   } | null,
>   ramp_up_while_promoting?: boolean | null,
>   ramp_up_duration_seconds?: number | null
> } | null
> ```

> [accordion] chainlet\_settings full type
>
> ```ts theme={null}
> {
>   chainlet_name: string,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null,
>     scale_down_delay?: number | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null,
>     target_in_flight_tokens?: number | null,
>     max_scale_down_rate?: number | null
>   } | null,
>   instance_type_id?: string
> }[] | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Name of the environment |
| `created_at` | `string \| null` | No | Time the environment was created in ISO 8601 format |
| `chain_id` | `string \| null` | No | Unique identifier of the chain |
| `promotion_settings` | `object \| null` | No | Promotion settings for promoting chains and oracles |
| `chainlet_settings` | `object[] \| null` | No | Environment settings for the chainlets |
| `current_deployment` | `object \| null` | No | Current chain deployment of the environment |
| `candidate_deployment` | `object \| null` | No | Candidate chain deployment being promoted to the environment, if a promotion is in progress |
| `in_progress_promotion` | `object \| null` | No | Details of the in-progress promotion, if any |

> [accordion] promotion\_settings full type
>
> ```ts theme={null}
> {
>   redeploy_on_promotion?: boolean | null | null,
>   rolling_deploy?: boolean | null | null,
>   promotion_cleanup_strategy?: string | null | null,
>   rolling_deploy_config?: {
>     rolling_deploy_strategy?: string | null,
>     max_surge_percent?: number | null,
>     max_unavailable_percent?: number | null,
>     stabilization_time_seconds?: number | null,
>     replica_overhead_percent?: number | null
>   } | null | null,
>   ramp_up_while_promoting?: boolean | null | null,
>   ramp_up_duration_seconds?: number | null | null
> } | null
> ```

> [accordion] chainlet\_settings full type
>
> ```ts theme={null}
> {
>   chainlet_name?: string | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null
> }[] | null
> ```

> [accordion] current\_deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   chain_id?: string | null,
>   environment?: string | null | null,
>   chainlets?: {
>     id?: string | null,
>     name?: string | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     instance_type_name?: string | null,
>     active_replica_count?: number | null,
>     status?: string | null
>   }[] | null,
>   status?: string | null
> } | null | null
> ```

> [accordion] candidate\_deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   chain_id?: string | null,
>   environment?: string | null | null,
>   chainlets?: {
>     id?: string | null,
>     name?: string | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     instance_type_name?: string | null,
>     active_replica_count?: number | null,
>     status?: string | null
>   }[] | null,
>   status?: string | null
> } | null | null
> ```

> [accordion] in\_progress\_promotion full type
>
> ```ts theme={null}
> {
>   status?: string | null,
>   percent_traffic_to_new_version?: number | null,
>   error_message?: string | null | null,
>   rolling_deploy?: boolean | null | null
> } | null | null
> ```

***

### environments.get

`chains.environments.get`

Gets a chain environment's details. Gets a chain environment's details and returns the chain environment.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.chains.environments.get({ chain_id: 'chn12345', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Name of the environment |
| `created_at` | `string \| null` | No | Time the environment was created in ISO 8601 format |
| `chain_id` | `string \| null` | No | Unique identifier of the chain |
| `promotion_settings` | `object \| null` | No | Promotion settings for promoting chains and oracles |
| `chainlet_settings` | `object[] \| null` | No | Environment settings for the chainlets |
| `current_deployment` | `object \| null` | No | Current chain deployment of the environment |
| `candidate_deployment` | `object \| null` | No | Candidate chain deployment being promoted to the environment, if a promotion is in progress |
| `in_progress_promotion` | `object \| null` | No | Details of the in-progress promotion, if any |

> [accordion] promotion\_settings full type
>
> ```ts theme={null}
> {
>   redeploy_on_promotion?: boolean | null | null,
>   rolling_deploy?: boolean | null | null,
>   promotion_cleanup_strategy?: string | null | null,
>   rolling_deploy_config?: {
>     rolling_deploy_strategy?: string | null,
>     max_surge_percent?: number | null,
>     max_unavailable_percent?: number | null,
>     stabilization_time_seconds?: number | null,
>     replica_overhead_percent?: number | null
>   } | null | null,
>   ramp_up_while_promoting?: boolean | null | null,
>   ramp_up_duration_seconds?: number | null | null
> } | null
> ```

> [accordion] chainlet\_settings full type
>
> ```ts theme={null}
> {
>   chainlet_name?: string | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null
> }[] | null
> ```

> [accordion] current\_deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   chain_id?: string | null,
>   environment?: string | null | null,
>   chainlets?: {
>     id?: string | null,
>     name?: string | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     instance_type_name?: string | null,
>     active_replica_count?: number | null,
>     status?: string | null
>   }[] | null,
>   status?: string | null
> } | null | null
> ```

> [accordion] candidate\_deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   chain_id?: string | null,
>   environment?: string | null | null,
>   chainlets?: {
>     id?: string | null,
>     name?: string | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     instance_type_name?: string | null,
>     active_replica_count?: number | null,
>     status?: string | null
>   }[] | null,
>   status?: string | null
> } | null | null
> ```

> [accordion] in\_progress\_promotion full type
>
> ```ts theme={null}
> {
>   status?: string | null,
>   percent_traffic_to_new_version?: number | null,
>   error_message?: string | null | null,
>   rolling_deploy?: boolean | null | null
> } | null | null
> ```

***

### environments.list

`chains.environments.list`

Gets all chain environments. Gets all chain environments for a given chain.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.chains.environments.list({ chain_id: 'chn12345' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `environments` | `object[] \| null` | No | — |

> [accordion] environments full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   created_at?: string | null,
>   model_id?: string | null,
>   current_deployment?: {
>     id?: string | null,
>     created_at?: string | null,
>     name?: string | null,
>     model_id?: string | null,
>     is_production?: boolean | null,
>     is_development?: boolean | null,
>     status?: string | null,
>     active_replica_count?: number | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     instance_type_name?: string | null | null,
>     environment?: string | null | null,
>     labels?: {
>     } | null | null,
>     region?: {
>       slug?: string | null,
>       display_name?: string | null
>     } | null | null,
>     request_backpressure_settings?: {
>       policy?: string | null | null
>     } | null,
>     failure_reason?: string | null | null
>   } | null | null,
>   candidate_deployment?: {
>     id?: string | null,
>     created_at?: string | null,
>     name?: string | null,
>     model_id?: string | null,
>     is_production?: boolean | null,
>     is_development?: boolean | null,
>     status?: string | null,
>     active_replica_count?: number | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     instance_type_name?: string | null | null,
>     environment?: string | null | null,
>     labels?: {
>     } | null | null,
>     region?: {
>       slug?: string | null,
>       display_name?: string | null
>     } | null | null,
>     request_backpressure_settings?: {
>       policy?: string | null | null
>     } | null,
>     failure_reason?: string | null | null
>   } | null | null,
>   in_progress_promotion?: {
>     status?: string | null,
>     percent_traffic_to_new_version?: number | null,
>     error_message?: string | null | null,
>     rolling_deploy?: boolean | null | null
>   } | null | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null,
>   promotion_settings?: {
>     redeploy_on_promotion?: boolean | null | null,
>     rolling_deploy?: boolean | null | null,
>     promotion_cleanup_strategy?: string | null | null,
>     rolling_deploy_config?: {
>       rolling_deploy_strategy?: string | null,
>       max_surge_percent?: number | null,
>       max_unavailable_percent?: number | null,
>       stabilization_time_seconds?: number | null,
>       replica_overhead_percent?: number | null
>     } | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null
>   } | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   autoscaling_schedules?: {
>     timezone?: string | null | null,
>     schedules?: (
>       {
>         id?: string | null,
>         name?: string | null,
>         enabled?: boolean | null,
>         autoscaling_settings?: {
>           min_replica?: number | null,
>           max_replica?: number | null,
>           autoscaling_window?: number | null | null,
>           scale_down_delay?: number | null | null,
>           concurrency_target?: number | null | null,
>           target_utilization_percentage?: number | null | null,
>           target_in_flight_tokens?: number | null | null,
>           max_scale_down_rate?: number | null | null
>         } | null,
>         cadence?: string | null,
>         weekdays?: string[] | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null
>       } | {
>         id?: string | null,
>         name?: string | null,
>         enabled?: boolean | null,
>         autoscaling_settings?: {
>           min_replica?: number | null,
>           max_replica?: number | null,
>           autoscaling_window?: number | null | null,
>           scale_down_delay?: number | null | null,
>           concurrency_target?: number | null | null,
>           target_utilization_percentage?: number | null | null,
>           target_in_flight_tokens?: number | null | null,
>           max_scale_down_rate?: number | null | null
>         } | null,
>         cadence?: string | null,
>         start_at?: string | null,
>         end_at?: string | null
>       }
>     )[] | null,
>     applied_state?: {
>       schedule_id?: string | null | null,
>       autoscaling_settings?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         concurrency_target?: number | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null
>       } | null
>     } | null | null
>   } | null | null,
>   traffic_routing?: {
>     rules?: {
>       id?: string | null,
>       type?: string | null,
>       targets?: {
>         model_id?: string | null,
>         deployment_id?: string | null | null,
>         environment?: string | null | null
>       }[] | null,
>       percent_traffic?: number | null,
>       expires_at?: string | null,
>       sampling_mode?: string | null,
>       propagate_client_cancellation?: boolean | null
>     }[] | null
>   } | null | null
> }[] | null
> ```

***

### environments.promote

`chains.environments.promote`

Promotes a chain deployment to an environment. Promotes an existing chain deployment to an environment and returns the promoted chain deployment.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.chains.environments.promote({ chain_id: 'chn12345', env_name: 'staging', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `scale_down_previous_deployment` | `boolean` | No | Whether to scale down the previous deployment after promoting |
| `deployment_id` | `string` | Yes | The id of the chain deployment to promote |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the chain deployment |
| `created_at` | `string \| null` | No | Time the chain deployment was created in ISO 8601 format |
| `chain_id` | `string \| null` | No | Unique identifier of the chain |
| `environment` | `string \| null \| null` | No | Environment the chain deployment is deployed in |
| `chainlets` | `object[] \| null` | No | Chainlets in the chain deployment |
| `status` | `string \| null` | No | The status of a deployment. |

> [accordion] chainlets full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type_name?: string | null,
>   active_replica_count?: number | null,
>   status?: string | null
> }[] | null
> ```

***

### environments.update

`chains.environments.update`

Updates a chain environment's settings. Updates a chain environment's settings and returns the chain environment.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.chains.environments.update({ chain_id: 'chn12345', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `promotion_settings` | `object \| null` | No | Promotion settings for the environment |

> [accordion] promotion\_settings full type
>
> ```ts theme={null}
> {
>   redeploy_on_promotion?: boolean | null,
>   rolling_deploy?: boolean | null,
>   promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>   rolling_deploy_config?: {
>     rolling_deploy_strategy?: REPLICA | null,
>     max_surge_percent?: number | null,
>     max_unavailable_percent?: number | null,
>     stabilization_time_seconds?: number | null,
>     replica_overhead_percent?: number | null
>   } | null,
>   ramp_up_while_promoting?: boolean | null,
>   ramp_up_duration_seconds?: number | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ok` | `boolean \| null` | No | Whether the update was successful |

***

### environments.updateChainletAutoscaling

`chains.environments.updateChainletAutoscaling`

Updates a chainlet environment's autoscaling settings. Updates a chainlet environment's autoscaling settings and returns the updated chainlet environment settings.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.chains.environments.updateChainletAutoscaling({
	chain_id: 'chn12345',
	env_name: 'staging',
	updates: [{
		chainlet_name: 'example',
		autoscaling_settings: {},
	}],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `updates` | `object[]` | Yes | Mapping of chainlet name to the desired chainlet autoscaling settings. If the chainlet name doesn't exist, an error is returned. |

> [accordion] updates full type
>
> ```ts theme={null}
> {
>   chainlet_name: string,
>   autoscaling_settings: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null,
>     scale_down_delay?: number | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null,
>     target_in_flight_tokens?: number | null,
>     max_scale_down_rate?: number | null
>   }
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string \| null` | No | The status of a request to update autoscaling settings. |
| `message` | `string \| null` | No | A message describing the status of the request to update autoscaling settings |

***

### environments.updateChainletInstanceTypes

`chains.environments.updateChainletInstanceTypes`

Updates a chainlet environment's instance type settings. Updates a chainlet environment's instance type settings. The chainlet environment setting must exist. When updated, a new chain deployment is created and deployed. It is promoted to the chain environment according to promotion settings on the environment.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.chains.environments.updateChainletInstanceTypes({
	chain_id: 'chn12345',
	env_name: 'staging',
	updates: [{ chainlet_name: 'example', instance_type_id: 'example' }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `updates` | `object[]` | Yes | Mapping of chainlet name to the desired chainlet instance type. If the chainlet name doesn't exist, an error is returned. |

> [accordion] updates full type
>
> ```ts theme={null}
> {
>   chainlet_name: string,
>   instance_type_id: string
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `requires_redeployment` | `boolean \| null` | No | Whether the resource update requires a re-deployment to update the instance type. |
| `chain_deployment` | `object \| null` | No | The chain deployment resulting from the resource update, if any. |
| `chainlet_environment_settings` | `object[] \| null` | No | The updated chainlet environment settings |

> [accordion] chain\_deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   chain_id?: string | null,
>   environment?: string | null | null,
>   chainlets?: {
>     id?: string | null,
>     name?: string | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     instance_type_name?: string | null,
>     active_replica_count?: number | null,
>     status?: string | null
>   }[] | null,
>   status?: string | null
> } | null | null
> ```

> [accordion] chainlet\_environment\_settings full type
>
> ```ts theme={null}
> {
>   chainlet_name?: string | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null
> }[] | null
> ```

***

### get

`chains.get`

Gets a chain by ID. (GET /v1/chains/\{chain\_id})

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.chains.get({ chain_id: 'chn12345' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the chain |
| `created_at` | `string \| null` | No | Time the chain was created in ISO 8601 format |
| `name` | `string \| null` | No | Name of the chain |
| `deployments_count` | `number \| null` | No | Number of deployments of the chain |
| `team_name` | `string \| null` | No | Name of the team associated with the chain |

***

### getAuditLogs

`chains.getAuditLogs`

Gets the audit log for a chain. Returns audit-log entries for a single chain, newest first. Use the filters to narrow by event type, actor, chain deployment, environment, source, or time window, and the cursor to page.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.chains.getAuditLogs({ chain_id: 'chn12345' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chain_id` | `string` | Yes | — |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of entries to return per page. Defaults to 20, and must be between 1 and 200. |
| `direction` | `DESC \| ASC` | No | Sort order of returned entries, by creation time. |
| `search` | `string \| null` | No | Case-insensitive substring matched against resource names and IDs in the entry. |
| `event_type_groups` | `(DEPLOYED \| PROMOTED \| ACTIVATED_DEACTIVATED \| AUTOSCALING_SETTINGS \| REQUEST_BACKPRESSURE_SETTINGS \| INSTANCE_TYPE_CHANGED \| ENVIRONMENT_SETTINGS \| REPLICA_TERMINATED \| DELETED \| METADATA \| SECRETS \| API_KEYS \| GATEWAY \| GRID \| WEBHOOK_SIGNING_SECRETS \| USER_MANAGEMENT \| DIRECTORY_GROUP_MANAGEMENT \| SSH \| TELEMETRY_EXPORT \| WORKLOAD_IDENTITY \| ACCESS_CONTROL)[]` | No | When set, returns only entries whose event type falls in one of these groups. |
| `user_ids` | `string[]` | No | When set, returns only entries whose acting user is one of these IDs. |
| `deployment_ids` | `string[]` | No | When set, returns only entries referencing one of these model deployment IDs. |
| `chain_deployment_ids` | `string[]` | No | When set, returns only entries referencing one of these chain deployment IDs. |
| `environment_names` | `string[]` | No | When set, returns only entries for one of these environments. |
| `sources` | `(UI \| API \| MCP \| SYSTEM \| OTHER)[]` | No | When set, returns only entries issued from one of these surfaces. |
| `start_epoch_millis` | `number \| null` | No | Epoch milliseconds for the start of the window. Defaults to the beginning of the audit-log history. |
| `end_epoch_millis` | `number \| null` | No | Epoch milliseconds for the end of the window. Defaults to the current time. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created?: string | null,
>   event_type?: string | null,
>   event_data?: {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     scale_previous_to_zero?: boolean | null,
>     trusted?: boolean | null,
>     publish?: boolean | null,
>     environment_name?: string | null | null,
>     region_update?: string | null | null,
>     instance_type_id_update?: string | null | null,
>     promotion_settings_override?: {
>       redeploy_on_promotion?: boolean | null | null,
>       rolling_deploy?: boolean | null | null,
>       rolling_deploy_strategy?: string | null | null,
>       max_unavailable_percent?: number | null | null,
>       max_surge_percent?: number | null | null,
>       stabilization_time_seconds?: number | null | null,
>       replica_overhead_percent?: number | null | null,
>       promotion_cleanup_strategy?: string | null | null
>     } | null | null,
>     autoscaling_settings_update?: {
>       min_replica?: number | null | null,
>       max_replica?: number | null | null,
>       concurrency_target?: number | null | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     request_backpressure_settings_update?: {
>       policy?: string | null | null
>     } | null | null,
>     autoscaling_schedule_settings_update?: {
>       timezone?: string | null | null,
>       schedules?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null,
>         schedule_id?: string | null | null
>       }[] | null,
>       delete_schedule_ids?: string[] | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     retried?: boolean | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     environment_name?: string | null | null,
>     environment_id?: string | null | null,
>     region_update?: string | null | null,
>     instance_type_id_update?: string | null | null,
>     promotion_settings_override?: {
>       redeploy_on_promotion?: boolean | null | null,
>       rolling_deploy?: boolean | null | null,
>       rolling_deploy_strategy?: string | null | null,
>       max_unavailable_percent?: number | null | null,
>       max_surge_percent?: number | null | null,
>       stabilization_time_seconds?: number | null | null,
>       replica_overhead_percent?: number | null | null,
>       promotion_cleanup_strategy?: string | null | null
>     } | null | null,
>     autoscaling_settings_update?: {
>       min_replica?: number | null | null,
>       max_replica?: number | null | null,
>       concurrency_target?: number | null | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     request_backpressure_settings_update?: {
>       policy?: string | null | null
>     } | null | null,
>     autoscaling_schedule_settings_update?: {
>       timezone?: string | null | null,
>       schedules?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null,
>         schedule_id?: string | null | null
>       }[] | null,
>       delete_schedule_ids?: string[] | null
>     } | null | null
>   } | {
>     schedules?: {
>       action?: string | null,
>       schedule_id?: string | null,
>       previous?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null
>       } | null | null,
>       current?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null
>       } | null | null
>     }[] | null | null,
>     min_replica?: number | null,
>     max_replica?: number | null,
>     concurrency_target?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null,
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     deployment_type?: string | null | null,
>     previous_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       concurrency_target?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     policy?: string | null | null,
>     previous_policy?: string | null | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     instance_type_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     previous_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null,
>     is_primary?: boolean | null,
>     publish?: boolean | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null,
>     environment_name?: string | null | null,
>     environment_id?: string | null | null
>   } | {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     concurrency_target?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null,
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null,
>     chainlet_name?: string | null,
>     chainlet_id?: string | null,
>     previous_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       concurrency_target?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null,
>     chainlet_name?: string | null,
>     chainlet_id?: string | null,
>     instance_type_name?: string | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     deployment_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     environment_name?: string | null,
>     redeploy_on_promotion?: boolean | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     environment_name?: string | null,
>     redeploy_on_promotion?: boolean | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null
>   } | {
>     event_type?: string | null,
>     secret_id?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     secret_id?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     api_key_id?: string | null,
>     api_key_type?: string | null,
>     prefix?: string | null
>   } | {
>     event_type?: string | null,
>     api_key_id?: string | null,
>     api_key_type?: string | null,
>     prefix?: string | null,
>     revocation_reason?: string | null | null
>   } | {
>     event_type?: string | null,
>     organization_id?: string | null,
>     previous_personal_limit_days?: number | null | null,
>     new_personal_limit_days?: number | null | null,
>     previous_team_limit_days?: number | null | null,
>     new_team_limit_days?: number | null | null
>   } | {
>     event_type?: string | null,
>     organization_id?: string | null,
>     previous_allow_personal_api_keys?: boolean | null,
>     new_allow_personal_api_keys?: boolean | null,
>     previous_allow_service_account_api_keys?: boolean | null,
>     new_allow_service_account_api_keys?: boolean | null
>   } | {
>     event_type?: string | null,
>     gateway_endpoint_id?: string | null,
>     slug?: string | null
>   } | {
>     event_type?: string | null,
>     gateway_endpoint_id?: string | null,
>     slug?: string | null,
>     previous_slug?: string | null | null
>   } | {
>     event_type?: string | null,
>     gateway_endpoint_id?: string | null,
>     slug?: string | null
>   } | {
>     event_type?: string | null,
>     provider_connection_id?: string | null,
>     provider?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     provider_connection_id?: string | null,
>     provider?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     provider_connection_id?: string | null,
>     provider?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     machine_user_id?: string | null,
>     machine_user_name?: string | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     machine_user_id?: string | null,
>     machine_user_name?: string | null,
>     previous_machine_user_name?: string | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     machine_user_id?: string | null,
>     machine_user_name?: string | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     grid_guardrail_id?: string | null,
>     guardrail_name?: string | null,
>     provider?: string | null,
>     provider_guardrail_id?: string | null | null,
>     provider_guardrail_version?: string | null | null,
>     enabled?: boolean | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     grid_guardrail_id?: string | null,
>     guardrail_name?: string | null,
>     provider?: string | null,
>     provider_guardrail_id?: string | null | null,
>     provider_guardrail_version?: string | null | null,
>     enabled?: boolean | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     grid_guardrail_id?: string | null,
>     guardrail_name?: string | null,
>     provider?: string | null,
>     provider_guardrail_id?: string | null | null,
>     provider_guardrail_version?: string | null | null,
>     enabled?: boolean | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     invited_user_email?: string | null,
>     role_name?: string | null
>   } | {
>     event_type?: string | null,
>     new_user_email?: string | null,
>     user_id?: string | null
>   } | {
>     event_type?: string | null,
>     webhook_signing_secret_id?: string | null
>   } | {
>     event_type?: string | null,
>     webhook_signing_secret_id?: string | null
>   } | {
>     event_type?: string | null,
>     webhook_signing_secret_id?: string | null
>   } | {
>     event_type?: string | null,
>     user_id?: string | null,
>     user_email?: string | null,
>     new_role_name?: string | null
>   } | {
>     event_type?: string | null,
>     user_id?: string | null,
>     user_email?: string | null,
>     team_id?: string | null,
>     team_name?: string | null,
>     new_role_name?: string | null
>   } | {
>     event_type?: string | null,
>     removed_user_email?: string | null
>   } | {
>     event_type?: string | null,
>     directory_group_id?: string | null,
>     directory_group_name?: string | null,
>     new_role_name?: string | null,
>     team_id?: string | null | null,
>     team_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     organization_id?: string | null
>   } | {
>     redeploy_on_promotion?: boolean | null | null,
>     rolling_deploy?: boolean | null | null,
>     rolling_deploy_strategy?: string | null | null,
>     max_unavailable_percent?: number | null | null,
>     max_surge_percent?: number | null | null,
>     stabilization_time_seconds?: number | null | null,
>     replica_overhead_percent?: number | null | null,
>     promotion_cleanup_strategy?: string | null | null,
>     min_replica?: number | null,
>     max_replica?: number | null,
>     concurrency_target?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null,
>     ramp_up_step_size?: number | null | null,
>     request_backpressure_policy?: string | null | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     environment_name?: string | null,
>     deployment_type?: string | null | null,
>     event_type?: string | null
>   } | {
>     schedules?: {
>       action?: string | null,
>       schedule_id?: string | null,
>       previous?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null
>       } | null | null,
>       current?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null
>       } | null | null
>     }[] | null | null,
>     redeploy_on_promotion?: boolean | null | null,
>     rolling_deploy?: boolean | null | null,
>     rolling_deploy_strategy?: string | null | null,
>     max_unavailable_percent?: number | null | null,
>     max_surge_percent?: number | null | null,
>     stabilization_time_seconds?: number | null | null,
>     replica_overhead_percent?: number | null | null,
>     promotion_cleanup_strategy?: string | null | null,
>     min_replica?: number | null,
>     max_replica?: number | null,
>     concurrency_target?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null,
>     ramp_up_step_size?: number | null | null,
>     request_backpressure_policy?: string | null | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     environment_name?: string | null,
>     deployment_type?: string | null | null,
>     event_type?: string | null,
>     previous_settings?: {
>       redeploy_on_promotion?: boolean | null | null,
>       rolling_deploy?: boolean | null | null,
>       rolling_deploy_strategy?: string | null | null,
>       max_unavailable_percent?: number | null | null,
>       max_surge_percent?: number | null | null,
>       stabilization_time_seconds?: number | null | null,
>       replica_overhead_percent?: number | null | null,
>       promotion_cleanup_strategy?: string | null | null,
>       min_replica?: number | null,
>       max_replica?: number | null,
>       concurrency_target?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null,
>       ramp_up_while_promoting?: boolean | null | null,
>       ramp_up_duration_seconds?: number | null | null,
>       ramp_up_step_size?: number | null | null,
>       request_backpressure_policy?: string | null | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     environment_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     replica_id?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     environment_name?: string | null,
>     environment_id?: string | null | null,
>     action?: string | null
>   } | {
>     event_type?: string | null,
>     workload_type?: string | null,
>     workload_id?: string | null,
>     project_id?: string | null,
>     replica_id?: string | null,
>     proxy_address?: string | null,
>     expires_at?: string | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     namespace?: string | null,
>     volume_name?: string | null,
>     versions_deleted?: number | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     namespace?: string | null,
>     volume_name?: string | null,
>     version?: string | null,
>     digest?: string | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     namespace?: string | null,
>     volume_name?: string | null,
>     version?: string | null,
>     digest?: string | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     tag?: string | null,
>     digest?: string | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     tag?: string | null,
>     deleted?: boolean | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     expires_at?: string | null | null,
>     previous_expires_at?: string | null | null
>   } | {
>     telemetry_export_configuration_id?: string | null,
>     event_type?: string | null
>   } | {
>     telemetry_export_configuration_id?: string | null,
>     event_type?: string | null,
>     credential_rotated?: boolean | null,
>     enabled?: boolean | null | null
>   } | {
>     telemetry_export_configuration_id?: string | null,
>     event_type?: string | null
>   } | {
>     event_type?: string | null,
>     service_account_id?: string | null,
>     name?: string | null,
>     description?: string | null | null,
>     owner_team_id?: string | null | null,
>     preset_permissions?: {
>       api_key_type?: string | null,
>       model_ids?: string[] | null,
>       environment_names?: string[] | null,
>       model_api_slugs?: string[] | null
>     } | null
>   } | {
>     event_type?: string | null,
>     service_account_id?: string | null,
>     name?: string | null,
>     changes?: Record<string, {
>       old?: any | null,
>       new?: any | null
>     }> | null
>   } | {
>     event_type?: string | null,
>     service_account_id?: string | null,
>     name?: string | null
>   } | {
>     event_type?: string | null,
>     identity_provider_id?: string | null,
>     name?: string | null,
>     description?: string | null | null,
>     predefined?: {
>       kind?: string | null,
>       issuer_url?: string | null
>     } | null | null,
>     custom?: {
>       issuer_url?: string | null,
>       jwks?: {
>       } | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     identity_provider_id?: string | null,
>     name?: string | null,
>     changes?: Record<string, {
>       old?: any | null,
>       new?: any | null
>     }> | null
>   } | {
>     event_type?: string | null,
>     identity_provider_id?: string | null,
>     name?: string | null
>   } | {
>     event_type?: string | null,
>     trust_rule_id?: string | null,
>     name?: string | null,
>     description?: string | null | null,
>     identity_provider_id?: string | null,
>     service_account_id?: string | null,
>     condition?: string | null,
>     audience?: string | null,
>     max_access_token_lifetime_seconds?: number | null
>   } | {
>     event_type?: string | null,
>     trust_rule_id?: string | null,
>     name?: string | null,
>     changes?: Record<string, {
>       old?: any | null,
>       new?: any | null
>     }> | null
>   } | {
>     event_type?: string | null,
>     trust_rule_id?: string | null,
>     name?: string | null
>   } | {
>     event_type?: string | null,
>     role_id?: string | null,
>     name?: string | null,
>     kind?: string | null,
>     team_id?: string | null | null,
>     description?: string | null | null,
>     permissions?: string[] | null,
>     includes?: string[] | null
>   } | {
>     event_type?: string | null,
>     role_id?: string | null,
>     name?: string | null,
>     changes?: Record<string, {
>       old?: any | null,
>       new?: any | null
>     }> | null
>   } | {
>     event_type?: string | null,
>     role_id?: string | null,
>     name?: string | null
>   } | {
>     event_type?: string | null,
>     role_assignment_id?: string | null,
>     role_id?: string | null,
>     role_name?: string | null,
>     subject_type?: string | null,
>     subject_id?: string | null,
>     team_id?: string | null | null,
>     resource_sets?: {
>       all_of?: {
>         resource_type?: string | null,
>         resource_id?: string | null
>       }[] | null
>     }[] | null
>   } | {
>     event_type?: string | null,
>     role_assignment_id?: string | null,
>     role_id?: string | null,
>     subject_type?: string | null,
>     subject_id?: string | null,
>     team_id?: string | null | null
>   } | {
>     event_type?: string | null,
>     organization_id?: string | null,
>     previous_allow_team_admins_to_manage_roles?: boolean | null,
>     new_allow_team_admins_to_manage_roles?: boolean | null
>   } | null,
>   source?: string | null | null,
>   actor?: {
>     type?: string | null,
>     email?: string | null | null,
>     api_key_prefix?: string | null | null,
>     api_key_name?: string | null | null,
>     service_account_id?: string | null | null,
>     service_account_name?: string | null | null,
>     trust_rule_id?: string | null | null
>   } | null,
>   client_name?: string | null | null,
>   client_version?: string | null | null,
>   client_session_id?: string | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### list

`chains.list`

Gets all chains. (GET /v1/chains)

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.chains.list({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `chains` | `object[] \| null` | No | — |

> [accordion] chains full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   deployments_count?: number | null,
>   team_name?: string | null
> }[] | null
> ```

***

## Deployments

### activate

`deployments.activate`

Activates a deployment. Activates a deployment if not already activated. Starts replicas, which bill while they run.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.deployments.activate({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the deployment was successfully activated |
| `no_op` | `boolean \| null` | No | Whether the request did nothing because the deployment was already active or on its way to becoming active |

***

### create

`deployments.create`

Adds a new deployment to a model. (POST /v1/models/\{model\_id}/deployments)

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.deployments.create({
	model_id: 'abcd1234',
	source: {
		deployment: {
			config: {},
		},
	},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `source` | `object` | Yes | Where the new deployment is created from. |

> [accordion] source full type
>
> ```ts theme={null}
> {
>   kind?: model_archive,
>   deployment: {
>     config: {
>     },
>     raw_config?: string | null,
>     user_env?: {
>     } | null,
>     environment_name?: string | null,
>     create_environment_if_missing?: boolean,
>     region?: string | null,
>     preserve_env_instance_type?: boolean,
>     deploy_timeout_minutes?: number | null,
>     deployment_name?: string | null,
>     labels?: {
>     } | null,
>     is_development?: boolean,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null,
>       scale_down_delay?: number | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null,
>       target_in_flight_tokens?: number | null,
>       max_scale_down_rate?: number | null
>     } | null,
>     request_backpressure_settings?: {
>       policy?: QUEUE_ON_FULL | REJECT_ON_FULL | null
>     } | null,
>     autoscaling_schedule_settings?: {
>       timezone?: string | null,
>       schedules?: (
>         {
>           id?: string | null,
>           name: string,
>           enabled: boolean,
>           autoscaling_settings: {
>             min_replica: number,
>             max_replica: number,
>             autoscaling_window: number | null,
>             scale_down_delay: number | null,
>             concurrency_target: number | null,
>             target_utilization_percentage: number | null,
>             target_in_flight_tokens: number | null,
>             max_scale_down_rate: number | null
>           },
>           cadence: DAILY | HOURLY,
>           weekdays: (SUNDAY | MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY)[],
>           start_hour?: number | null,
>           start_minute: number,
>           end_hour?: number | null,
>           end_minute: number
>         } | {
>           id?: string | null,
>           name: string,
>           enabled: boolean,
>           autoscaling_settings: {
>             min_replica: number,
>             max_replica: number,
>             autoscaling_window: number | null,
>             scale_down_delay: number | null,
>             concurrency_target: number | null,
>             target_utilization_percentage: number | null,
>             target_in_flight_tokens: number | null,
>             max_scale_down_rate: number | null
>           },
>           cadence: ONE_TIME,
>           start_at: string,
>           end_at: string
>         }
>       )[],
>       delete_schedules?: string[]
>     } | null,
>     promotion_settings_override?: {
>       redeploy_on_promotion?: boolean | null,
>       rolling_deploy?: boolean | null,
>       promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>       rolling_deploy_config?: {
>         rolling_deploy_strategy?: REPLICA | null,
>         max_surge_percent?: number | null,
>         max_unavailable_percent?: number | null,
>         stabilization_time_seconds?: number | null,
>         replica_overhead_percent?: number | null
>       } | null,
>       ramp_up_while_promoting?: boolean | null,
>       ramp_up_duration_seconds?: number | null
>     } | null,
>     instance_type_id?: string | null
>   },
>   s3_key?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `model` | `object \| null` | No | A model. |
| `deployment` | `object \| null` | No | A deployment of a model. |

> [accordion] model full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   deployments_count?: number | null,
>   production_deployment_id?: string | null | null,
>   development_deployment_id?: string | null | null,
>   instance_type_name?: string | null,
>   team_name?: string | null
> } | null
> ```

> [accordion] deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   model_id?: string | null,
>   is_production?: boolean | null,
>   is_development?: boolean | null,
>   status?: string | null,
>   active_replica_count?: number | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type_name?: string | null | null,
>   environment?: string | null | null,
>   labels?: {
>   } | null | null,
>   region?: {
>     slug?: string | null,
>     display_name?: string | null
>   } | null | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   failure_reason?: string | null | null
> } | null
> ```

***

### deactivate

`deployments.deactivate`

Deactivates a deployment. Deactivates a deployment if not already deactivated. Scales the deployment to zero: it stops serving until activated again.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.deployments.deactivate({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the deployment was successfully deactivated |
| `no_op` | `boolean \| null` | No | Whether the request did nothing because the deployment was already inactive |

***

### delete

`deployments.delete`

Deletes a model's deployment by ID. Deletes a model's deployment by ID and returns the tombstone of the deployment. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.deployments.delete({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the deployment |
| `deleted` | `boolean \| null` | No | Whether the deployment was deleted |
| `model_id` | `string \| null` | No | Unique identifier of the model |

***

### development.activate

`deployments.development.activate`

Activates a development deployment. Activates a development deployment if not already activated. Starts replicas, which bill while they run.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.deployments.development.activate({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the deployment was successfully activated |
| `no_op` | `boolean \| null` | No | Whether the request did nothing because the deployment was already active or on its way to becoming active |

***

### development.deactivate

`deployments.development.deactivate`

Deactivates a development deployment. Deactivates a development deployment if not already deactivated. Scales the development deployment to zero: it stops serving until activated again.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.deployments.development.deactivate({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the deployment was successfully deactivated |
| `no_op` | `boolean \| null` | No | Whether the request did nothing because the deployment was already inactive |

***

### development.get

`deployments.development.get`

Gets a model's development deployment. Gets a model's development deployment and returns the deployment.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.development.get({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the deployment |
| `created_at` | `string \| null` | No | Time the deployment was created in ISO 8601 format |
| `name` | `string \| null` | No | Name of the deployment |
| `model_id` | `string \| null` | No | Unique identifier of the model |
| `is_production` | `boolean \| null` | No | Whether the deployment is the production deployment of the model |
| `is_development` | `boolean \| null` | No | Whether the deployment is the development deployment of the model |
| `status` | `string \| null` | No | The status of a deployment. |
| `active_replica_count` | `number \| null` | No | Number of active replicas |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for the deployment. If null, the model has not finished deploying |
| `instance_type_name` | `string \| null \| null` | No | Name of the instance type the model deployment is running on |
| `environment` | `string \| null \| null` | No | The environment associated with the deployment |
| `labels` | `object \| null` | No | User-provided key-value labels for the deployment |
| `region` | `object \| null` | No | The selected region for the deployment, if any |
| `request_backpressure_settings` | `object \| null` | No | Request backpressure settings for a deployment or environment. |
| `failure_reason` | `string \| null \| null` | No | Why the deployment failed. Set only when the status is DEPLOY\_FAILED; null otherwise. |

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null | null,
>   scale_down_delay?: number | null | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null | null,
>   target_in_flight_tokens?: number | null | null,
>   max_scale_down_rate?: number | null | null
> } | null | null
> ```

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null | null
> ```

> [accordion] region full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   display_name?: string | null
> } | null | null
> ```

> [accordion] request\_backpressure\_settings full type
>
> ```ts theme={null}
> {
>   policy?: string | null | null
> } | null
> ```

***

### development.promote

`deployments.development.promote`

Promotes a development deployment to production. Creates a new production deployment from the development deployment and returns the deployment that is building.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.deployments.development.promote({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `scale_down_previous_production` | `boolean` | No | Whether to scale down the previous production deployment after promoting |
| `preserve_env_instance_type` | `boolean` | No | Whether to use the promoting deployment's instance type or preserve target environment's instance type |
| `environment_settings_update` | `object \| null` | No | Changes to the environment's settings. Omitted fields are unchanged. The promoted deployment uses the environment's current settings with these changes applied, and the environment keeps the result when the promotion completes. |
| `promotion_settings_override` | `object \| null` | No | Promotion settings for this promotion only. Omitted fields keep the environment's values, and the environment's promotion settings are unchanged. |

> [accordion] environment\_settings\_update full type
>
> ```ts theme={null}
> {
>   region?: string | null,
>   instance_type_id?: string | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null,
>     scale_down_delay?: number | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null,
>     target_in_flight_tokens?: number | null,
>     max_scale_down_rate?: number | null
>   } | null,
>   request_backpressure_settings?: {
>     policy?: QUEUE_ON_FULL | REJECT_ON_FULL | null
>   } | null,
>   autoscaling_schedule_settings?: {
>     timezone?: string | null,
>     schedules?: (
>       {
>         id?: string | null,
>         name: string,
>         enabled: boolean,
>         autoscaling_settings: {
>           min_replica: number,
>           max_replica: number,
>           autoscaling_window: number | null,
>           scale_down_delay: number | null,
>           concurrency_target: number | null,
>           target_utilization_percentage: number | null,
>           target_in_flight_tokens: number | null,
>           max_scale_down_rate: number | null
>         },
>         cadence: DAILY | HOURLY,
>         weekdays: (SUNDAY | MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY)[],
>         start_hour?: number | null,
>         start_minute: number,
>         end_hour?: number | null,
>         end_minute: number
>       } | {
>         id?: string | null,
>         name: string,
>         enabled: boolean,
>         autoscaling_settings: {
>           min_replica: number,
>           max_replica: number,
>           autoscaling_window: number | null,
>           scale_down_delay: number | null,
>           concurrency_target: number | null,
>           target_utilization_percentage: number | null,
>           target_in_flight_tokens: number | null,
>           max_scale_down_rate: number | null
>         },
>         cadence: ONE_TIME,
>         start_at: string,
>         end_at: string
>       }
>     )[],
>     delete_schedules?: string[]
>   } | null,
>   promotion_settings?: {
>     redeploy_on_promotion?: boolean | null,
>     rolling_deploy?: boolean | null,
>     promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>     rolling_deploy_config?: {
>       rolling_deploy_strategy?: REPLICA | null,
>       max_surge_percent?: number | null,
>       max_unavailable_percent?: number | null,
>       stabilization_time_seconds?: number | null,
>       replica_overhead_percent?: number | null
>     } | null,
>     ramp_up_while_promoting?: boolean | null,
>     ramp_up_duration_seconds?: number | null
>   } | null
> } | null
> ```

> [accordion] promotion\_settings\_override full type
>
> ```ts theme={null}
> {
>   redeploy_on_promotion?: boolean | null,
>   rolling_deploy?: boolean | null,
>   promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>   rolling_deploy_config?: {
>     rolling_deploy_strategy?: REPLICA | null,
>     max_surge_percent?: number | null,
>     max_unavailable_percent?: number | null,
>     stabilization_time_seconds?: number | null,
>     replica_overhead_percent?: number | null
>   } | null,
>   ramp_up_while_promoting?: boolean | null,
>   ramp_up_duration_seconds?: number | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the deployment |
| `created_at` | `string \| null` | No | Time the deployment was created in ISO 8601 format |
| `name` | `string \| null` | No | Name of the deployment |
| `model_id` | `string \| null` | No | Unique identifier of the model |
| `is_production` | `boolean \| null` | No | Whether the deployment is the production deployment of the model |
| `is_development` | `boolean \| null` | No | Whether the deployment is the development deployment of the model |
| `status` | `string \| null` | No | The status of a deployment. |
| `active_replica_count` | `number \| null` | No | Number of active replicas |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for the deployment. If null, the model has not finished deploying |
| `instance_type_name` | `string \| null \| null` | No | Name of the instance type the model deployment is running on |
| `environment` | `string \| null \| null` | No | The environment associated with the deployment |
| `labels` | `object \| null` | No | User-provided key-value labels for the deployment |
| `region` | `object \| null` | No | The selected region for the deployment, if any |
| `request_backpressure_settings` | `object \| null` | No | Request backpressure settings for a deployment or environment. |
| `failure_reason` | `string \| null \| null` | No | Why the deployment failed. Set only when the status is DEPLOY\_FAILED; null otherwise. |

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null | null,
>   scale_down_delay?: number | null | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null | null,
>   target_in_flight_tokens?: number | null | null,
>   max_scale_down_rate?: number | null | null
> } | null | null
> ```

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null | null
> ```

> [accordion] region full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   display_name?: string | null
> } | null | null
> ```

> [accordion] request\_backpressure\_settings full type
>
> ```ts theme={null}
> {
>   policy?: string | null | null
> } | null
> ```

***

### development.retry

`deployments.development.retry`

Retries a failed development deployment. Retries a failed development deployment and returns the retry status and updated deployment.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.deployments.development.retry({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `retried` | `boolean \| null` | No | Whether the retry was successfully initiated |
| `reason` | `string \| null \| null` | No | Explanation of the result. Provided when retried is false to explain why retry was not possible. |
| `deployment` | `object \| null` | No | A deployment of a model. |

> [accordion] deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   model_id?: string | null,
>   is_production?: boolean | null,
>   is_development?: boolean | null,
>   status?: string | null,
>   active_replica_count?: number | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type_name?: string | null | null,
>   environment?: string | null | null,
>   labels?: {
>   } | null | null,
>   region?: {
>     slug?: string | null,
>     display_name?: string | null
>   } | null | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   failure_reason?: string | null | null
> } | null
> ```

***

### development.updateAutoscaling

`deployments.development.updateAutoscaling`

Updates a development deployment's autoscaling settings. Updates a development deployment's autoscaling settings and returns the update status.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.deployments.development.updateAutoscaling({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `min_replica` | `number \| null` | No | Minimum number of replicas |
| `max_replica` | `number \| null` | No | Maximum number of replicas |
| `autoscaling_window` | `number \| null` | No | Timeframe of traffic considered for autoscaling decisions |
| `scale_down_delay` | `number \| null` | No | Waiting period before scaling down any active replica |
| `concurrency_target` | `number \| null` | No | Number of requests per replica before scaling up |
| `target_utilization_percentage` | `number \| null` | No | Target utilization percentage for scaling up/down. |
| `target_in_flight_tokens` | `number \| null` | No | Target number of in-flight tokens for autoscaling decisions. Early access only. |
| `max_scale_down_rate` | `number \| null` | No | Maximum percentage of replicas that can be removed per autoscaling window (1–50). E.g. 20 means at most 20% of replicas are removed per window. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string \| null` | No | The status of a request to update autoscaling settings. |
| `message` | `string \| null` | No | A message describing the status of the request to update autoscaling settings |

***

### get

`deployments.get`

Gets a model's deployment by ID. Gets a model's deployment by ID and returns the deployment.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.get({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the deployment |
| `created_at` | `string \| null` | No | Time the deployment was created in ISO 8601 format |
| `name` | `string \| null` | No | Name of the deployment |
| `model_id` | `string \| null` | No | Unique identifier of the model |
| `is_production` | `boolean \| null` | No | Whether the deployment is the production deployment of the model |
| `is_development` | `boolean \| null` | No | Whether the deployment is the development deployment of the model |
| `status` | `string \| null` | No | The status of a deployment. |
| `active_replica_count` | `number \| null` | No | Number of active replicas |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for the deployment. If null, the model has not finished deploying |
| `instance_type_name` | `string \| null \| null` | No | Name of the instance type the model deployment is running on |
| `environment` | `string \| null \| null` | No | The environment associated with the deployment |
| `labels` | `object \| null` | No | User-provided key-value labels for the deployment |
| `region` | `object \| null` | No | The selected region for the deployment, if any |
| `request_backpressure_settings` | `object \| null` | No | Request backpressure settings for a deployment or environment. |
| `failure_reason` | `string \| null \| null` | No | Why the deployment failed. Set only when the status is DEPLOY\_FAILED; null otherwise. |

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null | null,
>   scale_down_delay?: number | null | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null | null,
>   target_in_flight_tokens?: number | null | null,
>   max_scale_down_rate?: number | null | null
> } | null | null
> ```

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null | null
> ```

> [accordion] region full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   display_name?: string | null
> } | null | null
> ```

> [accordion] request\_backpressure\_settings full type
>
> ```ts theme={null}
> {
>   policy?: string | null | null
> } | null
> ```

***

### getConfig

`deployments.getConfig`

Gets a deployment's config. Returns the deployment's config. output\_format query param picks the shape: 'raw' (config.yaml text), 'parsed' (dict with defaults), or 'both' (default).

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.getConfig({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `output_format` | `raw \| parsed \| both` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `config` | `object \| null` | No | The parsed config of the deployment. |
| `raw_config` | `string \| null \| null` | No | The original config.yaml text — preserves comments, ordering, formatting. |

> [accordion] config full type
>
> ```ts theme={null}
> {
> } | null | null
> ```

***

### getDownloadUrl

`deployments.getDownloadUrl`

Gets a presigned download URL for a deployment's truss. Gets a presigned URL to download the truss tar file for a deployment.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.getDownloadUrl({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `download_url` | `string \| null` | No | Presigned URL to download the truss tar file |

***

### getHotLoad

`deployments.getHotLoad`

Gets a deployment's RL weight-sync status. Lists each replica's lifecycle status and RL weight-sync state, with the revision of the deployment's newest target. A replica is done with a target when its hotload\_stage is done and its revision equals the deployment's revision. loading\_state is null for a replica that has not reported a state.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.getHotLoad({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `revision` | `number \| null \| null` | No | Revision of the deployment's newest hot-load target, or null if none was set. |
| `replicas` | `object[] \| null` | No | One entry per replica. |

> [accordion] replicas full type
>
> ```ts theme={null}
> {
>   replica_id?: string | null,
>   replica_status?: string | null,
>   loading_state?: {
>     hotload_stage?: string | null,
>     current_snapshot_identity?: string | null | null,
>     target_snapshot_identity?: string | null | null,
>     reason?: string | null | null,
>     revision?: number | null | null
>   } | null | null
> }[] | null
> ```

***

### getLogs

`deployments.getLogs`

Gets the logs for a model deployment. Gets all the logs for a model deployment in the given time range, which defaults to the last 30 minutes. A failed or older deployment may only have logs from before that window; pass start\_epoch\_millis to widen it back to the build/deploy time.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.getLogs({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `start_epoch_millis` | `number \| null` | No | Epoch milliseconds at which to start fetching logs. Defaults to 30 minutes before the end. The window from start to end must not exceed 7 days. |
| `end_epoch_millis` | `number \| null` | No | Epoch milliseconds at which to stop fetching logs. Defaults to the current time. |
| `direction` | `asc \| desc \| null` | No | Sort order for logs |
| `limit` | `number \| null` | No | Limit of logs to fetch in a single request |
| `min_level` | `DEBUG \| INFO \| WARNING \| ERROR \| null` | No | Minimum log severity to include. Omit to return all log lines, including lines that have no level. Any explicit value returns lines at or above that severity and drops lines without a level. |
| `replica` | `string \| null` | No | Only return logs emitted by this replica (5-char short ID). |
| `request_id` | `string \| null` | No | Only return logs tagged with this inference request ID. |
| `component` | `string \| null` | No | Only return logs from this component. |
| `search_pattern` | `string \| null` | No | RE2 regular expression matched against the log message. Prefer `includes` and `excludes` for plain substring matches. |
| `includes` | `string[]` | No | Case-sensitive substrings that must all appear in the log message. |
| `excludes` | `string[]` | No | Case-sensitive substrings; lines containing any of these are dropped. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `logs` | `object[] \| null` | No | Logs for a specific entity. |

> [accordion] logs full type
>
> ```ts theme={null}
> {
>   timestamp?: string | null,
>   message?: string | null,
>   replica?: string | null | null,
>   request_id?: string | null | null,
>   level?: string | null | null
> }[] | null
> ```

***

### getMetrics

`deployments.getMetrics`

Gets the metrics for a model deployment. Gets the metrics for a model deployment in the given time range.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.getMetrics({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `mode` | `CURRENT \| SUMMARY \| SERIES` | No | How metric values are aggregated over the request. |
| `start_epoch_millis` | `number \| null` | No | Epoch millis timestamp to start fetching metrics. Defaults to one hour before the end. |
| `end_epoch_millis` | `number \| null` | No | Epoch millis timestamp to end fetching metrics. Defaults to the current time. The window between start and end must not exceed 7 days. |
| `metrics` | `string[]` | No | Names of the metrics to return; see [https://docs.baseten.co/observability/export-metrics/supported-metrics](https://docs.baseten.co/observability/export-metrics/supported-metrics) for the available names. When omitted, a default set is returned: baseten\_replicas\_active, baseten\_inference\_requests\_total, and baseten\_end\_to\_end\_response\_time\_seconds. Unknown names are rejected; valid names that do not apply are omitted from the response. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `start_epoch_millis` | `number \| null` | No | Start of the returned window. |
| `end_epoch_millis` | `number \| null` | No | End of the returned window. |
| `mode` | `string \| null` | No | How metric values are aggregated over the request. |
| `step_seconds` | `number \| null \| null` | No | Seconds per step; populated only in SERIES mode, null otherwise. |
| `metric_descriptors` | `object[] \| null` | No | Descriptors for each metric; position defines the values index. |
| `metric_values` | `object[] \| null` | No | Metric values per time step covering the window. In summary mode this always contains exactly one value set spanning the whole window. |

> [accordion] metric\_descriptors full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   unit_hint?: string | null,
>   kind?: string | null,
>   label_sets?: Record<string, string>[] | null
> }[] | null
> ```

> [accordion] metric\_values full type
>
> ```ts theme={null}
> {
>   start_epoch_millis?: number | null,
>   values?: (number | null)[][] | null
> }[] | null
> ```

***

### getPatchState

`deployments.getPatchState`

Gets a development deployment's patch state. Returns the patch point the deployment is recorded as running and the latest staged-but-unsynced point, if any. The watch client computes its next patch off the pending point when present, else the running point.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.getPatchState({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `running_patch_point` | `object \| null` | No | A patch point plus its server-assigned content hash, returned in responses. Requests omit the hash (the server derives it from the source state); responses include it so the watch client can echo it back as the next patch's `prev_patch_hash` without having to recompute the fold itself. |
| `pending_patch_point` | `object \| null` | No | The latest staged-but-unsynced patch point, or null when the deployment is recorded as caught up. |

> [accordion] running\_patch\_point full type
>
> ```ts theme={null}
> {
>   content_hashes?: Record<string, string | null> | null,
>   config?: string | null,
>   requirements?: string[] | null,
>   hash?: string | null
> } | null
> ```

> [accordion] pending\_patch\_point full type
>
> ```ts theme={null}
> {
>   content_hashes?: Record<string, string | null> | null,
>   config?: string | null,
>   requirements?: string[] | null,
>   hash?: string | null
> } | null | null
> ```

***

### list

`deployments.list`

Gets all deployments of a model. (GET /v1/models/\{model\_id}/deployments)

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.list({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `name` | `string \| null` | No | When set, returns only the deployment with this exact name, if any. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deployments` | `object[] \| null` | No | A list of deployments of a model |

> [accordion] deployments full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   model_id?: string | null,
>   is_production?: boolean | null,
>   is_development?: boolean | null,
>   status?: string | null,
>   active_replica_count?: number | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type_name?: string | null | null,
>   environment?: string | null | null,
>   labels?: {
>   } | null | null,
>   region?: {
>     slug?: string | null,
>     display_name?: string | null
>   } | null | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   failure_reason?: string | null | null
> }[] | null
> ```

***

### production.activate

`deployments.production.activate`

Activates a production deployment. Activates a production deployment if not already activated. Starts replicas, which bill while they run.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.deployments.production.activate({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the deployment was successfully activated |
| `no_op` | `boolean \| null` | No | Whether the request did nothing because the deployment was already active or on its way to becoming active |

***

### production.deactivate

`deployments.production.deactivate`

Deactivates a production deployment. Deactivates a production deployment if not already deactivated. Scales the production deployment to zero: it stops serving until activated again.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.deployments.production.deactivate({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the deployment was successfully deactivated |
| `no_op` | `boolean \| null` | No | Whether the request did nothing because the deployment was already inactive |

***

### production.get

`deployments.production.get`

Gets a model's production deployment. Gets a model's production deployment and returns the deployment.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.production.get({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the deployment |
| `created_at` | `string \| null` | No | Time the deployment was created in ISO 8601 format |
| `name` | `string \| null` | No | Name of the deployment |
| `model_id` | `string \| null` | No | Unique identifier of the model |
| `is_production` | `boolean \| null` | No | Whether the deployment is the production deployment of the model |
| `is_development` | `boolean \| null` | No | Whether the deployment is the development deployment of the model |
| `status` | `string \| null` | No | The status of a deployment. |
| `active_replica_count` | `number \| null` | No | Number of active replicas |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for the deployment. If null, the model has not finished deploying |
| `instance_type_name` | `string \| null \| null` | No | Name of the instance type the model deployment is running on |
| `environment` | `string \| null \| null` | No | The environment associated with the deployment |
| `labels` | `object \| null` | No | User-provided key-value labels for the deployment |
| `region` | `object \| null` | No | The selected region for the deployment, if any |
| `request_backpressure_settings` | `object \| null` | No | Request backpressure settings for a deployment or environment. |
| `failure_reason` | `string \| null \| null` | No | Why the deployment failed. Set only when the status is DEPLOY\_FAILED; null otherwise. |

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null | null,
>   scale_down_delay?: number | null | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null | null,
>   target_in_flight_tokens?: number | null | null,
>   max_scale_down_rate?: number | null | null
> } | null | null
> ```

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null | null
> ```

> [accordion] region full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   display_name?: string | null
> } | null | null
> ```

> [accordion] request\_backpressure\_settings full type
>
> ```ts theme={null}
> {
>   policy?: string | null | null
> } | null
> ```

***

### production.retry

`deployments.production.retry`

Retries a failed production deployment. Retries a failed production deployment and returns the retry status and updated deployment.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.deployments.production.retry({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `retried` | `boolean \| null` | No | Whether the retry was successfully initiated |
| `reason` | `string \| null \| null` | No | Explanation of the result. Provided when retried is false to explain why retry was not possible. |
| `deployment` | `object \| null` | No | A deployment of a model. |

> [accordion] deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   model_id?: string | null,
>   is_production?: boolean | null,
>   is_development?: boolean | null,
>   status?: string | null,
>   active_replica_count?: number | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type_name?: string | null | null,
>   environment?: string | null | null,
>   labels?: {
>   } | null | null,
>   region?: {
>     slug?: string | null,
>     display_name?: string | null
>   } | null | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   failure_reason?: string | null | null
> } | null
> ```

***

### production.updateAutoscaling

`deployments.production.updateAutoscaling`

Updates a production deployment's autoscaling settings. Updates a production deployment's autoscaling settings and returns the update status.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.deployments.production.updateAutoscaling({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `min_replica` | `number \| null` | No | Minimum number of replicas |
| `max_replica` | `number \| null` | No | Maximum number of replicas |
| `autoscaling_window` | `number \| null` | No | Timeframe of traffic considered for autoscaling decisions |
| `scale_down_delay` | `number \| null` | No | Waiting period before scaling down any active replica |
| `concurrency_target` | `number \| null` | No | Number of requests per replica before scaling up |
| `target_utilization_percentage` | `number \| null` | No | Target utilization percentage for scaling up/down. |
| `target_in_flight_tokens` | `number \| null` | No | Target number of in-flight tokens for autoscaling decisions. Early access only. |
| `max_scale_down_rate` | `number \| null` | No | Maximum percentage of replicas that can be removed per autoscaling window (1–50). E.g. 20 means at most 20% of replicas are removed per window. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string \| null` | No | The status of a request to update autoscaling settings. |
| `message` | `string \| null` | No | A message describing the status of the request to update autoscaling settings |

***

### promote

`deployments.promote`

Promotes a deployment to production. Promotes an existing deployment to production and returns the same deployment.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.deployments.promote({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `scale_down_previous_production` | `boolean` | No | Whether to scale down the previous production deployment after promoting |
| `preserve_env_instance_type` | `boolean` | No | Whether to use the promoting deployment's instance type or preserve target environment's instance type |
| `environment_settings_update` | `object \| null` | No | Changes to the environment's settings. Omitted fields are unchanged. The promoted deployment uses the environment's current settings with these changes applied, and the environment keeps the result when the promotion completes. |
| `promotion_settings_override` | `object \| null` | No | Promotion settings for this promotion only. Omitted fields keep the environment's values, and the environment's promotion settings are unchanged. |

> [accordion] environment\_settings\_update full type
>
> ```ts theme={null}
> {
>   region?: string | null,
>   instance_type_id?: string | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null,
>     scale_down_delay?: number | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null,
>     target_in_flight_tokens?: number | null,
>     max_scale_down_rate?: number | null
>   } | null,
>   request_backpressure_settings?: {
>     policy?: QUEUE_ON_FULL | REJECT_ON_FULL | null
>   } | null,
>   autoscaling_schedule_settings?: {
>     timezone?: string | null,
>     schedules?: (
>       {
>         id?: string | null,
>         name: string,
>         enabled: boolean,
>         autoscaling_settings: {
>           min_replica: number,
>           max_replica: number,
>           autoscaling_window: number | null,
>           scale_down_delay: number | null,
>           concurrency_target: number | null,
>           target_utilization_percentage: number | null,
>           target_in_flight_tokens: number | null,
>           max_scale_down_rate: number | null
>         },
>         cadence: DAILY | HOURLY,
>         weekdays: (SUNDAY | MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY)[],
>         start_hour?: number | null,
>         start_minute: number,
>         end_hour?: number | null,
>         end_minute: number
>       } | {
>         id?: string | null,
>         name: string,
>         enabled: boolean,
>         autoscaling_settings: {
>           min_replica: number,
>           max_replica: number,
>           autoscaling_window: number | null,
>           scale_down_delay: number | null,
>           concurrency_target: number | null,
>           target_utilization_percentage: number | null,
>           target_in_flight_tokens: number | null,
>           max_scale_down_rate: number | null
>         },
>         cadence: ONE_TIME,
>         start_at: string,
>         end_at: string
>       }
>     )[],
>     delete_schedules?: string[]
>   } | null,
>   promotion_settings?: {
>     redeploy_on_promotion?: boolean | null,
>     rolling_deploy?: boolean | null,
>     promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>     rolling_deploy_config?: {
>       rolling_deploy_strategy?: REPLICA | null,
>       max_surge_percent?: number | null,
>       max_unavailable_percent?: number | null,
>       stabilization_time_seconds?: number | null,
>       replica_overhead_percent?: number | null
>     } | null,
>     ramp_up_while_promoting?: boolean | null,
>     ramp_up_duration_seconds?: number | null
>   } | null
> } | null
> ```

> [accordion] promotion\_settings\_override full type
>
> ```ts theme={null}
> {
>   redeploy_on_promotion?: boolean | null,
>   rolling_deploy?: boolean | null,
>   promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>   rolling_deploy_config?: {
>     rolling_deploy_strategy?: REPLICA | null,
>     max_surge_percent?: number | null,
>     max_unavailable_percent?: number | null,
>     stabilization_time_seconds?: number | null,
>     replica_overhead_percent?: number | null
>   } | null,
>   ramp_up_while_promoting?: boolean | null,
>   ramp_up_duration_seconds?: number | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the deployment |
| `created_at` | `string \| null` | No | Time the deployment was created in ISO 8601 format |
| `name` | `string \| null` | No | Name of the deployment |
| `model_id` | `string \| null` | No | Unique identifier of the model |
| `is_production` | `boolean \| null` | No | Whether the deployment is the production deployment of the model |
| `is_development` | `boolean \| null` | No | Whether the deployment is the development deployment of the model |
| `status` | `string \| null` | No | The status of a deployment. |
| `active_replica_count` | `number \| null` | No | Number of active replicas |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for the deployment. If null, the model has not finished deploying |
| `instance_type_name` | `string \| null \| null` | No | Name of the instance type the model deployment is running on |
| `environment` | `string \| null \| null` | No | The environment associated with the deployment |
| `labels` | `object \| null` | No | User-provided key-value labels for the deployment |
| `region` | `object \| null` | No | The selected region for the deployment, if any |
| `request_backpressure_settings` | `object \| null` | No | Request backpressure settings for a deployment or environment. |
| `failure_reason` | `string \| null \| null` | No | Why the deployment failed. Set only when the status is DEPLOY\_FAILED; null otherwise. |

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null | null,
>   scale_down_delay?: number | null | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null | null,
>   target_in_flight_tokens?: number | null | null,
>   max_scale_down_rate?: number | null | null
> } | null | null
> ```

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null | null
> ```

> [accordion] region full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   display_name?: string | null
> } | null | null
> ```

> [accordion] request\_backpressure\_settings full type
>
> ```ts theme={null}
> {
>   policy?: string | null | null
> } | null
> ```

***

### replicas.get

`deployments.replicas.get`

Gets a replica in a deployment. Returns lifecycle information without metrics, including for terminated replicas. Returns 404 if the replica does not exist in the specified deployment. Returns 400 if multiple replicas match the replica ID.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.replicas.get({ model_id: 'abcd1234', deployment_id: 'wxyz5678', replica_id: 'rep12345' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `replica_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Pod-name suffix used for replica lookup and termination, usually five characters. |
| `deployment_id` | `string \| null` | No | ID of the replica's deployment. |
| `deployment_name` | `string \| null` | No | Name of the replica's deployment. |
| `status` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | Replica creation time in ISO 8601 format. |
| `terminated_at` | `string \| null \| null` | No | Observed termination completion time in ISO 8601 format, or null if unavailable. |
| `age_seconds` | `number \| null` | No | Age in seconds since creation, frozen at termination. |
| `restart_count` | `number \| null \| null` | No | Model container lifetime restart count, or null if unavailable. |

***

### replicas.list

`deployments.replicas.list`

Lists replicas for a deployment. Includes terminated replicas and lifecycle information without metrics. Replicas are ordered by creation time, oldest first, with replica ID as a tie-breaker. For subsequent pages, pass pagination.cursor as cursor with unchanged filters. Cursors expire after one hour.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.replicas.list({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `statuses` | `(STARTING \| ACTIVE \| UNHEALTHY \| TERMINATING \| TERMINATED \| UNKNOWN)[]` | No | Replica statuses to include. Repeat the statuses query parameter to filter by multiple statuses. Omit to include all statuses, including terminated replicas. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   deployment_id?: string | null,
>   deployment_name?: string | null,
>   status?: string | null,
>   created_at?: string | null,
>   terminated_at?: string | null | null,
>   age_seconds?: number | null,
>   restart_count?: number | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### replicas.terminate

`deployments.replicas.terminate`

Terminates a replica in a deployment. Terminates a deployment replica and returns the termination status. Returns 404 if no replica matches the replica ID. Returns 400 without requesting termination if multiple replicas match the replica ID. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.deployments.replicas.terminate({ model_id: 'abcd1234', deployment_id: 'wxyz5678', replica_id: 'rep12345' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `replica_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the replica was successfully terminated |

***

### retry

`deployments.retry`

Retries a failed deployment. Retries a failed deployment and returns the retry status and updated deployment.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.deployments.retry({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `retried` | `boolean \| null` | No | Whether the retry was successfully initiated |
| `reason` | `string \| null \| null` | No | Explanation of the result. Provided when retried is false to explain why retry was not possible. |
| `deployment` | `object \| null` | No | A deployment of a model. |

> [accordion] deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   model_id?: string | null,
>   is_production?: boolean | null,
>   is_development?: boolean | null,
>   status?: string | null,
>   active_replica_count?: number | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type_name?: string | null | null,
>   environment?: string | null | null,
>   labels?: {
>   } | null | null,
>   region?: {
>     slug?: string | null,
>     display_name?: string | null
>   } | null | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   failure_reason?: string | null | null
> } | null
> ```

***

### setHotLoad

`deployments.setHotLoad`

Sets the snapshot a deployment's replicas hot-load. Stores the request as the deployment's RL weight-sync target; every replica loads it, and the newest request wins. Returns 400 if the body is not a JSON object of at most 16384 bytes as compact JSON, or has an invalid identity or incremental\_snapshot\_metadata.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.deployments.setHotLoad({ model_id: 'abcd1234', deployment_id: 'wxyz5678', identity: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `identity` | `string` | Yes | Snapshot directory below the checkpoint prefix, for example, anchors/step000001. |
| `incremental_snapshot_metadata` | `object \| null` | No | Required when identity is a delta snapshot. |

> [accordion] incremental\_snapshot\_metadata full type
>
> ```ts theme={null}
> {
>   compression_format: string,
>   checksum_format: string
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `revision` | `number \| null` | No | Revision of the stored target; grows with every request. |

***

### signSshCertificate

`deployments.signSshCertificate`

Signs an SSH certificate for an inference model. Signs a short-lived SSH certificate granting access to a running inference model pod. Returns the signed SSH certificate, a JWT token for SSH proxy authentication, the proxy address to connect through, and the certificate expiry time.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.deployments.signSshCertificate({ model_id: 'abcd1234', deployment_id: 'wxyz5678', public_key: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `public_key` | `string` | Yes | The user's SSH public key (e.g., 'ssh-ed25519 AAAA... user\@host'). |
| `replica_id` | `string \| null` | No | The replica to connect to. Required for training jobs (e.g. '0'). Optional for inference (server picks a running replica if omitted). |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ssh_certificate` | `string \| null` | No | The signed SSH certificate in OpenSSH format. |
| `jwt` | `string \| null` | No | Signed JWT (ES256) for SSH proxy authorization. |
| `proxy_address` | `string \| null` | No | Address of the SSH proxy to connect to (host:port). |
| `ssh_cert_expires_at` | `string \| null` | No | When the certificate expires, in ISO 8601 format. |

***

### stagePatch

`deployments.stagePatch`

Stages a patch against a development deployment. Persists a patch durably without applying it; call the sync endpoint to apply staged patches to the running deployment. The target must be a development deployment (its archive created with is\_development set to true); patching any other deployment is rejected.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.deployments.stagePatch({
	model_id: 'abcd1234',
	deployment_id: 'wxyz5678',
	prev_patch_hash: 'example',
	next_patch_point: {
		content_hashes: {},
		config: 'example',
	},
	patch_ops: [{ action: 'ADD', path: 'example' }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `prev_patch_hash` | `string` | Yes | Content hash of the patch point this patch is applied on - the link the staged patch must build on. A stale value (the base moved underneath the client) is rejected with a conflict. |
| `next_patch_point` | `object` | Yes | A patch point: the source state the next patch is computed against. The content hash that identifies a point is derived from this state (see `DeploymentPatchPointWithHashV1.hash`), so a request only sends the state and the server stamps the hash. A previous point's hash plus the current local source is enough to compute the next patch, so the watch client reads the point it is patching off of. |
| `patch_ops` | `object[]` | Yes | The ordered ops that make up this patch. At least one op is required; a patch that changes nothing is not a valid request. There is no op for a directory: a directory comes into existence when the first file under it is added, and is removed when its last file is removed, so directory creation and deletion happen implicitly through the file ops. Adding or removing an otherwise empty directory therefore produces no ops even though it changes the source hash; do not send a patch request for such a change. |

> [accordion] next\_patch\_point full type
>
> ```ts theme={null}
> {
>   content_hashes: Record<string, string | null>,
>   config: string,
>   requirements?: string[]
> }
> ```

> [accordion] patch\_ops full type
>
> ```ts theme={null}
> (
>   {
>     type?: model_code,
>     action: ADD | UPDATE | REMOVE,
>     path: string,
>     content?: string | null,
>     content_bytes?: string | null,
>     hot_reload?: boolean
>   } | {
>     type?: package,
>     action: ADD | UPDATE | REMOVE,
>     path: string,
>     content?: string | null,
>     content_bytes?: string | null
>   } | {
>     type?: config,
>     config: {
>     },
>     path?: string
>   } | {
>     type?: python_requirement,
>     action: ADD | UPDATE | REMOVE,
>     requirement: string
>   } | {
>     type?: environment_variable,
>     action: ADD | UPDATE | REMOVE,
>     name: string,
>     value?: string | null
>   } | {
>     type?: external_data,
>     action: ADD | UPDATE | REMOVE,
>     item: Record<string, string>
>   }
> )[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `patch_point` | `object \| null` | No | A patch point plus its server-assigned content hash, returned in responses. Requests omit the hash (the server derives it from the source state); responses include it so the watch client can echo it back as the next patch's `prev_patch_hash` without having to recompute the fold itself. |

> [accordion] patch\_point full type
>
> ```ts theme={null}
> {
>   content_hashes?: Record<string, string | null> | null,
>   config?: string | null,
>   requirements?: string[] | null,
>   hash?: string | null
> } | null
> ```

***

### startups.getSummary

`deployments.startups.getSummary`

Gets the startup summary for a model deployment. Gets the distribution of replica startup durations, in total and per phase, in the given time range.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.startups.getSummary({
	model_id: 'abcd1234',
	deployment_id: 'wxyz5678',
	start_epoch_millis: 1,
	end_epoch_millis: 1,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `start_epoch_millis` | `number` | Yes | Start of the query window, in epoch milliseconds. |
| `end_epoch_millis` | `number` | Yes | End of the query window, in epoch milliseconds. Must be after the start. |
| `min_duration_ms` | `number \| null` | No | Only include startups that lasted at least this many milliseconds. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `start_epoch_millis` | `number \| null` | No | Start of the returned window. |
| `end_epoch_millis` | `number \| null` | No | End of the returned window. |
| `total_duration_ms` | `object \| null` | No | A distribution of startup durations. Statistics cover only samples longer than 0 ms and are null when there are none. |
| `phase_duration_ms` | `object[] \| null` | No | Durations of each phase that was recorded in the window. |

> [accordion] total\_duration\_ms full type
>
> ```ts theme={null}
> {
>   sample_count?: number | null,
>   mean_ms?: number | null | null,
>   p50_ms?: number | null | null,
>   p90_ms?: number | null | null,
>   p95_ms?: number | null | null,
>   p99_ms?: number | null | null
> } | null
> ```

> [accordion] phase\_duration\_ms full type
>
> ```ts theme={null}
> {
>   phase?: string | null,
>   duration_ms?: {
>     sample_count?: number | null,
>     mean_ms?: number | null | null,
>     p50_ms?: number | null | null,
>     p90_ms?: number | null | null,
>     p95_ms?: number | null | null,
>     p99_ms?: number | null | null
>   } | null
> }[] | null
> ```

***

### startups.list

`deployments.startups.list`

Lists the startups of a model deployment. Lists replica startups in the given time range, newest first by default. Pass the cursor from a response to fetch the next page.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.deployments.startups.list({
	model_id: 'abcd1234',
	deployment_id: 'wxyz5678',
	start_epoch_millis: 1,
	end_epoch_millis: 1,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `start_epoch_millis` | `number` | Yes | Start of the query window, in epoch milliseconds. |
| `end_epoch_millis` | `number` | Yes | End of the query window, in epoch milliseconds. Must be after the start. |
| `min_duration_ms` | `number \| null` | No | Only include startups that lasted at least this many milliseconds. |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. Pass the same filters and sort as the request that returned it. |
| `limit` | `number` | No | Maximum number of attempts to return. |
| `outcomes` | `(SUCCESS \| FAILED \| STALLED)[]` | No | Only include attempts with one of these outcomes. Repeat to pass several. |
| `phase` | `SCHEDULING \| IMAGE_PULL \| WEIGHT_DOWNLOAD \| CONTAINER_CREATE \| CONTAINER_START \| READINESS \| null` | No | Only include attempts that spent longer than 0 ms in this phase. |
| `search` | `string \| null` | No | Only include attempts whose replica ID matches exactly, or whose deployment name contains this text (case-insensitive). |
| `sort_by` | `OUTCOME \| STARTED_AT \| READY_AT \| DURATION \| null` | No | Field to sort attempts by. Defaults to `STARTED_AT`. |
| `direction` | `asc \| desc \| null` | No | Sort direction. Defaults to `desc`. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |
| `total_count` | `number \| null` | No | Number of attempts matching the filters, counted within the 1,000 most recent startups in the window. |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   model_id?: string | null,
>   deployment_id?: string | null | null,
>   deployment_name?: string | null,
>   environment_name?: string | null | null,
>   replica_id?: string | null | null,
>   started_at_epoch_millis?: number | null,
>   ready_at_epoch_millis?: number | null | null,
>   duration_ms?: number | null,
>   outcome?: string | null,
>   phase_summary?: {
>     phase?: string | null,
>     status?: string | null,
>     offset_ms?: number | null,
>     duration_ms?: number | null | null
>   }[] | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### syncPatches

`deployments.syncPatches`

Syncs staged patches to a development deployment. Applies any staged patches to the running deployment. A 2xx response means the sync reached a verdict: in sync, or a full push is required (needs\_full\_deploy\_reason). A 503 means the sync was not attempted or failed recoverably and should be retried; any other error is terminal.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.deployments.syncPatches({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `needs_full_deploy_reason` | `string \| null \| null` | No | If set, the change cannot be patched and a full push is required; the value explains why. If null, the deployment is now in sync. |

***

### update

`deployments.update`

Updates a model's deployment by ID. Updates the mutable fields of a deployment and returns the updated deployment.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.deployments.update({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `name` | `string \| null` | No | New name for the deployment, unique among the model's deployments. Only alphanumeric characters, hyphens, underscores, and periods are allowed. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the deployment |
| `created_at` | `string \| null` | No | Time the deployment was created in ISO 8601 format |
| `name` | `string \| null` | No | Name of the deployment |
| `model_id` | `string \| null` | No | Unique identifier of the model |
| `is_production` | `boolean \| null` | No | Whether the deployment is the production deployment of the model |
| `is_development` | `boolean \| null` | No | Whether the deployment is the development deployment of the model |
| `status` | `string \| null` | No | The status of a deployment. |
| `active_replica_count` | `number \| null` | No | Number of active replicas |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for the deployment. If null, the model has not finished deploying |
| `instance_type_name` | `string \| null \| null` | No | Name of the instance type the model deployment is running on |
| `environment` | `string \| null \| null` | No | The environment associated with the deployment |
| `labels` | `object \| null` | No | User-provided key-value labels for the deployment |
| `region` | `object \| null` | No | The selected region for the deployment, if any |
| `request_backpressure_settings` | `object \| null` | No | Request backpressure settings for a deployment or environment. |
| `failure_reason` | `string \| null \| null` | No | Why the deployment failed. Set only when the status is DEPLOY\_FAILED; null otherwise. |

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null | null,
>   scale_down_delay?: number | null | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null | null,
>   target_in_flight_tokens?: number | null | null,
>   max_scale_down_rate?: number | null | null
> } | null | null
> ```

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null | null
> ```

> [accordion] region full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   display_name?: string | null
> } | null | null
> ```

> [accordion] request\_backpressure\_settings full type
>
> ```ts theme={null}
> {
>   policy?: string | null | null
> } | null
> ```

***

### updateAutoscaling

`deployments.updateAutoscaling`

Updates a deployment's autoscaling settings. Updates a deployment's autoscaling settings and returns the update status.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.deployments.updateAutoscaling({
	model_id: 'abcd1234',
	deployment_id: 'wxyz5678',
	min_replica: 0,
	max_replica: 2,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `min_replica` | `number \| null` | No | Minimum number of replicas |
| `max_replica` | `number \| null` | No | Maximum number of replicas |
| `autoscaling_window` | `number \| null` | No | Timeframe of traffic considered for autoscaling decisions |
| `scale_down_delay` | `number \| null` | No | Waiting period before scaling down any active replica |
| `concurrency_target` | `number \| null` | No | Number of requests per replica before scaling up |
| `target_utilization_percentage` | `number \| null` | No | Target utilization percentage for scaling up/down. |
| `target_in_flight_tokens` | `number \| null` | No | Target number of in-flight tokens for autoscaling decisions. Early access only. |
| `max_scale_down_rate` | `number \| null` | No | Maximum percentage of replicas that can be removed per autoscaling window (1–50). E.g. 20 means at most 20% of replicas are removed per window. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string \| null` | No | The status of a request to update autoscaling settings. |
| `message` | `string \| null` | No | A message describing the status of the request to update autoscaling settings |

***

### updateBackpressure

`deployments.updateBackpressure`

Updates a deployment's request backpressure settings.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.deployments.updateBackpressure({ model_id: 'abcd1234', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `policy` | `QUEUE_ON_FULL \| REJECT_ON_FULL \| null` | No | Backpressure policy to apply. Null indicates no policy (on update, clears an existing one). |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `policy` | `string \| null \| null` | No | Backpressure policy. Null when no policy is set. |

***

## Environment Groups

### get

`environmentGroups.get`

Gets an environment group by name. Gets a single environment group by name. The team-scoped path targets the team in the path; the top-level path targets the caller's organization default team.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.environmentGroups.get({ env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `env_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Name of the environment group, matching the environment name it governs. |
| `team_id` | `string \| null` | No | Unique identifier of the team the environment group belongs to. |
| `team_name` | `string \| null` | No | Name of the team the environment group belongs to. |
| `manage_access` | `object \| null` | No | Who is allowed to manage an environment group. |

> [accordion] manage\_access full type
>
> ```ts theme={null}
> {
>   is_restricted?: boolean | null,
>   users?: {
>     user_id?: string | null,
>     email?: string | null | null,
>     name?: string | null | null
>   }[] | null
> } | null
> ```

***

### list

`environmentGroups.list`

Lists environment groups. Lists environment groups. The team-scoped path targets the team in the path; the top-level path targets the caller's organization default team.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.environmentGroups.list({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   team_id?: string | null,
>   team_name?: string | null,
>   manage_access?: {
>     is_restricted?: boolean | null,
>     users?: {
>       user_id?: string | null,
>       email?: string | null | null,
>       name?: string | null | null
>     }[] | null
>   } | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### update

`environmentGroups.update`

Updates an environment group's restriction settings. Sets whether the environment is restricted and replaces the list of users granted manage access. The team-scoped path targets the team in the path; the top-level path targets the caller's organization default team.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.environmentGroups.update({ env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `env_name` | `string` | Yes | — |
| `manage_access` | `object \| null` | No | Manage-access settings to apply. Omit to leave manage access unchanged. |

> [accordion] manage\_access full type
>
> ```ts theme={null}
> {
>   is_restricted: boolean,
>   user_ids?: string[]
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Name of the environment group, matching the environment name it governs. |
| `team_id` | `string \| null` | No | Unique identifier of the team the environment group belongs to. |
| `team_name` | `string \| null` | No | Name of the team the environment group belongs to. |
| `manage_access` | `object \| null` | No | Who is allowed to manage an environment group. |

> [accordion] manage\_access full type
>
> ```ts theme={null}
> {
>   is_restricted?: boolean | null,
>   users?: {
>     user_id?: string | null,
>     email?: string | null | null,
>     name?: string | null | null
>   }[] | null
> } | null
> ```

***

## Environments

### activate

`environments.activate`

Activates a deployment associated with an environment. Activates a deployment associated with an environment if not already activated. Starts replicas, which bill while they run.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.environments.activate({ model_id: 'abcd1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the deployment was successfully activated |
| `no_op` | `boolean \| null` | No | Whether the request did nothing because the deployment was already active or on its way to becoming active |

***

### cancelPromotion

`environments.cancelPromotion`

Cancels a promotion to an environment. Cancels an ongoing promotion to an environment and returns the cancellation status.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.environments.cancelPromotion({ model_id: 'abcd1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string \| null` | No | The status of a request to cancel a promotion. |
| `message` | `string \| null` | No | A message describing the status of the request to cancel a promotion |

***

### create

`environments.create`

Creates an environment. Creates an environment for the specified model and returns the environment.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.environments.create({ model_id: 'abcd1234', name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `name` | `string` | Yes | Name of the environment |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for the environment |
| `promotion_settings` | `object \| null` | No | Promotion settings for the environment. New Model environments use rolling promotions by default. Set `rolling_deploy` to `false` to opt out. |
| `request_backpressure_settings` | `object \| null` | No | Request backpressure settings for the environment. |

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null,
>   scale_down_delay?: number | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null,
>   target_in_flight_tokens?: number | null,
>   max_scale_down_rate?: number | null
> } | null
> ```

> [accordion] promotion\_settings full type
>
> ```ts theme={null}
> {
>   redeploy_on_promotion?: boolean | null,
>   rolling_deploy?: boolean | null,
>   promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>   rolling_deploy_config?: {
>     rolling_deploy_strategy?: REPLICA | null,
>     max_surge_percent?: number | null,
>     max_unavailable_percent?: number | null,
>     stabilization_time_seconds?: number | null,
>     replica_overhead_percent?: number | null
>   } | null,
>   ramp_up_while_promoting?: boolean | null,
>   ramp_up_duration_seconds?: number | null
> } | null
> ```

> [accordion] request\_backpressure\_settings full type
>
> ```ts theme={null}
> {
>   policy?: QUEUE_ON_FULL | REJECT_ON_FULL | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Name of the environment |
| `created_at` | `string \| null` | No | Time the environment was created in ISO 8601 format |
| `model_id` | `string \| null` | No | Unique identifier of the model |
| `current_deployment` | `object \| null` | No | Current deployment of the environment |
| `candidate_deployment` | `object \| null` | No | Candidate deployment being promoted to the environment, if a promotion is in progress |
| `in_progress_promotion` | `object \| null` | No | Details of the in-progress promotion, if any |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for a deployment. |
| `promotion_settings` | `object \| null` | No | Promotion settings for promoting models |
| `instance_type` | `object \| null` | No | An instance type. |
| `request_backpressure_settings` | `object \| null` | No | Request backpressure settings for a deployment or environment. |
| `autoscaling_schedules` | `object \| null` | No | Autoscaling schedules and their evaluated state |
| `traffic_routing` | `object \| null` | No | The environment's traffic routing rules. In development. |

> [accordion] current\_deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   model_id?: string | null,
>   is_production?: boolean | null,
>   is_development?: boolean | null,
>   status?: string | null,
>   active_replica_count?: number | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type_name?: string | null | null,
>   environment?: string | null | null,
>   labels?: {
>   } | null | null,
>   region?: {
>     slug?: string | null,
>     display_name?: string | null
>   } | null | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   failure_reason?: string | null | null
> } | null | null
> ```

> [accordion] candidate\_deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   model_id?: string | null,
>   is_production?: boolean | null,
>   is_development?: boolean | null,
>   status?: string | null,
>   active_replica_count?: number | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type_name?: string | null | null,
>   environment?: string | null | null,
>   labels?: {
>   } | null | null,
>   region?: {
>     slug?: string | null,
>     display_name?: string | null
>   } | null | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   failure_reason?: string | null | null
> } | null | null
> ```

> [accordion] in\_progress\_promotion full type
>
> ```ts theme={null}
> {
>   status?: string | null,
>   percent_traffic_to_new_version?: number | null,
>   error_message?: string | null | null,
>   rolling_deploy?: boolean | null | null
> } | null | null
> ```

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null | null,
>   scale_down_delay?: number | null | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null | null,
>   target_in_flight_tokens?: number | null | null,
>   max_scale_down_rate?: number | null | null
> } | null
> ```

> [accordion] promotion\_settings full type
>
> ```ts theme={null}
> {
>   redeploy_on_promotion?: boolean | null | null,
>   rolling_deploy?: boolean | null | null,
>   promotion_cleanup_strategy?: string | null | null,
>   rolling_deploy_config?: {
>     rolling_deploy_strategy?: string | null,
>     max_surge_percent?: number | null,
>     max_unavailable_percent?: number | null,
>     stabilization_time_seconds?: number | null,
>     replica_overhead_percent?: number | null
>   } | null | null,
>   ramp_up_while_promoting?: boolean | null | null,
>   ramp_up_duration_seconds?: number | null | null
> } | null
> ```

> [accordion] instance\_type full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   memory_limit_mib?: number | null,
>   millicpu_limit?: number | null,
>   gpu_count?: number | null,
>   gpu_type?: string | null | null,
>   gpu_memory_limit_mib?: number | null | null
> } | null
> ```

> [accordion] request\_backpressure\_settings full type
>
> ```ts theme={null}
> {
>   policy?: string | null | null
> } | null
> ```

> [accordion] autoscaling\_schedules full type
>
> ```ts theme={null}
> {
>   timezone?: string | null | null,
>   schedules?: (
>     {
>       id?: string | null,
>       name?: string | null,
>       enabled?: boolean | null,
>       autoscaling_settings?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         concurrency_target?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null
>       } | null,
>       cadence?: string | null,
>       weekdays?: string[] | null,
>       start_hour?: number | null | null,
>       start_minute?: number | null,
>       end_hour?: number | null | null,
>       end_minute?: number | null
>     } | {
>       id?: string | null,
>       name?: string | null,
>       enabled?: boolean | null,
>       autoscaling_settings?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         concurrency_target?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null
>       } | null,
>       cadence?: string | null,
>       start_at?: string | null,
>       end_at?: string | null
>     }
>   )[] | null,
>   applied_state?: {
>     schedule_id?: string | null | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null
>   } | null | null
> } | null | null
> ```

> [accordion] traffic\_routing full type
>
> ```ts theme={null}
> {
>   rules?: {
>     id?: string | null,
>     type?: string | null,
>     targets?: {
>       model_id?: string | null,
>       deployment_id?: string | null | null,
>       environment?: string | null | null
>     }[] | null,
>     percent_traffic?: number | null,
>     expires_at?: string | null,
>     sampling_mode?: string | null,
>     propagate_client_cancellation?: boolean | null
>   }[] | null
> } | null | null
> ```

***

### deactivate

`environments.deactivate`

Deactivates a deployment associated with an environment. Deactivates a deployment associated with an environment if not already deactivated. Scales the environment's deployment to zero: it stops serving until activated again.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.environments.deactivate({ model_id: 'abcd1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the deployment was successfully deactivated |
| `no_op` | `boolean \| null` | No | Whether the request did nothing because the deployment was already inactive |

***

### delete

`environments.delete`

Deletes an environment. Deletes an environment and returns its tombstone. Any in-progress promotion to the environment is canceled, and the deployment currently serving the environment is scaled down to zero replicas rather than deleted. The production environment cannot be deleted. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.environments.delete({ model_id: 'abcd1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Name of the environment |
| `model_id` | `string \| null` | No | Unique identifier of the model |
| `deleted` | `boolean \| null` | No | Whether the environment was deleted |

***

### forceCancelPromotion

`environments.forceCancelPromotion`

Force cancels a rolling promotion. Immediately cancels an in-progress rolling promotion and triggers rollback to the previous version.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.environments.forceCancelPromotion({ model_id: 'abcd1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the signal was successfully sent |

***

### forceRollForwardPromotion

`environments.forceRollForwardPromotion`

Force rolls forward a rolling promotion. Immediately completes the rolling promotion, shifting all traffic to the new version. This works even if the promotion is in the process of rolling back.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.environments.forceRollForwardPromotion({ model_id: 'abcd1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the signal was successfully sent |

***

### get

`environments.get`

Gets an environment's details. Gets an environment's details and returns the environment.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.environments.get({ model_id: 'abcd1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Name of the environment |
| `created_at` | `string \| null` | No | Time the environment was created in ISO 8601 format |
| `model_id` | `string \| null` | No | Unique identifier of the model |
| `current_deployment` | `object \| null` | No | Current deployment of the environment |
| `candidate_deployment` | `object \| null` | No | Candidate deployment being promoted to the environment, if a promotion is in progress |
| `in_progress_promotion` | `object \| null` | No | Details of the in-progress promotion, if any |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for a deployment. |
| `promotion_settings` | `object \| null` | No | Promotion settings for promoting models |
| `instance_type` | `object \| null` | No | An instance type. |
| `request_backpressure_settings` | `object \| null` | No | Request backpressure settings for a deployment or environment. |
| `autoscaling_schedules` | `object \| null` | No | Autoscaling schedules and their evaluated state |
| `traffic_routing` | `object \| null` | No | The environment's traffic routing rules. In development. |

> [accordion] current\_deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   model_id?: string | null,
>   is_production?: boolean | null,
>   is_development?: boolean | null,
>   status?: string | null,
>   active_replica_count?: number | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type_name?: string | null | null,
>   environment?: string | null | null,
>   labels?: {
>   } | null | null,
>   region?: {
>     slug?: string | null,
>     display_name?: string | null
>   } | null | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   failure_reason?: string | null | null
> } | null | null
> ```

> [accordion] candidate\_deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   model_id?: string | null,
>   is_production?: boolean | null,
>   is_development?: boolean | null,
>   status?: string | null,
>   active_replica_count?: number | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type_name?: string | null | null,
>   environment?: string | null | null,
>   labels?: {
>   } | null | null,
>   region?: {
>     slug?: string | null,
>     display_name?: string | null
>   } | null | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   failure_reason?: string | null | null
> } | null | null
> ```

> [accordion] in\_progress\_promotion full type
>
> ```ts theme={null}
> {
>   status?: string | null,
>   percent_traffic_to_new_version?: number | null,
>   error_message?: string | null | null,
>   rolling_deploy?: boolean | null | null
> } | null | null
> ```

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null | null,
>   scale_down_delay?: number | null | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null | null,
>   target_in_flight_tokens?: number | null | null,
>   max_scale_down_rate?: number | null | null
> } | null
> ```

> [accordion] promotion\_settings full type
>
> ```ts theme={null}
> {
>   redeploy_on_promotion?: boolean | null | null,
>   rolling_deploy?: boolean | null | null,
>   promotion_cleanup_strategy?: string | null | null,
>   rolling_deploy_config?: {
>     rolling_deploy_strategy?: string | null,
>     max_surge_percent?: number | null,
>     max_unavailable_percent?: number | null,
>     stabilization_time_seconds?: number | null,
>     replica_overhead_percent?: number | null
>   } | null | null,
>   ramp_up_while_promoting?: boolean | null | null,
>   ramp_up_duration_seconds?: number | null | null
> } | null
> ```

> [accordion] instance\_type full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   memory_limit_mib?: number | null,
>   millicpu_limit?: number | null,
>   gpu_count?: number | null,
>   gpu_type?: string | null | null,
>   gpu_memory_limit_mib?: number | null | null
> } | null
> ```

> [accordion] request\_backpressure\_settings full type
>
> ```ts theme={null}
> {
>   policy?: string | null | null
> } | null
> ```

> [accordion] autoscaling\_schedules full type
>
> ```ts theme={null}
> {
>   timezone?: string | null | null,
>   schedules?: (
>     {
>       id?: string | null,
>       name?: string | null,
>       enabled?: boolean | null,
>       autoscaling_settings?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         concurrency_target?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null
>       } | null,
>       cadence?: string | null,
>       weekdays?: string[] | null,
>       start_hour?: number | null | null,
>       start_minute?: number | null,
>       end_hour?: number | null | null,
>       end_minute?: number | null
>     } | {
>       id?: string | null,
>       name?: string | null,
>       enabled?: boolean | null,
>       autoscaling_settings?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         concurrency_target?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null
>       } | null,
>       cadence?: string | null,
>       start_at?: string | null,
>       end_at?: string | null
>     }
>   )[] | null,
>   applied_state?: {
>     schedule_id?: string | null | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null
>   } | null | null
> } | null | null
> ```

> [accordion] traffic\_routing full type
>
> ```ts theme={null}
> {
>   rules?: {
>     id?: string | null,
>     type?: string | null,
>     targets?: {
>       model_id?: string | null,
>       deployment_id?: string | null | null,
>       environment?: string | null | null
>     }[] | null,
>     percent_traffic?: number | null,
>     expires_at?: string | null,
>     sampling_mode?: string | null,
>     propagate_client_cancellation?: boolean | null
>   }[] | null
> } | null | null
> ```

***

### getLogs

`environments.getLogs`

Gets the logs for a model environment. Gets logs across all deployments that were active on the environment in the given time range, which defaults to the last 30 minutes. Pass start\_epoch\_millis to widen the window back to an earlier deployment's build/deploy time.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.environments.getLogs({ model_id: 'abcd1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `start_epoch_millis` | `number \| null` | No | Epoch milliseconds at which to start fetching logs. Defaults to 30 minutes before the end. The window from start to end must not exceed 7 days. |
| `end_epoch_millis` | `number \| null` | No | Epoch milliseconds at which to stop fetching logs. Defaults to the current time. |
| `direction` | `asc \| desc \| null` | No | Sort order for logs |
| `limit` | `number \| null` | No | Limit of logs to fetch in a single request |
| `min_level` | `DEBUG \| INFO \| WARNING \| ERROR \| null` | No | Minimum log severity to include. Omit to return all log lines, including lines that have no level. Any explicit value returns lines at or above that severity and drops lines without a level. |
| `replica` | `string \| null` | No | Only return logs emitted by this replica (5-char short ID). |
| `request_id` | `string \| null` | No | Only return logs tagged with this inference request ID. |
| `component` | `string \| null` | No | Only return logs from this component. |
| `search_pattern` | `string \| null` | No | RE2 regular expression matched against the log message. Prefer `includes` and `excludes` for plain substring matches. |
| `includes` | `string[]` | No | Case-sensitive substrings that must all appear in the log message. |
| `excludes` | `string[]` | No | Case-sensitive substrings; lines containing any of these are dropped. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `logs` | `object[] \| null` | No | Logs for a specific entity. |

> [accordion] logs full type
>
> ```ts theme={null}
> {
>   timestamp?: string | null,
>   message?: string | null,
>   replica?: string | null | null,
>   request_id?: string | null | null,
>   level?: string | null | null
> }[] | null
> ```

***

### getMetrics

`environments.getMetrics`

Gets the metrics for a model environment. Gets metrics aggregated across every deployment that was active on the environment in the given time range. In series mode the window is split at each promotion so that every point reflects the deployment(s) serving the environment at that time.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.environments.getMetrics({ model_id: 'abcd1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `mode` | `CURRENT \| SUMMARY \| SERIES` | No | How metric values are aggregated over the request. |
| `start_epoch_millis` | `number \| null` | No | Epoch millis timestamp to start fetching metrics. Defaults to one hour before the end. |
| `end_epoch_millis` | `number \| null` | No | Epoch millis timestamp to end fetching metrics. Defaults to the current time. The window between start and end must not exceed 7 days. |
| `metrics` | `string[]` | No | Names of the metrics to return; see [https://docs.baseten.co/observability/export-metrics/supported-metrics](https://docs.baseten.co/observability/export-metrics/supported-metrics) for the available names. When omitted, a default set is returned: baseten\_replicas\_active, baseten\_inference\_requests\_total, and baseten\_end\_to\_end\_response\_time\_seconds. Unknown names are rejected; valid names that do not apply are omitted from the response. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `start_epoch_millis` | `number \| null` | No | Start of the returned window. |
| `end_epoch_millis` | `number \| null` | No | End of the returned window. |
| `mode` | `string \| null` | No | How metric values are aggregated over the request. |
| `step_seconds` | `number \| null \| null` | No | Seconds per step; populated only in SERIES mode, null otherwise. |
| `metric_descriptors` | `object[] \| null` | No | Descriptors for each metric; position defines the values index. |
| `metric_values` | `object[] \| null` | No | Metric values per time step covering the window. In summary mode this always contains exactly one value set spanning the whole window. |

> [accordion] metric\_descriptors full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   unit_hint?: string | null,
>   kind?: string | null,
>   label_sets?: Record<string, string>[] | null
> }[] | null
> ```

> [accordion] metric\_values full type
>
> ```ts theme={null}
> {
>   start_epoch_millis?: number | null,
>   values?: (number | null)[][] | null
> }[] | null
> ```

***

### list

`environments.list`

Gets all environments. Gets all environments for a given model.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.environments.list({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `environments` | `object[] \| null` | No | — |

> [accordion] environments full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   created_at?: string | null,
>   model_id?: string | null,
>   current_deployment?: {
>     id?: string | null,
>     created_at?: string | null,
>     name?: string | null,
>     model_id?: string | null,
>     is_production?: boolean | null,
>     is_development?: boolean | null,
>     status?: string | null,
>     active_replica_count?: number | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     instance_type_name?: string | null | null,
>     environment?: string | null | null,
>     labels?: {
>     } | null | null,
>     region?: {
>       slug?: string | null,
>       display_name?: string | null
>     } | null | null,
>     request_backpressure_settings?: {
>       policy?: string | null | null
>     } | null,
>     failure_reason?: string | null | null
>   } | null | null,
>   candidate_deployment?: {
>     id?: string | null,
>     created_at?: string | null,
>     name?: string | null,
>     model_id?: string | null,
>     is_production?: boolean | null,
>     is_development?: boolean | null,
>     status?: string | null,
>     active_replica_count?: number | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     instance_type_name?: string | null | null,
>     environment?: string | null | null,
>     labels?: {
>     } | null | null,
>     region?: {
>       slug?: string | null,
>       display_name?: string | null
>     } | null | null,
>     request_backpressure_settings?: {
>       policy?: string | null | null
>     } | null,
>     failure_reason?: string | null | null
>   } | null | null,
>   in_progress_promotion?: {
>     status?: string | null,
>     percent_traffic_to_new_version?: number | null,
>     error_message?: string | null | null,
>     rolling_deploy?: boolean | null | null
>   } | null | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null,
>   promotion_settings?: {
>     redeploy_on_promotion?: boolean | null | null,
>     rolling_deploy?: boolean | null | null,
>     promotion_cleanup_strategy?: string | null | null,
>     rolling_deploy_config?: {
>       rolling_deploy_strategy?: string | null,
>       max_surge_percent?: number | null,
>       max_unavailable_percent?: number | null,
>       stabilization_time_seconds?: number | null,
>       replica_overhead_percent?: number | null
>     } | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null
>   } | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   autoscaling_schedules?: {
>     timezone?: string | null | null,
>     schedules?: (
>       {
>         id?: string | null,
>         name?: string | null,
>         enabled?: boolean | null,
>         autoscaling_settings?: {
>           min_replica?: number | null,
>           max_replica?: number | null,
>           autoscaling_window?: number | null | null,
>           scale_down_delay?: number | null | null,
>           concurrency_target?: number | null | null,
>           target_utilization_percentage?: number | null | null,
>           target_in_flight_tokens?: number | null | null,
>           max_scale_down_rate?: number | null | null
>         } | null,
>         cadence?: string | null,
>         weekdays?: string[] | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null
>       } | {
>         id?: string | null,
>         name?: string | null,
>         enabled?: boolean | null,
>         autoscaling_settings?: {
>           min_replica?: number | null,
>           max_replica?: number | null,
>           autoscaling_window?: number | null | null,
>           scale_down_delay?: number | null | null,
>           concurrency_target?: number | null | null,
>           target_utilization_percentage?: number | null | null,
>           target_in_flight_tokens?: number | null | null,
>           max_scale_down_rate?: number | null | null
>         } | null,
>         cadence?: string | null,
>         start_at?: string | null,
>         end_at?: string | null
>       }
>     )[] | null,
>     applied_state?: {
>       schedule_id?: string | null | null,
>       autoscaling_settings?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         concurrency_target?: number | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null
>       } | null
>     } | null | null
>   } | null | null,
>   traffic_routing?: {
>     rules?: {
>       id?: string | null,
>       type?: string | null,
>       targets?: {
>         model_id?: string | null,
>         deployment_id?: string | null | null,
>         environment?: string | null | null
>       }[] | null,
>       percent_traffic?: number | null,
>       expires_at?: string | null,
>       sampling_mode?: string | null,
>       propagate_client_cancellation?: boolean | null
>     }[] | null
>   } | null | null
> }[] | null
> ```

***

### pausePromotion

`environments.pausePromotion`

Pauses a rolling promotion. Pauses an in-progress rolling promotion after the current step completes. No further scaling changes are made until resumed.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.environments.pausePromotion({ model_id: 'abcd1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the signal was successfully sent |

***

### promote

`environments.promote`

Promotes a deployment to an environment. Promotes an existing deployment to an environment and returns the promoted deployment.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.environments.promote({ model_id: 'abcd1234', env_name: 'staging', deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `scale_down_previous_deployment` | `boolean` | No | Whether to scale down the previous deployment after promoting |
| `deployment_id` | `string` | Yes | The id of the deployment to promote |
| `preserve_env_instance_type` | `boolean` | No | Whether to use the promoting deployment's instance type or preserve target environment's instance type |
| `environment_settings_update` | `object \| null` | No | Changes to the environment's settings. Omitted fields are unchanged. The promoted deployment uses the environment's current settings with these changes applied, and the environment keeps the result when the promotion completes. |
| `promotion_settings_override` | `object \| null` | No | Promotion settings for this promotion only. Omitted fields keep the environment's values, and the environment's promotion settings are unchanged. |

> [accordion] environment\_settings\_update full type
>
> ```ts theme={null}
> {
>   region?: string | null,
>   instance_type_id?: string | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null,
>     scale_down_delay?: number | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null,
>     target_in_flight_tokens?: number | null,
>     max_scale_down_rate?: number | null
>   } | null,
>   request_backpressure_settings?: {
>     policy?: QUEUE_ON_FULL | REJECT_ON_FULL | null
>   } | null,
>   autoscaling_schedule_settings?: {
>     timezone?: string | null,
>     schedules?: (
>       {
>         id?: string | null,
>         name: string,
>         enabled: boolean,
>         autoscaling_settings: {
>           min_replica: number,
>           max_replica: number,
>           autoscaling_window: number | null,
>           scale_down_delay: number | null,
>           concurrency_target: number | null,
>           target_utilization_percentage: number | null,
>           target_in_flight_tokens: number | null,
>           max_scale_down_rate: number | null
>         },
>         cadence: DAILY | HOURLY,
>         weekdays: (SUNDAY | MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY)[],
>         start_hour?: number | null,
>         start_minute: number,
>         end_hour?: number | null,
>         end_minute: number
>       } | {
>         id?: string | null,
>         name: string,
>         enabled: boolean,
>         autoscaling_settings: {
>           min_replica: number,
>           max_replica: number,
>           autoscaling_window: number | null,
>           scale_down_delay: number | null,
>           concurrency_target: number | null,
>           target_utilization_percentage: number | null,
>           target_in_flight_tokens: number | null,
>           max_scale_down_rate: number | null
>         },
>         cadence: ONE_TIME,
>         start_at: string,
>         end_at: string
>       }
>     )[],
>     delete_schedules?: string[]
>   } | null,
>   promotion_settings?: {
>     redeploy_on_promotion?: boolean | null,
>     rolling_deploy?: boolean | null,
>     promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>     rolling_deploy_config?: {
>       rolling_deploy_strategy?: REPLICA | null,
>       max_surge_percent?: number | null,
>       max_unavailable_percent?: number | null,
>       stabilization_time_seconds?: number | null,
>       replica_overhead_percent?: number | null
>     } | null,
>     ramp_up_while_promoting?: boolean | null,
>     ramp_up_duration_seconds?: number | null
>   } | null
> } | null
> ```

> [accordion] promotion\_settings\_override full type
>
> ```ts theme={null}
> {
>   redeploy_on_promotion?: boolean | null,
>   rolling_deploy?: boolean | null,
>   promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>   rolling_deploy_config?: {
>     rolling_deploy_strategy?: REPLICA | null,
>     max_surge_percent?: number | null,
>     max_unavailable_percent?: number | null,
>     stabilization_time_seconds?: number | null,
>     replica_overhead_percent?: number | null
>   } | null,
>   ramp_up_while_promoting?: boolean | null,
>   ramp_up_duration_seconds?: number | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the deployment |
| `created_at` | `string \| null` | No | Time the deployment was created in ISO 8601 format |
| `name` | `string \| null` | No | Name of the deployment |
| `model_id` | `string \| null` | No | Unique identifier of the model |
| `is_production` | `boolean \| null` | No | Whether the deployment is the production deployment of the model |
| `is_development` | `boolean \| null` | No | Whether the deployment is the development deployment of the model |
| `status` | `string \| null` | No | The status of a deployment. |
| `active_replica_count` | `number \| null` | No | Number of active replicas |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for the deployment. If null, the model has not finished deploying |
| `instance_type_name` | `string \| null \| null` | No | Name of the instance type the model deployment is running on |
| `environment` | `string \| null \| null` | No | The environment associated with the deployment |
| `labels` | `object \| null` | No | User-provided key-value labels for the deployment |
| `region` | `object \| null` | No | The selected region for the deployment, if any |
| `request_backpressure_settings` | `object \| null` | No | Request backpressure settings for a deployment or environment. |
| `failure_reason` | `string \| null \| null` | No | Why the deployment failed. Set only when the status is DEPLOY\_FAILED; null otherwise. |

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null | null,
>   scale_down_delay?: number | null | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null | null,
>   target_in_flight_tokens?: number | null | null,
>   max_scale_down_rate?: number | null | null
> } | null | null
> ```

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null | null
> ```

> [accordion] region full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   display_name?: string | null
> } | null | null
> ```

> [accordion] request\_backpressure\_settings full type
>
> ```ts theme={null}
> {
>   policy?: string | null | null
> } | null
> ```

***

### replicas.get

`environments.replicas.get`

Gets a replica in an environment. Searches deployments active in the environment during the preceding hour. Includes retained terminated replicas. Returns 404 if the replica is outside this scope. Returns 400 if multiple replicas match the replica ID.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.environments.replicas.get({ model_id: 'abcd1234', env_name: 'staging', replica_id: 'rep12345' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `replica_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Pod-name suffix used for replica lookup and termination, usually five characters. |
| `deployment_id` | `string \| null` | No | ID of the replica's deployment. |
| `deployment_name` | `string \| null` | No | Name of the replica's deployment. |
| `status` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | Replica creation time in ISO 8601 format. |
| `terminated_at` | `string \| null \| null` | No | Observed termination completion time in ISO 8601 format, or null if unavailable. |
| `age_seconds` | `number \| null` | No | Age in seconds since creation, frozen at termination. |
| `restart_count` | `number \| null \| null` | No | Model container lifetime restart count, or null if unavailable. |

***

### replicas.list

`environments.replicas.list`

Lists replicas for an environment. Includes retained terminated replicas from deployments active in the preceding hour. Orders replicas oldest first, with replica ID breaking ties. Pass pagination.cursor with unchanged filters for subsequent pages. Cursors pin deployment membership and expire after one hour.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.environments.replicas.list({ model_id: 'abcd1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `statuses` | `(STARTING \| ACTIVE \| UNHEALTHY \| TERMINATING \| TERMINATED \| UNKNOWN)[]` | No | Replica statuses to include. Repeat the statuses query parameter to filter by multiple statuses. Omit to include all statuses, including terminated replicas. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   deployment_id?: string | null,
>   deployment_name?: string | null,
>   status?: string | null,
>   created_at?: string | null,
>   terminated_at?: string | null | null,
>   age_seconds?: number | null,
>   restart_count?: number | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### replicas.terminate

`environments.replicas.terminate`

Terminates a replica in an environment. Requests replica termination in the environment's current deployment. Returns 404 if the environment has no current deployment or no replica matches the replica ID. Returns 400 without requesting termination if multiple replicas in the current deployment match the replica ID. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.environments.replicas.terminate({ model_id: 'abcd1234', env_name: 'staging', replica_id: 'rep12345' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `replica_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the replica was successfully terminated |

***

### resumePromotion

`environments.resumePromotion`

Resumes a paused rolling promotion. Resumes a paused rolling promotion, continuing from where it was paused.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.environments.resumePromotion({ model_id: 'abcd1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Whether the signal was successfully sent |

***

### startups.getSummary

`environments.startups.getSummary`

Gets the startup summary for a model environment. Gets the distribution of replica startup durations, in total and per phase, across every deployment that was active on the environment in the given time range.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.environments.startups.getSummary({
	model_id: 'abcd1234',
	env_name: 'staging',
	start_epoch_millis: 1,
	end_epoch_millis: 1,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `start_epoch_millis` | `number` | Yes | Start of the query window, in epoch milliseconds. |
| `end_epoch_millis` | `number` | Yes | End of the query window, in epoch milliseconds. Must be after the start. |
| `min_duration_ms` | `number \| null` | No | Only include startups that lasted at least this many milliseconds. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `start_epoch_millis` | `number \| null` | No | Start of the returned window. |
| `end_epoch_millis` | `number \| null` | No | End of the returned window. |
| `total_duration_ms` | `object \| null` | No | A distribution of startup durations. Statistics cover only samples longer than 0 ms and are null when there are none. |
| `phase_duration_ms` | `object[] \| null` | No | Durations of each phase that was recorded in the window. |

> [accordion] total\_duration\_ms full type
>
> ```ts theme={null}
> {
>   sample_count?: number | null,
>   mean_ms?: number | null | null,
>   p50_ms?: number | null | null,
>   p90_ms?: number | null | null,
>   p95_ms?: number | null | null,
>   p99_ms?: number | null | null
> } | null
> ```

> [accordion] phase\_duration\_ms full type
>
> ```ts theme={null}
> {
>   phase?: string | null,
>   duration_ms?: {
>     sample_count?: number | null,
>     mean_ms?: number | null | null,
>     p50_ms?: number | null | null,
>     p90_ms?: number | null | null,
>     p95_ms?: number | null | null,
>     p99_ms?: number | null | null
>   } | null
> }[] | null
> ```

***

### startups.list

`environments.startups.list`

Lists the startups of a model environment. Lists replica startups of every deployment that was active on the environment in the given time range, newest first by default. Pass the cursor from a response to fetch the next page.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.environments.startups.list({
	model_id: 'abcd1234',
	env_name: 'staging',
	start_epoch_millis: 1,
	end_epoch_millis: 1,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `start_epoch_millis` | `number` | Yes | Start of the query window, in epoch milliseconds. |
| `end_epoch_millis` | `number` | Yes | End of the query window, in epoch milliseconds. Must be after the start. |
| `min_duration_ms` | `number \| null` | No | Only include startups that lasted at least this many milliseconds. |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. Pass the same filters and sort as the request that returned it. |
| `limit` | `number` | No | Maximum number of attempts to return. |
| `outcomes` | `(SUCCESS \| FAILED \| STALLED)[]` | No | Only include attempts with one of these outcomes. Repeat to pass several. |
| `phase` | `SCHEDULING \| IMAGE_PULL \| WEIGHT_DOWNLOAD \| CONTAINER_CREATE \| CONTAINER_START \| READINESS \| null` | No | Only include attempts that spent longer than 0 ms in this phase. |
| `search` | `string \| null` | No | Only include attempts whose replica ID matches exactly, or whose deployment name contains this text (case-insensitive). |
| `sort_by` | `OUTCOME \| STARTED_AT \| READY_AT \| DURATION \| null` | No | Field to sort attempts by. Defaults to `STARTED_AT`. |
| `direction` | `asc \| desc \| null` | No | Sort direction. Defaults to `desc`. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |
| `total_count` | `number \| null` | No | Number of attempts matching the filters, counted within the 1,000 most recent startups in the window. |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   model_id?: string | null,
>   deployment_id?: string | null | null,
>   deployment_name?: string | null,
>   environment_name?: string | null | null,
>   replica_id?: string | null | null,
>   started_at_epoch_millis?: number | null,
>   ready_at_epoch_millis?: number | null | null,
>   duration_ms?: number | null,
>   outcome?: string | null,
>   phase_summary?: {
>     phase?: string | null,
>     status?: string | null,
>     offset_ms?: number | null,
>     duration_ms?: number | null | null
>   }[] | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### update

`environments.update`

Updates an environment's settings. Asynchronously updates an environment's settings. Poll the GET endpoint for the applied state.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.environments.update({ model_id: 'abcd1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for the environment |
| `promotion_settings` | `object \| null` | No | Promotion settings for the environment |
| `autoscaling_schedule_settings` | `object \| null` | No | Partial autoscaling schedule collection update. Omitted collection fields and existing schedules are unchanged; each submitted schedule is a complete create or replacement. |
| `request_backpressure_settings` | `object \| null` | No | Request backpressure settings for the environment. |
| `traffic_routing_settings` | `object \| null` | No | Partial traffic routing rule update. Each submitted rule is a complete create or replace. Deletes are applied first. In development. |

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null,
>   scale_down_delay?: number | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null,
>   target_in_flight_tokens?: number | null,
>   max_scale_down_rate?: number | null
> } | null
> ```

> [accordion] promotion\_settings full type
>
> ```ts theme={null}
> {
>   redeploy_on_promotion?: boolean | null,
>   rolling_deploy?: boolean | null,
>   promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>   rolling_deploy_config?: {
>     rolling_deploy_strategy?: REPLICA | null,
>     max_surge_percent?: number | null,
>     max_unavailable_percent?: number | null,
>     stabilization_time_seconds?: number | null,
>     replica_overhead_percent?: number | null
>   } | null,
>   ramp_up_while_promoting?: boolean | null,
>   ramp_up_duration_seconds?: number | null
> } | null
> ```

> [accordion] autoscaling\_schedule\_settings full type
>
> ```ts theme={null}
> {
>   timezone?: string | null,
>   schedules?: (
>     {
>       id?: string | null,
>       name: string,
>       enabled: boolean,
>       autoscaling_settings: {
>         min_replica: number,
>         max_replica: number,
>         autoscaling_window: number | null,
>         scale_down_delay: number | null,
>         concurrency_target: number | null,
>         target_utilization_percentage: number | null,
>         target_in_flight_tokens: number | null,
>         max_scale_down_rate: number | null
>       },
>       cadence: DAILY | HOURLY,
>       weekdays: (SUNDAY | MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY)[],
>       start_hour?: number | null,
>       start_minute: number,
>       end_hour?: number | null,
>       end_minute: number
>     } | {
>       id?: string | null,
>       name: string,
>       enabled: boolean,
>       autoscaling_settings: {
>         min_replica: number,
>         max_replica: number,
>         autoscaling_window: number | null,
>         scale_down_delay: number | null,
>         concurrency_target: number | null,
>         target_utilization_percentage: number | null,
>         target_in_flight_tokens: number | null,
>         max_scale_down_rate: number | null
>       },
>       cadence: ONE_TIME,
>       start_at: string,
>       end_at: string
>     }
>   )[],
>   delete_schedules?: string[]
> } | null
> ```

> [accordion] request\_backpressure\_settings full type
>
> ```ts theme={null}
> {
>   policy?: QUEUE_ON_FULL | REJECT_ON_FULL | null
> } | null
> ```

> [accordion] traffic\_routing\_settings full type
>
> ```ts theme={null}
> {
>   rules?: {
>     id?: string | null,
>     type: SHADOW,
>     targets: {
>       deployment_id?: string | null,
>       environment?: string | null
>     }[],
>     percent_traffic: number,
>     expires_at: string,
>     sampling_mode?: RANDOM | USER_SESSION,
>     propagate_client_cancellation: boolean
>   }[],
>   delete_rules?: string[]
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `environment` | `object \| null` | No | Environment for oracles. |
| `status` | `string \| null` | No | The status of a request to update autoscaling settings. |
| `message` | `string \| null` | No | Deprecated. Kept for legacy autoscaling-only update operation behavior. |

> [accordion] environment full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   created_at?: string | null,
>   model_id?: string | null,
>   current_deployment?: {
>     id?: string | null,
>     created_at?: string | null,
>     name?: string | null,
>     model_id?: string | null,
>     is_production?: boolean | null,
>     is_development?: boolean | null,
>     status?: string | null,
>     active_replica_count?: number | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     instance_type_name?: string | null | null,
>     environment?: string | null | null,
>     labels?: {
>     } | null | null,
>     region?: {
>       slug?: string | null,
>       display_name?: string | null
>     } | null | null,
>     request_backpressure_settings?: {
>       policy?: string | null | null
>     } | null,
>     failure_reason?: string | null | null
>   } | null | null,
>   candidate_deployment?: {
>     id?: string | null,
>     created_at?: string | null,
>     name?: string | null,
>     model_id?: string | null,
>     is_production?: boolean | null,
>     is_development?: boolean | null,
>     status?: string | null,
>     active_replica_count?: number | null,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     instance_type_name?: string | null | null,
>     environment?: string | null | null,
>     labels?: {
>     } | null | null,
>     region?: {
>       slug?: string | null,
>       display_name?: string | null
>     } | null | null,
>     request_backpressure_settings?: {
>       policy?: string | null | null
>     } | null,
>     failure_reason?: string | null | null
>   } | null | null,
>   in_progress_promotion?: {
>     status?: string | null,
>     percent_traffic_to_new_version?: number | null,
>     error_message?: string | null | null,
>     rolling_deploy?: boolean | null | null
>   } | null | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null,
>   promotion_settings?: {
>     redeploy_on_promotion?: boolean | null | null,
>     rolling_deploy?: boolean | null | null,
>     promotion_cleanup_strategy?: string | null | null,
>     rolling_deploy_config?: {
>       rolling_deploy_strategy?: string | null,
>       max_surge_percent?: number | null,
>       max_unavailable_percent?: number | null,
>       stabilization_time_seconds?: number | null,
>       replica_overhead_percent?: number | null
>     } | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null
>   } | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   autoscaling_schedules?: {
>     timezone?: string | null | null,
>     schedules?: (
>       {
>         id?: string | null,
>         name?: string | null,
>         enabled?: boolean | null,
>         autoscaling_settings?: {
>           min_replica?: number | null,
>           max_replica?: number | null,
>           autoscaling_window?: number | null | null,
>           scale_down_delay?: number | null | null,
>           concurrency_target?: number | null | null,
>           target_utilization_percentage?: number | null | null,
>           target_in_flight_tokens?: number | null | null,
>           max_scale_down_rate?: number | null | null
>         } | null,
>         cadence?: string | null,
>         weekdays?: string[] | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null
>       } | {
>         id?: string | null,
>         name?: string | null,
>         enabled?: boolean | null,
>         autoscaling_settings?: {
>           min_replica?: number | null,
>           max_replica?: number | null,
>           autoscaling_window?: number | null | null,
>           scale_down_delay?: number | null | null,
>           concurrency_target?: number | null | null,
>           target_utilization_percentage?: number | null | null,
>           target_in_flight_tokens?: number | null | null,
>           max_scale_down_rate?: number | null | null
>         } | null,
>         cadence?: string | null,
>         start_at?: string | null,
>         end_at?: string | null
>       }
>     )[] | null,
>     applied_state?: {
>       schedule_id?: string | null | null,
>       autoscaling_settings?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         concurrency_target?: number | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null
>       } | null
>     } | null | null
>   } | null | null,
>   traffic_routing?: {
>     rules?: {
>       id?: string | null,
>       type?: string | null,
>       targets?: {
>         model_id?: string | null,
>         deployment_id?: string | null | null,
>         environment?: string | null | null
>       }[] | null,
>       percent_traffic?: number | null,
>       expires_at?: string | null,
>       sampling_mode?: string | null,
>       propagate_client_cancellation?: boolean | null
>     }[] | null
>   } | null | null
> } | null
> ```

***

## Explore

### listModelMetadata

`explore.listModelMetadata`

Lists model metadata. Lists all live model metadata rows, e.g. for model pickers.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.explore.listModelMetadata({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `provider` | `string \| null` | No | Filter to a provider by slug prefix, e.g. 'anthropic'. Preserved by the cursor; if repeated, must match the original filter. |
| `q` | `string \| null` | No | Case-insensitive substring search over metadata slugs. Preserved by the cursor; if repeated, must match the original filter. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   slug?: string | null | null,
>   display_name?: string | null | null,
>   release_date?: string | null | null,
>   provider?: string | null | null,
>   context_window?: number | null | null,
>   max_output_tokens?: number | null | null,
>   input_modalities?: string[] | null,
>   tools?: boolean | null | null,
>   reasoning_effort_levels?: string[] | null | null,
>   parallel_tool_calls?: boolean | null | null,
>   supported_api_formats?: {
>     messages?: boolean | null,
>     responses?: boolean | null,
>     chat_completions?: boolean | null,
>     gemini?: boolean | null
>   } | null | null,
>   cost?: {
>     input?: number | null | null,
>     output?: number | null | null,
>     cache_read?: number | null | null,
>     cache_write?: number | null | null,
>     long_context?: {
>       input?: number | null | null,
>       output?: number | null | null,
>       cache_read?: number | null | null,
>       cache_write?: number | null | null
>     } | null | null
>   } | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

## Gateway

### endpoints.create

`gateway.endpoints.create`

Creates a Gateway endpoint. Provisions an endpoint for the given slug and its upstream target. Exactly one target is supported at this time. The slug's prefix must be one your organization owns.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.gateway.endpoints.create({
	slug: 'example',
	targets: [{ provider: 'ANTHROPIC' }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `slug` | `string` | Yes | Globally-unique slug of the form '\{org\_prefix}/\{name}'. |
| `region` | `UNRESTRICTED \| EU` | No | — |
| `targets` | `object[]` | Yes | The endpoint's upstream targets. Exactly one target is supported at this time. |

> [accordion] targets full type
>
> ```ts theme={null}
> {
>   provider: ANTHROPIC | OPENAI | XAI | BASETEN | BASETEN_MODEL_API | VERTEX | OPENAI_COMPATIBLE,
>   secret_id?: string | null,
>   target_model?: string | null,
>   base_url?: string | null,
>   model_id?: string | null,
>   environment_name?: string | null,
>   vertex_config?: {
>     project_id: string,
>     location: string
>   } | null
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable identifier for the endpoint. |
| `slug` | `string \| null` | No | Globally-unique routing slug. |
| `region` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | Creation time, ISO 8601. |
| `updated_at` | `string \| null` | No | Last update time, ISO 8601. |
| `targets` | `object[] \| null` | No | The endpoint's upstream targets. Exactly one target is supported at this time. |

> [accordion] targets full type
>
> ```ts theme={null}
> {
>   provider?: string | null,
>   secret_id?: string | null | null,
>   target_model?: string | null | null,
>   base_url?: string | null | null,
>   model_id?: string | null | null,
>   environment_name?: string | null | null,
>   vertex_config?: {
>     project_id?: string | null,
>     location?: string | null
>   } | null | null
> }[] | null
> ```

***

### endpoints.delete

`gateway.endpoints.delete`

Deletes a Gateway endpoint. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.gateway.endpoints.delete({ endpoint_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `endpoint_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Identifier of the deleted endpoint. |
| `slug` | `string \| null` | No | Slug of the deleted endpoint. |

***

### endpoints.get

`gateway.endpoints.get`

Gets a Gateway endpoint. (GET /v1/gateway/endpoints/\{endpoint\_id})

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.gateway.endpoints.get({ endpoint_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `endpoint_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable identifier for the endpoint. |
| `slug` | `string \| null` | No | Globally-unique routing slug. |
| `region` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | Creation time, ISO 8601. |
| `updated_at` | `string \| null` | No | Last update time, ISO 8601. |
| `targets` | `object[] \| null` | No | The endpoint's upstream targets. Exactly one target is supported at this time. |

> [accordion] targets full type
>
> ```ts theme={null}
> {
>   provider?: string | null,
>   secret_id?: string | null | null,
>   target_model?: string | null | null,
>   base_url?: string | null | null,
>   model_id?: string | null | null,
>   environment_name?: string | null | null,
>   vertex_config?: {
>     project_id?: string | null,
>     location?: string | null
>   } | null | null
> }[] | null
> ```

***

### endpoints.list

`gateway.endpoints.list`

Lists Gateway endpoints. (GET /v1/gateway/endpoints)

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.gateway.endpoints.list({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   slug?: string | null,
>   region?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   targets?: {
>     provider?: string | null,
>     secret_id?: string | null | null,
>     target_model?: string | null | null,
>     base_url?: string | null | null,
>     model_id?: string | null | null,
>     environment_name?: string | null | null,
>     vertex_config?: {
>       project_id?: string | null,
>       location?: string | null
>     } | null | null
>   }[] | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### endpoints.update

`gateway.endpoints.update`

Updates a Gateway endpoint. Updates the endpoint's provided mutable fields. If targets are provided, the full target list is replaced. Exactly one target is supported at this time.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.gateway.endpoints.update({ endpoint_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `endpoint_id` | `string` | Yes | — |
| `targets` | `object[] \| null` | No | The endpoint's upstream targets. Exactly one target is supported at this time. |

> [accordion] targets full type
>
> ```ts theme={null}
> {
>   provider: ANTHROPIC | OPENAI | XAI | BASETEN | BASETEN_MODEL_API | VERTEX | OPENAI_COMPATIBLE,
>   secret_id?: string | null,
>   target_model?: string | null,
>   base_url?: string | null,
>   model_id?: string | null,
>   environment_name?: string | null,
>   vertex_config?: {
>     project_id: string,
>     location: string
>   } | null
> }[] | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable identifier for the endpoint. |
| `slug` | `string \| null` | No | Globally-unique routing slug. |
| `region` | `string \| null` | No | — |
| `created_at` | `string \| null` | No | Creation time, ISO 8601. |
| `updated_at` | `string \| null` | No | Last update time, ISO 8601. |
| `targets` | `object[] \| null` | No | The endpoint's upstream targets. Exactly one target is supported at this time. |

> [accordion] targets full type
>
> ```ts theme={null}
> {
>   provider?: string | null,
>   secret_id?: string | null | null,
>   target_model?: string | null | null,
>   base_url?: string | null | null,
>   model_id?: string | null | null,
>   environment_name?: string | null | null,
>   vertex_config?: {
>     project_id?: string | null,
>     location?: string | null
>   } | null | null
> }[] | null
> ```

***

### events.list

`gateway.events.list`

Lists gateway events. (GET /v1/gateway/events)

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.gateway.events.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `start_time` | `string \| null` | No | Inclusive start (ISO 8601, UTC). Required without a cursor. |
| `end_time` | `string \| null` | No | Exclusive end (ISO 8601, UTC). Defaults to now. |
| `limit` | `number \| null` | No | Max events. Default 100, max 1000. |
| `api_keys` | `string[]` | No | Return only events for these API key prefixes, repeated once per prefix. |
| `external_entity_ids` | `string[]` | No | Return only events for these external entity IDs, repeated once per ID. |
| `cursor` | `string \| null` | No | Next-page cursor. Other parameters are ignored. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   type?: string | null,
>   idempotencyKey?: string | null,
>   timestamp?: string | null,
>   requestId?: string | null,
>   modelSlug?: string | null,
>   externalEntityId?: string | null,
>   apiKeyPrefix?: string | null,
>   tokens?: {
>     inputTokens?: number | null,
>     outputTokens?: number | null,
>     cachedInputTokens?: number | null
>   } | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### groups.apiKeys.create

`gateway.groups.apiKeys.create`

Creates an API key for a group. Creates a new API key for the given group.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.gateway.groups.apiKeys.create({ group_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `group_id` | `string` | Yes | — |
| `name` | `string \| null` | No | Optional display name for the new key. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `api_key` | `string \| null` | No | Plaintext key string, returned exactly once. |
| `prefix` | `string \| null` | No | Key prefix (the part before the dot). |
| `name` | `string \| null \| null` | No | Display name of the key. |

***

### groups.apiKeys.get

`gateway.groups.apiKeys.get`

Gets an API key for a group. (GET /v1/gateway/groups/\{group\_id}/api\_keys/\{api\_key\_prefix})

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.gateway.groups.apiKeys.get({ group_id: 'example', api_key_prefix: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `group_id` | `string` | Yes | — |
| `api_key_prefix` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `prefix` | `string \| null` | No | The prefix of the Model API key. |
| `name` | `string \| null \| null` | No | Optional display name. |

***

### groups.apiKeys.list

`gateway.groups.apiKeys.list`

Lists API keys for a group. (GET /v1/gateway/groups/\{group\_id}/api\_keys)

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.gateway.groups.apiKeys.list({ group_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `group_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   prefix?: string | null,
>   name?: string | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### groups.apiKeys.register

`gateway.groups.apiKeys.register`

Registers an API key for a group. Registers a Gateway API key with the provided value and name.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.gateway.groups.apiKeys.register({ group_id: 'example', key: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `group_id` | `string` | Yes | — |
| `name` | `string \| null` | No | Optional name for the Model API key |
| `key` | `string` | Yes | Value of the API key to register |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ok` | `boolean \| null` | No | Whether the registration was successful |

***

### groups.create

`gateway.groups.create`

Creates a group. Creates a group and its endpoint configuration.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.gateway.groups.create({
	metadata: { external_entity_id: 'example' },
	models: [{ slug: 'example' }],
	hierarchy: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `metadata` | `object` | Yes | — |
| `models` | `object[]` | Yes | Per-model rate and usage limit configuration. Defines the group's complete model set. Must be non-empty. |
| `hierarchy` | `object` | Yes | — |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   external_entity_id: string
> }
> ```

> [accordion] models full type
>
> ```ts theme={null}
> {
>   slug: string,
>   rate_limits?: {
>     type: REQUEST | TOKEN | CONCURRENT_REQUEST | UNCACHED_INPUT_TOKEN | OUTPUT_TOKEN,
>     unit: SECOND | MINUTE,
>     threshold: number
>   }[],
>   usage_limits?: {
>     type: REQUEST | TOKEN | CONCURRENT_REQUEST | UNCACHED_INPUT_TOKEN | OUTPUT_TOKEN,
>     unit: DAY,
>     threshold: number
>   }[]
> }[]
> ```

> [accordion] hierarchy full type
>
> ```ts theme={null}
> {
>   limit_enforcement?: CASCADING | INDEPENDENT | null,
>   parent_group_id?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Internal Baseten ID for the group. |
| `metadata` | `object \| null` | No | — |
| `models` | `object[] \| null` | No | — |
| `effective_models` | `object[] \| null` | No | — |
| `hierarchy` | `object \| null` | No | — |
| `created_at` | `string \| null` | No | When this group was created. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
>   name?: string | null | null,
>   external_entity_id?: string | null
> } | null
> ```

> [accordion] models full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   rate_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null
>   }[] | null,
>   usage_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null
>   }[] | null
> }[] | null
> ```

> [accordion] effective\_models full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   rate_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null,
>     source_group?: string | null
>   }[] | null,
>   usage_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null,
>     source_group?: string | null
>   }[] | null
> }[] | null
> ```

> [accordion] hierarchy full type
>
> ```ts theme={null}
> {
>   limit_enforcement?: string | null,
>   parent_group_id?: string | null | null
> } | null
> ```

***

### groups.get

`gateway.groups.get`

Gets a group. (GET /v1/gateway/groups/\{group\_id})

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.gateway.groups.get({ group_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `group_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Internal Baseten ID for the group. |
| `metadata` | `object \| null` | No | — |
| `models` | `object[] \| null` | No | — |
| `effective_models` | `object[] \| null` | No | — |
| `hierarchy` | `object \| null` | No | — |
| `created_at` | `string \| null` | No | When this group was created. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
>   name?: string | null | null,
>   external_entity_id?: string | null
> } | null
> ```

> [accordion] models full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   rate_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null
>   }[] | null,
>   usage_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null
>   }[] | null
> }[] | null
> ```

> [accordion] effective\_models full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   rate_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null,
>     source_group?: string | null
>   }[] | null,
>   usage_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null,
>     source_group?: string | null
>   }[] | null
> }[] | null
> ```

> [accordion] hierarchy full type
>
> ```ts theme={null}
> {
>   limit_enforcement?: string | null,
>   parent_group_id?: string | null | null
> } | null
> ```

***

### groups.list

`gateway.groups.list`

Lists groups. (GET /v1/gateway/groups)

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.gateway.groups.list({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   metadata?: {
>     name?: string | null | null,
>     external_entity_id?: string | null
>   } | null,
>   models?: {
>     slug?: string | null,
>     rate_limits?: {
>       type?: string | null,
>       unit?: string | null,
>       threshold?: number | null
>     }[] | null,
>     usage_limits?: {
>       type?: string | null,
>       unit?: string | null,
>       threshold?: number | null
>     }[] | null
>   }[] | null,
>   effective_models?: {
>     slug?: string | null,
>     rate_limits?: {
>       type?: string | null,
>       unit?: string | null,
>       threshold?: number | null,
>       source_group?: string | null
>     }[] | null,
>     usage_limits?: {
>       type?: string | null,
>       unit?: string | null,
>       threshold?: number | null,
>       source_group?: string | null
>     }[] | null
>   }[] | null,
>   hierarchy?: {
>     limit_enforcement?: string | null,
>     parent_group_id?: string | null | null
>   } | null,
>   created_at?: string | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### groups.update

`gateway.groups.update`

Updates a group. Updates the group's mutable fields.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.gateway.groups.update({ group_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `group_id` | `string` | Yes | — |
| `metadata` | `object \| null` | No | Mutable group metadata. |
| `models` | `object[] \| null` | No | Per-model rate and usage limit configuration. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
>   name?: string | null
> } | null
> ```

> [accordion] models full type
>
> ```ts theme={null}
> {
>   slug: string,
>   rate_limits?: {
>     type: REQUEST | TOKEN | CONCURRENT_REQUEST | UNCACHED_INPUT_TOKEN | OUTPUT_TOKEN,
>     unit: SECOND | MINUTE,
>     threshold: number
>   }[],
>   usage_limits?: {
>     type: REQUEST | TOKEN | CONCURRENT_REQUEST | UNCACHED_INPUT_TOKEN | OUTPUT_TOKEN,
>     unit: DAY,
>     threshold: number
>   }[]
> }[] | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Internal Baseten ID for the group. |
| `metadata` | `object \| null` | No | — |
| `models` | `object[] \| null` | No | — |
| `effective_models` | `object[] \| null` | No | — |
| `hierarchy` | `object \| null` | No | — |
| `created_at` | `string \| null` | No | When this group was created. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
>   name?: string | null | null,
>   external_entity_id?: string | null
> } | null
> ```

> [accordion] models full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   rate_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null
>   }[] | null,
>   usage_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null
>   }[] | null
> }[] | null
> ```

> [accordion] effective\_models full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   rate_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null,
>     source_group?: string | null
>   }[] | null,
>   usage_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null,
>     source_group?: string | null
>   }[] | null
> }[] | null
> ```

> [accordion] hierarchy full type
>
> ```ts theme={null}
> {
>   limit_enforcement?: string | null,
>   parent_group_id?: string | null | null
> } | null
> ```

***

## Grid

### connections.create

`grid.connections.create`

Creates a connection. Creates a connection from the team to an upstream provider.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.grid.connections.create({
	config: { provider: 'ANTHROPIC', secret_name: 'corsair_example_secret' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string \| null` | No | Identifier of the team that owns the connection. |
| `config` | `object` | Yes | Provider the connection authenticates with, and the team secret holding its API key. |

> [accordion] config full type
>
> ```ts theme={null}
> {
>   provider: ANTHROPIC,
>   secret_name: string
> } | {
>   provider: OPENAI,
>   secret_name: string,
>   region?: string | null
> } | {
>   provider: XAI,
>   secret_name: string
> } | {
>   provider: VERTEX,
>   secret_name: string,
>   project_id: string,
>   location: string
> } | {
>   provider: BEDROCK,
>   secret_name: string,
>   region: string,
>   auth: {
>     method: api_key
>   } | {
>     method: access_keys
>   }
> } | {
>   provider: AZURE,
>   secret_name: string,
>   resource_name: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable connection identifier. |
| `team_id` | `string \| null` | No | Identifier of the team that owns the connection. |
| `team_name` | `string \| null` | No | Name of the team that owns the connection. |
| `config` | `object \| null` | No | Provider the connection authenticates with, and the team secret holding its API key. |
| `created_at` | `string \| null` | No | Creation time, ISO 8601. |
| `updated_at` | `string \| null` | No | Last update time, ISO 8601. |

> [accordion] config full type
>
> ```ts theme={null}
> {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null,
>   region?: string | null | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null,
>   project_id?: string | null,
>   location?: string | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null,
>   region?: string | null,
>   auth?: {
>     method?: string | null
>   } | {
>     method?: string | null
>   } | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null,
>   resource_name?: string | null
> } | null
> ```

***

### connections.delete

`grid.connections.delete`

Deletes a connection. Deletes the connection. The team secret it points at is left in place. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.grid.connections.delete({ connection_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `connection_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable identifier of the deleted connection. |

***

### connections.get

`grid.connections.get`

Gets a connection. (GET /v1/grid/connections/\{connection\_id})

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.grid.connections.get({ connection_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `connection_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable connection identifier. |
| `team_id` | `string \| null` | No | Identifier of the team that owns the connection. |
| `team_name` | `string \| null` | No | Name of the team that owns the connection. |
| `config` | `object \| null` | No | Provider the connection authenticates with, and the team secret holding its API key. |
| `created_at` | `string \| null` | No | Creation time, ISO 8601. |
| `updated_at` | `string \| null` | No | Last update time, ISO 8601. |

> [accordion] config full type
>
> ```ts theme={null}
> {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null,
>   region?: string | null | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null,
>   project_id?: string | null,
>   location?: string | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null,
>   region?: string | null,
>   auth?: {
>     method?: string | null
>   } | {
>     method?: string | null
>   } | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null,
>   resource_name?: string | null
> } | null
> ```

***

### connections.list

`grid.connections.list`

Lists connections. Lists connections, newest first: the team's with team\_id, else those of every team where you can invoke routes.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.grid.connections.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `team_id` | `string \| null` | No | Limit connections to this team. Without it, connections from every team where you can invoke routes. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   team_id?: string | null,
>   team_name?: string | null,
>   config?: {
>     provider?: string | null,
>     secret_id?: string | null,
>     secret_name?: string | null
>   } | {
>     provider?: string | null,
>     secret_id?: string | null,
>     secret_name?: string | null,
>     region?: string | null | null
>   } | {
>     provider?: string | null,
>     secret_id?: string | null,
>     secret_name?: string | null
>   } | {
>     provider?: string | null,
>     secret_id?: string | null,
>     secret_name?: string | null,
>     project_id?: string | null,
>     location?: string | null
>   } | {
>     provider?: string | null,
>     secret_id?: string | null,
>     secret_name?: string | null,
>     region?: string | null,
>     auth?: {
>       method?: string | null
>     } | {
>       method?: string | null
>     } | null
>   } | {
>     provider?: string | null,
>     secret_id?: string | null,
>     secret_name?: string | null,
>     resource_name?: string | null
>   } | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### connections.update

`grid.connections.update`

Updates a connection. Updates the connection's fields. The provider and owning team are immutable; point the connection at a new team secret to change its API key, or rotate the key itself by updating the secret.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.grid.connections.update({
	connection_id: 'example',
	config: { provider: 'ANTHROPIC', secret_name: 'corsair_example_secret' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `connection_id` | `string` | Yes | — |
| `config` | `object` | Yes | Complete new connection configuration, replacing the current one. The provider must match the connection and is immutable. |

> [accordion] config full type
>
> ```ts theme={null}
> {
>   provider: ANTHROPIC,
>   secret_name: string
> } | {
>   provider: OPENAI,
>   secret_name: string,
>   region?: string | null
> } | {
>   provider: XAI,
>   secret_name: string
> } | {
>   provider: VERTEX,
>   secret_name: string,
>   project_id: string,
>   location: string
> } | {
>   provider: BEDROCK,
>   secret_name: string,
>   region: string,
>   auth: {
>     method: api_key
>   } | {
>     method: access_keys
>   }
> } | {
>   provider: AZURE,
>   secret_name: string,
>   resource_name: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable connection identifier. |
| `team_id` | `string \| null` | No | Identifier of the team that owns the connection. |
| `team_name` | `string \| null` | No | Name of the team that owns the connection. |
| `config` | `object \| null` | No | Provider the connection authenticates with, and the team secret holding its API key. |
| `created_at` | `string \| null` | No | Creation time, ISO 8601. |
| `updated_at` | `string \| null` | No | Last update time, ISO 8601. |

> [accordion] config full type
>
> ```ts theme={null}
> {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null,
>   region?: string | null | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null,
>   project_id?: string | null,
>   location?: string | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null,
>   region?: string | null,
>   auth?: {
>     method?: string | null
>   } | {
>     method?: string | null
>   } | null
> } | {
>   provider?: string | null,
>   secret_id?: string | null,
>   secret_name?: string | null,
>   resource_name?: string | null
> } | null
> ```

***

### createToken

`grid.createToken`

Creates a Grid access token. Exchanges your Baseten credentials for a short-lived token that authenticates against the Grid gateway as you, in the given team. Tokens expire after four hours and cannot be renewed; request a new one when needed. Routes keys cannot create tokens.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.grid.createToken({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string \| null` | No | ID of the team. When omitted, the team you belong to; required when you belong to several. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `token` | `string \| null` | No | Short-lived bearer token for the Grid gateway, scoped to you and the team. Send it as Authorization: Bearer \<token>. |
| `expires_at` | `string \| null` | No | Token expiry in ISO 8601 format. Tokens cannot be renewed; request a new one. |
| `team_id` | `string \| null` | No | ID of the team the token invokes Grid routes in. |
| `team_name` | `string \| null` | No | Name of that team. |

***

### machineUsers.apiKeys.create

`grid.machineUsers.apiKeys.create`

Creates an API key for a machine user. The machine user's other API keys stay active. Requires team admin for the machine user's team.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.grid.machineUsers.apiKeys.create({ machine_user_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `machine_user_id` | `string` | Yes | — |
| `name` | `string \| null` | No | Name of the API key: lowercase letters, numbers, and hyphens, at most 255 characters, and unique among the machine user's active keys. Defaults to a name derived from the machine user's. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `api_key` | `string \| null` | No | The API key string |

***

### machineUsers.apiKeys.list

`grid.machineUsers.apiKeys.list`

Lists a machine user's API keys. Lists the machine user's active API keys, newest first. Requires team admin for the machine user's team.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.grid.machineUsers.apiKeys.list({ machine_user_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `machine_user_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `keys` | `object[] \| null` | No | A list of API key information |

> [accordion] keys full type
>
> ```ts theme={null}
> {
>   prefix?: string | null,
>   name?: string | null | null,
>   type?: string | null,
>   model_ids?: string[] | null | null,
>   team_name?: string | null | null,
>   created_at?: string | null,
>   expires_at?: string | null | null,
>   last_used_at?: string | null | null,
>   owner?: {
>     user_id?: string | null,
>     email?: string | null | null,
>     name?: string | null | null
>   } | null | null
> }[] | null
> ```

***

### machineUsers.apiKeys.revoke

`grid.machineUsers.apiKeys.revoke`

Revokes a machine user's API key. The machine user's other API keys stay active. Requires team admin for the machine user's team. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.grid.machineUsers.apiKeys.revoke({ machine_user_id: 'example', api_key_prefix: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `machine_user_id` | `string` | Yes | — |
| `api_key_prefix` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `prefix` | `string \| null` | No | Unique prefix of the API key |

***

### machineUsers.create

`grid.machineUsers.create`

Creates a machine user. Creates a team-owned identity for an application, with its own Grid budget. Set api\_key to also create its first API key, which the response returns only once. Set the machine user's spend limit with the user settings endpoint, using its id as the user ID. Requires team admin.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.grid.machineUsers.create({ name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string \| null` | No | Identifier of the team that owns the machine user. Defaults to your only team, if you belong to exactly one. |
| `name` | `string` | Yes | Name of the machine user, unique within the team. At most 255 characters. |
| `api_key` | `object \| null` | No | When set, also creates the machine user's first API key. |

> [accordion] api\_key full type
>
> ```ts theme={null}
> {
>   name?: string | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable machine user identifier. Grid usage and settings identify the machine user by this ID as its `user_id`. |
| `name` | `string \| null` | No | Name of the machine user, unique within its team. |
| `team_id` | `string \| null` | No | Identifier of the team that owns the machine user. |
| `team_name` | `string \| null` | No | Name of the team that owns the machine user. |
| `created_by` | `string \| null \| null` | No | ID of the user who created the machine user. Null when unknown. |
| `created_at` | `string \| null` | No | Creation time, ISO 8601. |
| `api_key` | `string \| null \| null` | No | The first API key, returned only once. Null unless the request set `api_key`. |

***

### machineUsers.delete

`grid.machineUsers.delete`

Deletes a machine user. Revokes the machine user's API keys and deletes it. Its usage history remains. Requires team admin for the machine user's team. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.grid.machineUsers.delete({ machine_user_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `machine_user_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable identifier of the deleted machine user. |

***

### machineUsers.get

`grid.machineUsers.get`

Gets a machine user. Requires team admin for the machine user's team.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.grid.machineUsers.get({ machine_user_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `machine_user_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable machine user identifier. Grid usage and settings identify the machine user by this ID as its `user_id`. |
| `name` | `string \| null` | No | Name of the machine user, unique within its team. |
| `team_id` | `string \| null` | No | Identifier of the team that owns the machine user. |
| `team_name` | `string \| null` | No | Name of the team that owns the machine user. |
| `created_by` | `string \| null \| null` | No | ID of the user who created the machine user. Null when unknown. |
| `created_at` | `string \| null` | No | Creation time, ISO 8601. |

***

### machineUsers.list

`grid.machineUsers.list`

Lists machine users. Lists machine users, newest first: the team's with team\_id, which requires team admin for it, else those of every team you administer.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.grid.machineUsers.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `team_id` | `string \| null` | No | Limit machine users to this team. Without it, every team you administer. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   team_id?: string | null,
>   team_name?: string | null,
>   created_by?: string | null | null,
>   created_at?: string | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### machineUsers.update

`grid.machineUsers.update`

Updates a machine user. Changes only the fields in the request. Requires team admin for the machine user's team.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.grid.machineUsers.update({ machine_user_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `machine_user_id` | `string` | Yes | — |
| `name` | `string \| null` | No | Name of the machine user, unique within its team. At most 255 characters. Omit to keep it. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable machine user identifier. Grid usage and settings identify the machine user by this ID as its `user_id`. |
| `name` | `string \| null` | No | Name of the machine user, unique within its team. |
| `team_id` | `string \| null` | No | Identifier of the team that owns the machine user. |
| `team_name` | `string \| null` | No | Name of the team that owns the machine user. |
| `created_by` | `string \| null \| null` | No | ID of the user who created the machine user. Null when unknown. |
| `created_at` | `string \| null` | No | Creation time, ISO 8601. |

***

### routeClassifiers.get

`grid.routeClassifiers.get`

Gets a route classifier available for intelligent routes.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.grid.routeClassifiers.get({ route_classifier_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `route_classifier_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable route classifier identifier. |
| `display_name` | `string \| null` | No | Display name of the route classifier. |
| `supported_tradeoffs` | `string[] \| null` | No | Tradeoffs the route classifier supports. Empty when it supports all of them. |
| `decidable_canonical_model_ids` | `string[] \| null` | No | Canonical model ids the route classifier picks from. |

***

### routeClassifiers.list

`grid.routeClassifiers.list`

Lists route classifiers available for intelligent routes. Returns Baseten-managed route classifiers available to your organization, ordered by identifier. Route classifiers cannot be created or modified through this API.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.grid.routeClassifiers.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   display_name?: string | null,
>   supported_tradeoffs?: string[] | null,
>   decidable_canonical_model_ids?: string[] | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### routes.create

`grid.routes.create`

Creates a route. Creates and derives a name for the provided route configuration. CONNECTION targets reference a connection owned by the route's team; create the connection first. INTELLIGENT targets reference a route classifier from GET /v1/grid/route\_classifiers.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.grid.routes.create({
	target: { type: 'BASETEN_MODEL_API', model: 'deepseek-ai/DeepSeek-V4.1-Flash' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string \| null` | No | Identifier of the team that owns the route. |
| `display_name` | `string \| null` | No | Display label. Omit to use the route's name; required for INTELLIGENT targets. Null is not accepted. |
| `target` | `object` | Yes | Upstream target for the route. CONNECTION targets use the provider and credentials of a connection owned by the route's team. INTELLIGENT targets need at least one of the route classifier's models, and one of its fallback models, servable by the team. |
| `description` | `string \| null` | No | Short description of the route. Omit for no description; null is not accepted. |

> [accordion] target full type
>
> ```ts theme={null}
> {
>   type: BASETEN_MODEL_API,
>   model: string
> } | {
>   type: CONNECTION,
>   model: string,
>   connection_id: string
> } | {
>   type: INTELLIGENT,
>   route_classifier_id: string,
>   tradeoff: cost | balanced | intelligence
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable route identifier. |
| `name` | `string \| null` | No | Name to send in the inference request's `model` field. Unique within the team; immutable. |
| `display_name` | `string \| null` | No | Display label, defaulting to the route's name. |
| `aliases` | `object[] \| null` | No | The route's other names, one per purpose. Empty for routes created before aliases existed. |
| `team_id` | `string \| null` | No | Identifier of the owning team. |
| `team_name` | `string \| null` | No | Name of the owning team. |
| `description` | `string \| null` | No | Short description of the route, empty when unset. |
| `target` | `object \| null` | No | Configured upstream target. |
| `metadata` | `object \| null` | No | Resolved model metadata; for an intelligent route, the envelope of its servable models' metadata. Null when nothing is linked or the metadata has no supported API formats. |
| `invoke_url` | `string \| null` | No | Base URL for inference requests using this route. |
| `created_at` | `string \| null` | No | Creation time, ISO 8601. |

> [accordion] aliases full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   kind?: string | null
> }[] | null
> ```

> [accordion] target full type
>
> ```ts theme={null}
> {
>   type?: string | null,
>   model?: string | null
> } | {
>   type?: string | null,
>   model?: string | null,
>   connection_id?: string | null
> } | {
>   type?: string | null,
>   route_classifier?: {
>     id?: string | null,
>     display_name?: string | null,
>     supported_tradeoffs?: string[] | null,
>     decidable_canonical_model_ids?: string[] | null
>   } | null,
>   tradeoff?: string | null
> } | null
> ```

> [accordion] metadata full type
>
> ```ts theme={null}
> {
>   slug?: string | null | null,
>   display_name?: string | null | null,
>   release_date?: string | null | null,
>   provider?: string | null | null,
>   context_window?: number | null | null,
>   max_output_tokens?: number | null | null,
>   input_modalities?: string[] | null,
>   tools?: boolean | null | null,
>   reasoning_effort_levels?: string[] | null | null,
>   parallel_tool_calls?: boolean | null | null,
>   supported_api_formats?: {
>     messages?: boolean | null,
>     responses?: boolean | null,
>     chat_completions?: boolean | null,
>     gemini?: boolean | null
>   } | null | null,
>   cost?: {
>     input?: number | null | null,
>     output?: number | null | null,
>     cache_read?: number | null | null,
>     cache_write?: number | null | null,
>     long_context?: {
>       input?: number | null | null,
>       output?: number | null | null,
>       cache_read?: number | null | null,
>       cache_write?: number | null | null
>     } | null | null
>   } | null | null,
>   api_formats?: string[] | null
> } | null | null
> ```

***

### routes.delete

`grid.routes.delete`

Deletes a route. Cannot be undone. (DELETE /v1/grid/routes/\{route\_id})

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.grid.routes.delete({ route_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `route_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable identifier of the deleted route. |
| `name` | `string \| null` | No | Name of the deleted route. |

***

### routes.get

`grid.routes.get`

Gets a route. (GET /v1/grid/routes/\{route\_id})

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.grid.routes.get({ route_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `route_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable route identifier. |
| `name` | `string \| null` | No | Name to send in the inference request's `model` field. Unique within the team; immutable. |
| `display_name` | `string \| null` | No | Display label, defaulting to the route's name. |
| `aliases` | `object[] \| null` | No | The route's other names, one per purpose. Empty for routes created before aliases existed. |
| `team_id` | `string \| null` | No | Identifier of the owning team. |
| `team_name` | `string \| null` | No | Name of the owning team. |
| `description` | `string \| null` | No | Short description of the route, empty when unset. |
| `target` | `object \| null` | No | Configured upstream target. |
| `metadata` | `object \| null` | No | Resolved model metadata; for an intelligent route, the envelope of its servable models' metadata. Null when nothing is linked or the metadata has no supported API formats. |
| `invoke_url` | `string \| null` | No | Base URL for inference requests using this route. |
| `created_at` | `string \| null` | No | Creation time, ISO 8601. |

> [accordion] aliases full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   kind?: string | null
> }[] | null
> ```

> [accordion] target full type
>
> ```ts theme={null}
> {
>   type?: string | null,
>   model?: string | null
> } | {
>   type?: string | null,
>   model?: string | null,
>   connection_id?: string | null
> } | {
>   type?: string | null,
>   route_classifier?: {
>     id?: string | null,
>     display_name?: string | null,
>     supported_tradeoffs?: string[] | null,
>     decidable_canonical_model_ids?: string[] | null
>   } | null,
>   tradeoff?: string | null
> } | null
> ```

> [accordion] metadata full type
>
> ```ts theme={null}
> {
>   slug?: string | null | null,
>   display_name?: string | null | null,
>   release_date?: string | null | null,
>   provider?: string | null | null,
>   context_window?: number | null | null,
>   max_output_tokens?: number | null | null,
>   input_modalities?: string[] | null,
>   tools?: boolean | null | null,
>   reasoning_effort_levels?: string[] | null | null,
>   parallel_tool_calls?: boolean | null | null,
>   supported_api_formats?: {
>     messages?: boolean | null,
>     responses?: boolean | null,
>     chat_completions?: boolean | null,
>     gemini?: boolean | null
>   } | null | null,
>   cost?: {
>     input?: number | null | null,
>     output?: number | null | null,
>     cache_read?: number | null | null,
>     cache_write?: number | null | null,
>     long_context?: {
>       input?: number | null | null,
>       output?: number | null | null,
>       cache_read?: number | null | null,
>       cache_write?: number | null | null
>     } | null | null
>   } | null | null,
>   api_formats?: string[] | null
> } | null | null
> ```

***

### routes.getUsage

`grid.routes.getUsage`

Gets daily Grid usage and estimated costs. Buckets are UTC days, and days with no usage are included. Organization admins see all Grid usage in the organization. Team admins see usage in teams they manage.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.grid.routes.getUsage({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Number of daily buckets to return. Defaults to 7; maximum 31. |
| `team_id` | `string \| null` | No | Limit usage to a team you can access. Organization admins can view all usage in the team, team admins can view usage in teams they manage, and other members can view only their own usage. Without a team, organization admins see all organization usage, team admins see their managed teams, and other members see their own usage. |
| `start_date` | `string \| null` | No | Inclusive UTC calendar day at the start of the query range. Defaults to the previous UTC date, and is ignored when you pass a cursor. |
| `end_date` | `string \| null` | No | Exclusive UTC calendar day at the end of the query range. Defaults to the day after the current UTC date so current-day usage is included. |
| `group_by` | `(USER \| TEAM \| MODEL \| PROVIDER \| INTELLIGENT_ROUTE \| HARNESS \| API_KEY)[]` | No | Dimensions to break usage down by, repeated once per dimension: USER, TEAM, MODEL, PROVIDER, INTELLIGENT\_ROUTE, HARNESS, or API\_KEY. Each result represents one observed combination of the requested dimensions within that day, and results are sorted by those values. Combinations without usage are omitted, so result counts can differ between days. INTELLIGENT\_ROUTE returns only usage sent through an intelligent route, one row per intelligent route, or per intelligent route and model with MODEL. These rows repeat usage already counted in other groupings, so don't add them to model totals. HARNESS includes usage with no recorded harness as a null group. API\_KEY includes usage without an API key, such as requests authenticated by a signed-in session, as a null group. Defaults to MODEL. |
| `user_ids` | `string[]` | No | Return only usage from Routes keys created by these user IDs, repeated once per ID. |
| `models` | `string[]` | No | Return only usage for these exact model names, repeated once per model. |
| `providers` | `(BASETEN_MODEL_API \| OPENAI \| ANTHROPIC \| XAI \| VERTEX \| OPENAI_COMPATIBLE \| BEDROCK \| AZURE)[]` | No | Return only usage for these providers, repeated once per provider. |
| `harnesses` | `(CLAUDE_CODE \| OPENCODE \| CODEX \| PI)[]` | No | Return only usage for these harnesses, repeated once per harness. Omit to include all usage, including usage with no recorded harness. |
| `api_key_prefixes` | `string[]` | No | Return only usage made with these API keys, repeated once per key prefix. Omit to include all usage, including usage without an API key. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   date?: string | null,
>   results?: {
>     user_id?: string | null | null,
>     team_id?: string | null | null,
>     team_name?: string | null | null,
>     model?: string | null | null,
>     provider?: string | null | null,
>     intelligent_route_id?: string | null | null,
>     intelligent_route_display_name?: string | null | null,
>     harness?: string | null | null,
>     api_key_prefix?: string | null | null,
>     api_key_name?: string | null | null,
>     cost_usd?: string | null,
>     input_tokens?: number | null,
>     cached_input_tokens?: number | null,
>     uncached_input_tokens?: number | null,
>     output_tokens?: number | null,
>     requests?: number | null
>   }[] | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### routes.list

`grid.routes.list`

Lists routes. Lists routes you can invoke, newest first, optionally filtered by exact name. Without team\_id, routes from every team where you can invoke routes. With for\_harnesses, exactly one team: team\_id, else the team you belong to; when you belong to several and name none, the request fails with a 400.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.grid.routes.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `team_id` | `string \| null` | No | Limit routes to this team. Without it, routes from every team where you can invoke routes. |
| `for_harnesses` | `boolean` | No | Set by harness setup and sync. Returns routes from exactly one team: `team_id`, else the team you belong to; when you belong to several and name none, the request fails with a 400. |
| `name` | `string \| null` | No | Filter by exact route name, the value to send in the inference request's `model` field. Matches a route's name or any of its aliases. Preserved by the cursor; if repeated, must match the original filter. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   display_name?: string | null,
>   aliases?: {
>     name?: string | null,
>     kind?: string | null
>   }[] | null,
>   team_id?: string | null,
>   team_name?: string | null,
>   description?: string | null,
>   target?: {
>     type?: string | null,
>     model?: string | null
>   } | {
>     type?: string | null,
>     model?: string | null,
>     connection_id?: string | null
>   } | {
>     type?: string | null,
>     route_classifier?: {
>       id?: string | null,
>       display_name?: string | null,
>       supported_tradeoffs?: string[] | null,
>       decidable_canonical_model_ids?: string[] | null
>     } | null,
>     tradeoff?: string | null
>   } | null,
>   metadata?: {
>     slug?: string | null | null,
>     display_name?: string | null | null,
>     release_date?: string | null | null,
>     provider?: string | null | null,
>     context_window?: number | null | null,
>     max_output_tokens?: number | null | null,
>     input_modalities?: string[] | null,
>     tools?: boolean | null | null,
>     reasoning_effort_levels?: string[] | null | null,
>     parallel_tool_calls?: boolean | null | null,
>     supported_api_formats?: {
>       messages?: boolean | null,
>       responses?: boolean | null,
>       chat_completions?: boolean | null,
>       gemini?: boolean | null
>     } | null | null,
>     cost?: {
>       input?: number | null | null,
>       output?: number | null | null,
>       cache_read?: number | null | null,
>       cache_write?: number | null | null,
>       long_context?: {
>         input?: number | null | null,
>         output?: number | null | null,
>         cache_read?: number | null | null,
>         cache_write?: number | null | null
>       } | null | null
>     } | null | null,
>     api_formats?: string[] | null
>   } | null | null,
>   invoke_url?: string | null,
>   created_at?: string | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### routes.update

`grid.routes.update`

Updates a route. The route name, target, and owning team are immutable.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.grid.routes.update({ route_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `route_id` | `string` | Yes | — |
| `description` | `string \| null` | No | New description. Omit to keep the current description; use an empty string to clear it. Null is not accepted. |
| `display_name` | `string \| null` | No | New display label. Omit to keep the current label; null is not accepted. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable route identifier. |
| `name` | `string \| null` | No | Name to send in the inference request's `model` field. Unique within the team; immutable. |
| `display_name` | `string \| null` | No | Display label, defaulting to the route's name. |
| `aliases` | `object[] \| null` | No | The route's other names, one per purpose. Empty for routes created before aliases existed. |
| `team_id` | `string \| null` | No | Identifier of the owning team. |
| `team_name` | `string \| null` | No | Name of the owning team. |
| `description` | `string \| null` | No | Short description of the route, empty when unset. |
| `target` | `object \| null` | No | Configured upstream target. |
| `metadata` | `object \| null` | No | Resolved model metadata; for an intelligent route, the envelope of its servable models' metadata. Null when nothing is linked or the metadata has no supported API formats. |
| `invoke_url` | `string \| null` | No | Base URL for inference requests using this route. |
| `created_at` | `string \| null` | No | Creation time, ISO 8601. |

> [accordion] aliases full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   kind?: string | null
> }[] | null
> ```

> [accordion] target full type
>
> ```ts theme={null}
> {
>   type?: string | null,
>   model?: string | null
> } | {
>   type?: string | null,
>   model?: string | null,
>   connection_id?: string | null
> } | {
>   type?: string | null,
>   route_classifier?: {
>     id?: string | null,
>     display_name?: string | null,
>     supported_tradeoffs?: string[] | null,
>     decidable_canonical_model_ids?: string[] | null
>   } | null,
>   tradeoff?: string | null
> } | null
> ```

> [accordion] metadata full type
>
> ```ts theme={null}
> {
>   slug?: string | null | null,
>   display_name?: string | null | null,
>   release_date?: string | null | null,
>   provider?: string | null | null,
>   context_window?: number | null | null,
>   max_output_tokens?: number | null | null,
>   input_modalities?: string[] | null,
>   tools?: boolean | null | null,
>   reasoning_effort_levels?: string[] | null | null,
>   parallel_tool_calls?: boolean | null | null,
>   supported_api_formats?: {
>     messages?: boolean | null,
>     responses?: boolean | null,
>     chat_completions?: boolean | null,
>     gemini?: boolean | null
>   } | null | null,
>   cost?: {
>     input?: number | null | null,
>     output?: number | null | null,
>     cache_read?: number | null | null,
>     cache_write?: number | null | null,
>     long_context?: {
>       input?: number | null | null,
>       output?: number | null | null,
>       cache_read?: number | null | null,
>       cache_write?: number | null | null
>     } | null | null
>   } | null | null,
>   api_formats?: string[] | null
> } | null | null
> ```

***

### teamSettings.get

`grid.teamSettings.get`

Gets a team's Grid settings by team ID or your only team. Returns the settings that apply to the team, including the default models for each coding harness and the team's spend limits. Any member who can invoke the team's routes can read them. The team comes from team\_id instead of the path.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.grid.teamSettings.get({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string \| null` | No | ID of the team. When omitted, the team you belong to; required when you belong to several. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string \| null` | No | ID of the team. |
| `team_name` | `string \| null` | No | Name of the team. |
| `harness_defaults` | `object \| null` | No | — |
| `spend_limit` | `object \| null` | No | — |

> [accordion] harness\_defaults full type
>
> ```ts theme={null}
> {
>   claude_code?: {
>     primary?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null,
>     background?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null
>   } | null,
>   opencode?: {
>     primary?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null,
>     background?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null
>   } | null,
>   codex?: {
>     primary?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null,
>     background?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null
>   } | null,
>   pi?: {
>     primary?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null,
>     background?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null
>   } | null
> } | null
> ```

> [accordion] spend\_limit full type
>
> ```ts theme={null}
> {
>   per_member_monthly_limit_usd?: string | null | null,
>   team_wide_monthly_limit_usd?: string | null | null
> } | null
> ```

***

### teamSettings.update

`grid.teamSettings.update`

Updates a team's Grid settings by team ID or your only team. Changes only the fields in the request, all or nothing. Requires team admin, and organization admin to change the team-wide spend limit. The team comes from team\_id instead of the path. Omit it to use the team you belong to; when you belong to several, the request fails with a 400.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.grid.teamSettings.update({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `harness_defaults` | `object \| null` | No | Harnesses to change; harnesses left out are unchanged. Pass null to clear every harness, so each role uses the team's default. |
| `spend_limit` | `object \| null` | No | Spend limit fields to change. Pass null to remove the team's limits; omit to leave them unchanged. |
| `team_id` | `string \| null` | No | ID of the team. When omitted, the team you belong to; required when you belong to several. |

> [accordion] harness\_defaults full type
>
> ```ts theme={null}
> {
>   claude_code?: {
>     primary?: string | null,
>     background?: string | null
>   } | null,
>   opencode?: {
>     primary?: string | null,
>     background?: string | null
>   } | null,
>   codex?: {
>     primary?: string | null,
>     background?: string | null
>   } | null,
>   pi?: {
>     primary?: string | null,
>     background?: string | null
>   } | null
> } | null
> ```

> [accordion] spend\_limit full type
>
> ```ts theme={null}
> {
>   per_member_monthly_limit_usd?: string | null,
>   team_wide_monthly_limit_usd?: string | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string \| null` | No | ID of the team. |
| `team_name` | `string \| null` | No | Name of the team. |
| `harness_defaults` | `object \| null` | No | — |
| `spend_limit` | `object \| null` | No | — |

> [accordion] harness\_defaults full type
>
> ```ts theme={null}
> {
>   claude_code?: {
>     primary?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null,
>     background?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null
>   } | null,
>   opencode?: {
>     primary?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null,
>     background?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null
>   } | null,
>   codex?: {
>     primary?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null,
>     background?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null
>   } | null,
>   pi?: {
>     primary?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null,
>     background?: {
>       source?: string | null,
>       route?: {
>         id?: string | null,
>         name?: string | null,
>         display_name?: string | null,
>         aliases?: {
>           name?: string | null,
>           kind?: string | null
>         }[] | null,
>         team_id?: string | null,
>         team_name?: string | null,
>         description?: string | null,
>         target?: {
>           type?: string | null,
>           model?: string | null
>         } | {
>           type?: string | null,
>           model?: string | null,
>           connection_id?: string | null
>         } | {
>           type?: string | null,
>           route_classifier?: {
>             id?: string | null,
>             display_name?: string | null,
>             supported_tradeoffs?: string[] | null,
>             decidable_canonical_model_ids?: string[] | null
>           } | null,
>           tradeoff?: string | null
>         } | null,
>         metadata?: {
>           slug?: string | null | null,
>           display_name?: string | null | null,
>           release_date?: string | null | null,
>           provider?: string | null | null,
>           context_window?: number | null | null,
>           max_output_tokens?: number | null | null,
>           input_modalities?: string[] | null,
>           tools?: boolean | null | null,
>           reasoning_effort_levels?: string[] | null | null,
>           parallel_tool_calls?: boolean | null | null,
>           supported_api_formats?: {
>             messages?: boolean | null,
>             responses?: boolean | null,
>             chat_completions?: boolean | null,
>             gemini?: boolean | null
>           } | null | null,
>           cost?: {
>             input?: number | null | null,
>             output?: number | null | null,
>             cache_read?: number | null | null,
>             cache_write?: number | null | null,
>             long_context?: {
>               input?: number | null | null,
>               output?: number | null | null,
>               cache_read?: number | null | null,
>               cache_write?: number | null | null
>             } | null | null
>           } | null | null,
>           api_formats?: string[] | null
>         } | null | null,
>         invoke_url?: string | null,
>         created_at?: string | null
>       } | null
>     } | null | null
>   } | null
> } | null
> ```

> [accordion] spend\_limit full type
>
> ```ts theme={null}
> {
>   per_member_monthly_limit_usd?: string | null | null,
>   team_wide_monthly_limit_usd?: string | null | null
> } | null
> ```

***

### teamSettings.users.get

`grid.teamSettings.users.get`

Gets a user's Grid settings by team ID or your only team. Returns the user's spend limit for Baseten Grid in the team, their spend in the team this month, and whether that spend reached the limit. Members can read their own settings; team admins can read members' settings in teams they administer, and organization admins can read anyone's.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.grid.teamSettings.users.get({ user_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_id` | `string` | Yes | — |
| `team_id` | `string \| null` | No | ID of the team. When omitted, the team you belong to; required when you belong to several. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string \| null` | No | ID of the team. |
| `team_name` | `string \| null` | No | Name of the team. |
| `user_id` | `string \| null` | No | ID of the user. |
| `email` | `string \| null \| null` | No | Email address of the user. |
| `spend_limit` | `object \| null` | No | — |
| `month_spend_usd` | `string \| null` | No | The user's metered Grid spend in USD in the team this UTC calendar month, returned as an exact decimal string. |
| `is_blocked` | `boolean \| null` | No | Whether the user's spend this month reached their limit, or the team's spend reached its team-wide limit, so requests with Routes keys they created in the team are rejected. |
| `blocked_by` | `string \| null \| null` | No | `member` when the user's spend this month reached their limit, `team` when the team's spend reached its team-wide limit. Null when the user is not blocked. |

> [accordion] spend\_limit full type
>
> ```ts theme={null}
> {
>   user_monthly_limit_usd?: string | null | null,
>   month_override_usd?: string | null | null,
>   team_default?: {
>     team_id?: string | null,
>     team_name?: string | null,
>     per_member_monthly_limit_usd?: string | null
>   } | null | null,
>   effective?: {
>     monthly_limit_usd?: string | null | null,
>     source?: string | null | null
>   } | null,
>   team_wide_monthly_limit_usd?: string | null | null
> } | null
> ```

***

### teamSettings.users.list

`grid.teamSettings.users.list`

Lists members' Grid settings. Returns each member's settings in each team, including organization admins and Grid service accounts, one row per team membership. With team\_id, one team, which requires team admin for it or organization admin; without it, every team you administer, which is none for members.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.grid.teamSettings.users.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `team_id` | `string \| null` | No | Limit the list to this team. Without it, the members of every team you administer, one row per team. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   team_id?: string | null,
>   team_name?: string | null,
>   user_id?: string | null,
>   email?: string | null | null,
>   spend_limit?: {
>     user_monthly_limit_usd?: string | null | null,
>     month_override_usd?: string | null | null,
>     team_default?: {
>       team_id?: string | null,
>       team_name?: string | null,
>       per_member_monthly_limit_usd?: string | null
>     } | null | null,
>     effective?: {
>       monthly_limit_usd?: string | null | null,
>       source?: string | null | null
>     } | null,
>     team_wide_monthly_limit_usd?: string | null | null
>   } | null,
>   month_spend_usd?: string | null,
>   is_blocked?: boolean | null,
>   blocked_by?: string | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### teamSettings.users.update

`grid.teamSettings.users.update`

Updates a user's Grid settings by team ID or your only team. Changes only the fields in the request. Once the user's metered spend in the team in a month reaches the spend limit, requests with Routes keys they created in the team are rejected until the limit is raised or the next month starts.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.grid.teamSettings.users.update({ user_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_id` | `string` | Yes | — |
| `spend_limit` | `object \| null` | No | Spend limit fields to change. Pass null to remove the user's limit; omit to leave it unchanged. |
| `team_id` | `string \| null` | No | ID of the team. When omitted, the team you belong to; required when you belong to several. |

> [accordion] spend\_limit full type
>
> ```ts theme={null}
> {
>   user_monthly_limit_usd?: string | null,
>   month_override_usd?: string | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string \| null` | No | ID of the team. |
| `team_name` | `string \| null` | No | Name of the team. |
| `user_id` | `string \| null` | No | ID of the user. |
| `email` | `string \| null \| null` | No | Email address of the user. |
| `spend_limit` | `object \| null` | No | — |
| `month_spend_usd` | `string \| null` | No | The user's metered Grid spend in USD in the team this UTC calendar month, returned as an exact decimal string. |
| `is_blocked` | `boolean \| null` | No | Whether the user's spend this month reached their limit, or the team's spend reached its team-wide limit, so requests with Routes keys they created in the team are rejected. |
| `blocked_by` | `string \| null \| null` | No | `member` when the user's spend this month reached their limit, `team` when the team's spend reached its team-wide limit. Null when the user is not blocked. |

> [accordion] spend\_limit full type
>
> ```ts theme={null}
> {
>   user_monthly_limit_usd?: string | null | null,
>   month_override_usd?: string | null | null,
>   team_default?: {
>     team_id?: string | null,
>     team_name?: string | null,
>     per_member_monthly_limit_usd?: string | null
>   } | null | null,
>   effective?: {
>     monthly_limit_usd?: string | null | null,
>     source?: string | null | null
>   } | null,
>   team_wide_monthly_limit_usd?: string | null | null
> } | null
> ```

***

## Inference

### asyncPredict

`inference.asyncPredict`

Queues an async predict on a deployed model and returns its request\_id; the result goes to webhookEndpoint. Runs on the model's GPUs, which bill. Pick the target with environment (default production), deploymentId, development or regionalEnvironment.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.inference.asyncPredict({
	modelId: 'abcd1234',
	environment: 'staging',
	input: { prompt: 'Hello' },
	webhookEndpoint: 'https://example.com/hooks/baseten',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `modelId` | `string` | Yes | — |
| `environment` | `string` | No | Environment to call, such as `production` (the default) or `staging`. |
| `deploymentId` | `string` | No | Call this deployment by ID instead of an environment. |
| `development` | `true` | No | Call the development deployment instead of an environment. |
| `regionalEnvironment` | `string` | No | A regional environment (such as `prod-us`): sent to its own host, model-\<id>-\<env>.api.baseten.co. |
| `input` | `Record<string, JsonValue>` | Yes | The model's input, as its predict function expects it. |
| `webhookEndpoint` | `string` | No | HTTPS URL that receives the result. Without it the model must save its outputs itself. |
| `priority` | `number` | No | 0 (default) is the highest priority, 2 the lowest. |
| `maxTimeInQueueSeconds` | `number` | No | How long the request may wait in the queue (default 600 s). |
| `inferenceRetryConfig` | `object` | No | Retry backoff for the predict call. |

> [accordion] inferenceRetryConfig full type
>
> ```ts theme={null}
> {
>   max_attempts?: number,
>   initial_delay_ms?: number,
>   max_delay_ms?: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `request_id` | `string` | Yes | — |

***

### asyncRunRemote

`inference.asyncRunRemote`

Queues an async run\_remote on a deployed chain and returns its request\_id. Runs the chain's chainlets, which bill. Pick the target with environment (default production), deploymentId, development or regionalEnvironment.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.inference.asyncRunRemote({
	chainId: 'chn12345',
	input: {
		names: ['Ada', 'Grace'],
	},
	priority: 1,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chainId` | `string` | Yes | — |
| `environment` | `string` | No | Environment to call, such as `production` (the default) or `staging`. |
| `deploymentId` | `string` | No | Call this deployment by ID instead of an environment. |
| `development` | `true` | No | Call the development deployment instead of an environment. |
| `regionalEnvironment` | `string` | No | A regional environment (such as `prod-us`): sent to its own host, model-\<id>-\<env>.api.baseten.co. |
| `input` | `Record<string, JsonValue>` | Yes | The chain's input, matching its run\_remote signature. |
| `webhookEndpoint` | `string` | No | HTTPS URL that receives the result. Without it the model must save its outputs itself. |
| `priority` | `number` | No | 0 (default) is the highest priority, 2 the lowest. |
| `maxTimeInQueueSeconds` | `number` | No | How long the request may wait in the queue (default 600 s). |
| `inferenceRetryConfig` | `object` | No | Retry backoff for the predict call. |

> [accordion] inferenceRetryConfig full type
>
> ```ts theme={null}
> {
>   max_attempts?: number,
>   initial_delay_ms?: number,
>   max_delay_ms?: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `request_id` | `string` | Yes | — |

***

### cancelAsyncRequest

`inference.cancelAsyncRequest`

Cancels a queued async request (only QUEUED requests can be canceled). Pass modelId or chainId. Cannot be undone.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.inference.cancelAsyncRequest({ modelId: 'abcd1234', requestId: 'req1234567890' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `modelId` | `string` | No | — |
| `chainId` | `string` | No | — |
| `requestId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `request_id` | `string` | Yes | — |
| `canceled` | `boolean` | Yes | — |
| `message` | `string` | Yes | — |

***

### chatCompletions

`inference.chatCompletions`

Create a chat completion. Creates a chat completion for the provided conversation. This endpoint is fully compatible with the OpenAI Chat Completions API, allowing you to use standard OpenAI SDKs by changing only the base URL and API key. Runs a Model APIs model (OpenAI-compatible); billed per token. Returns one JSON reply (no streaming).

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.inference.chatCompletions({
	model: 'deepseek-ai/DeepSeek-V4.1-Flash',
	messages: [{ role: 'user', content: 'Say hello in five words.' }],
	max_tokens: 32,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `messages` | `object[]` | Yes | A list of messages representing the conversation history. Supports roles: `system`, `user`, `assistant`, and `tool`. |
| `model` | `string` | Yes | The model slug to use for completion, such as `deepseek-ai/DeepSeek-V4.1-Flash-1017`. Find available models at [Model APIs](https://app.baseten.co/model-apis/create). |
| `frequency_penalty` | `number` | No | Penalizes tokens based on how frequently they appear in the text so far. Positive values decrease repetition. Support varies by model. |
| `logit_bias` | `Record<string, number>` | No | A map of token IDs to bias values (-100 to 100). Use this to increase or decrease the likelihood of specific tokens appearing in the output. |
| `logprobs` | `boolean` | No | If `true`, returns log probabilities of the output tokens. Log probability support varies by model. |
| `top_logprobs` | `number` | No | Number of most likely tokens to return at each position (0-20). Requires `logprobs: true`. Log probability support varies by model. |
| `max_tokens` | `number` | No | Maximum number of tokens to generate. If your request input plus `max_tokens` exceeds the model's context length, `max_tokens` is truncated. If your request exceeds the context length by more than 16k tokens or if `max_tokens` signals no preference, context reservation is throttled to 49512 tokens. Higher `max_tokens` values slightly deprioritize request scheduling. |
| `n` | `number` | No | Number of completions to generate. Only `1` is supported. |
| `presence_penalty` | `number` | No | Penalizes tokens based on whether they have appeared in the text so far. Positive values encourage the model to discuss new topics. Support varies by model. |
| `response_format` | `object` | No | Specifies the output format. Use `{"type": "json_object"}` for JSON mode, or `{"type": "json_schema", "json_schema": {...}}` for structured outputs with a specific schema. |
| `seed` | `number` | No | Random seed for deterministic generation. Determinism is not guaranteed across different hardware or model versions. |
| `stop` | `string \| string[]` | No | Up to 32 sequences where the API stops generating further tokens. Can be a string or array of strings. |
| `temperature` | `number` | No | Controls randomness in the output. Lower values like 0.2 produce more focused and deterministic responses. Higher values like 1.5 produce more creative and varied output. |
| `top_p` | `number` | No | Nucleus sampling: only consider tokens with cumulative probability up to this value. Lower values like 0.1 produce more focused output. |
| `tools` | `object[]` | No | A list of tools (functions) the model may call. Each tool should have a `type: "function"` and a `function` object with `name`, `description`, and `parameters`. |
| `tool_choice` | `none \| required \| auto \| object` | No | Controls which tool (if any) the model calls. - `none`: Never call a tool. - `auto`: Model decides whether to call a tool. - `required`: Model must call at least one tool. - `{"type": "function", "function": {"name": "..."}}`: Call a specific function. |
| `parallel_tool_calls` | `boolean` | No | If `true`, the model can call multiple tools in a single response. |
| `user` | `string` | No | A unique identifier for the end-user, useful for tracking and abuse detection. |
| `best_of` | `number` | No | Number of candidate sequences to generate and return the best from. Only a value of 1 is supported. |
| `top_k` | `number` | No | Limits token selection to the top K most probable tokens at each step. Lower values like 10 produce more focused output. Set to -1 to disable. |
| `top_p_min` | `number` | No | Minimum value for dynamic `top_p`. When set, `top_p` dynamically adjusts but does not go below this value. |
| `min_p` | `number` | No | Minimum probability threshold for token selection. Filters out tokens with probability below `min_p * max_probability`. |
| `reasoning` | `object \| null` | No | Per-request reasoning controls. `max_tokens` caps reasoning tokens independently of the top-level `max_tokens` and overrides the model's default reasoning cap. Enforced on DeepSeek V4 Flash 0731, where reasoning is otherwise capped at 4096 tokens per request; other models ignore it. Applies when reasoning is enabled. |
| `reasoning_effort` | `none \| minimal \| low \| medium \| high \| xhigh \| max \| null` | No | How much reasoning a reasoning-capable model performs before answering. The gateway accepts `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`; models without reasoning support ignore the parameter. See the Model APIs reasoning page for per-model values. |
| `repetition_penalty` | `number` | No | Multiplicative penalty for repeated tokens. Values greater than 1.0 discourage repetition, values less than 1.0 encourage it. |
| `length_penalty` | `number` | No | Exponential penalty applied to sequence length during beam search. Values greater than 1.0 favor longer sequences. |
| `early_stopping` | `boolean` | No | If `true`, stops generation when at least `n` complete candidates are found. |
| `bad` | `string \| string[]` | No | Words or phrases to avoid in the output. Support varies by model. |
| `bad_token_ids` | `number[]` | No | Token IDs to avoid in the output. Support varies by model. |
| `stop_token_ids` | `number[]` | No | List of token IDs that cause generation to stop when encountered. |
| `include_stop_str_in_output` | `boolean` | No | If `true`, includes the matched stop string in the output. |
| `ignore_eos` | `boolean` | No | If `true`, continues generating past the end-of-sequence token. |
| `min_tokens` | `number` | No | Minimum number of tokens to generate before stopping. Useful for ensuring responses are not too short. |
| `skip_special_tokens` | `boolean` | No | If `true`, removes special tokens from the generated output. |
| `spaces_between_special_tokens` | `boolean` | No | If `true`, adds spaces between special tokens in the output. |
| `truncate_prompt_tokens` | `number` | No | If set, truncates the prompt to this many tokens. Useful for handling inputs that may exceed context limits. |
| `echo` | `boolean` | No | If `true` and the last message role matches the generation role, prepends that message to the output. |
| `add_generation_prompt` | `boolean` | No | If `true`, adds the generation prompt from the chat template, such as `<\|assistant\|>`. Set to `false` for completion-style generation. |
| `add_special_tokens` | `boolean` | No | If `true`, adds special tokens like BOS to the prompt beyond what the chat template adds. For most models, the chat template handles special tokens, so this should be `false`. |
| `documents` | `Record<string, string>[]` | No | A list of documents for RAG (retrieval-augmented generation). Each document is a dict with string keys and values that the model can reference. |
| `chat_template` | `string` | No | A custom Jinja template for formatting the conversation. If not provided, uses the model's default template. |
| `chat_template_args` | `object` | No | Additional arguments to pass to the chat template renderer. |
| `disaggregated_params` | `object` | No | Advanced parameters for disaggregated serving. Used internally. |

> [accordion] messages full type
>
> ```ts theme={null}
> {
>   role: system | user | assistant | tool,
>   content?: string | (
>     {
>       type: text,
>       text: string
>     } | {
>       type: image_url,
>       image_url: {
>         url: string,
>         detail?: auto | low | high
>       }
>     } | {
>       type: input_audio,
>       input_audio: {
>         data: string,
>         format: wav | mp3
>       }
>     }
>   )[] | null,
>   name?: string,
>   tool_calls?: {
>     id: string,
>     index?: number,
>     function: {
>       arguments: string | {
>       },
>       name: string
>     },
>     type: function
>   }[],
>   tool_call_id?: string
> }[]
> ```

> [accordion] response\_format full type
>
> ```ts theme={null}
> {
>   type: text
> } | {
>   type: json_schema,
>   json_schema: {
>     name: string,
>     description?: string,
>     schema: {
>     },
>     strict?: true
>   }
> } | {
>   type: json_object
> } | {
>   type: grammar,
>   grammar: string
> } | {
>   type: structural_tag,
>   structural_tag: string
> }
> ```

> [accordion] tools full type
>
> ```ts theme={null}
> {
>   type?: function,
>   function: {
>     name: string,
>     description?: string,
>     parameters?: {
>     },
>     strict?: boolean
>   }
> }[]
> ```

> [accordion] tool\_choice full type
>
> ```ts theme={null}
> none | required | auto | {
>   function: {
>     name: string
>   },
>   type?: function
> }
> ```

> [accordion] reasoning full type
>
> ```ts theme={null}
> {
>   max_tokens?: number | null
> } | null
> ```

> [accordion] chat\_template\_args full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] disaggregated\_params full type
>
> ```ts theme={null}
> {
>   request_type: string,
>   first_gen_tokens?: number[],
>   ctx_request_id?: number,
>   opaque_state?: string,
>   draft_tokens?: number[],
>   multimodal_embedding_handles?: {
>   }[],
>   multimodal_hashes?: number[][]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | A unique identifier for the chat completion. |
| `object` | `string \| null` | No | The object type, always `chat.completion` or `chat.completion.chunk` for streaming. |
| `created` | `number \| null` | No | The Unix timestamp (in seconds) of when the completion was created. |
| `model` | `string \| null` | No | The model used for the completion. |
| `choices` | `object[] \| null` | No | A list of chat completion choices. |
| `usage` | `object \| null` | No | Token usage statistics for the request. |

> [accordion] choices full type
>
> ```ts theme={null}
> {
>   index?: number | null,
>   message?: {
>     role?: string | null,
>     content?: string | null | null,
>     reasoning_content?: string | null | null,
>     tool_calls?: {
>       index?: number | null,
>       id?: string | null,
>       type?: string | null,
>       function?: {
>         name?: string | null,
>         arguments?: string | null
>       } | null
>     }[] | null
>   } | null,
>   finish_reason?: string | null | null,
>   stop_reason?: string | number | null | null,
>   logprobs?: {
>     content?: {
>       token?: string | null,
>       logprob?: number | null,
>       bytes?: number[] | null,
>       top_logprobs?: {
>         token?: string | null,
>         logprob?: number | null,
>         bytes?: number[] | null
>       }[] | null
>     }[] | null
>   } | null | null
> }[] | null
> ```

> [accordion] usage full type
>
> ```ts theme={null}
> {
>   completion_tokens?: number | null,
>   prompt_tokens?: number | null,
>   total_tokens?: number | null,
>   completion_tokens_details?: {
>     accepted_prediction_tokens?: number | null,
>     audio_tokens?: number | null,
>     reasoning_tokens?: number | null,
>     rejected_prediction_tokens?: number | null
>   } | null,
>   prompt_tokens_details?: {
>     audio_tokens?: number | null,
>     cached_tokens?: number | null
>   } | null
> } | null
> ```

***

### getAsyncQueueStatus

`inference.getAsyncQueueStatus`

Gets how many async requests are queued and in progress for a deployed model. Pick the target with environment (default production), deploymentId, development or regionalEnvironment.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.inference.getAsyncQueueStatus({ modelId: 'abcd1234', deploymentId: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `modelId` | `string` | Yes | — |
| `environment` | `string` | No | Environment to call, such as `production` (the default) or `staging`. |
| `deploymentId` | `string` | No | Call this deployment by ID instead of an environment. |
| `development` | `true` | No | Call the development deployment instead of an environment. |
| `regionalEnvironment` | `string` | No | A regional environment (such as `prod-us`): sent to its own host, model-\<id>-\<env>.api.baseten.co. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `deployment_id` | `string` | Yes | — |
| `num_queued_requests` | `number` | Yes | — |
| `num_in_progress_requests` | `number` | Yes | — |

***

### getAsyncRequest

`inference.getAsyncRequest`

Gets the status of an async model or chain request (QUEUED, IN\_PROGRESS, SUCCEEDED, FAILED, EXPIRED, CANCELED, WEBHOOK\_FAILED) and its errors. Pass modelId or chainId.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.inference.getAsyncRequest({ modelId: 'abcd1234', requestId: 'req1234567890' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `modelId` | `string` | No | — |
| `chainId` | `string` | No | — |
| `requestId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `request_id` | `string` | Yes | — |
| `model_id` | `string` | No | — |
| `chain_id` | `string` | No | — |
| `deployment_id` | `string` | Yes | — |
| `status` | `string` | Yes | — |
| `webhook_status` | `string` | Yes | — |
| `created_at` | `string` | Yes | — |
| `status_at` | `string` | Yes | — |
| `errors` | `object[]` | Yes | — |

> [accordion] errors full type
>
> ```ts theme={null}
> {
>   code: string,
>   message: string
> }[]
> ```

***

### messages

`inference.messages`

Create a message. Creates a response message for the provided conversation. Compatible with the Anthropic Messages API, so the Anthropic SDK works against this endpoint by changing base\_url and overriding the default x-api-key header with Authorization. Runs a Model APIs model through the Anthropic-compatible Messages API; billed per token. Returns one JSON reply (no streaming).

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.inference.messages({
	model: 'deepseek-ai/DeepSeek-V4.1-Flash',
	max_tokens: 32,
	messages: [{ role: 'user', content: 'Say hello in five words.' }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model` | `string` | Yes | The model slug to use. Find available models at [Model APIs](https://app.baseten.co/model-apis/create). |
| `messages` | `object[]` | Yes | The conversation history as an ordered list of input messages. Alternating `user` and `assistant` roles are expected; the final message must be from the `user`. |
| `max_tokens` | `number` | Yes | The maximum number of tokens to generate in the response. Required by the Messages API. The response may be shorter if it finishes naturally or hits a stop sequence. |
| `system` | `string \| object[]` | No | A system prompt that sets the model's behavior. Pass either a single string or an array of text content blocks. |
| `temperature` | `number` | No | Controls randomness. Lower values are more deterministic. Range: 0 to 1. |
| `top_p` | `number` | No | Nucleus sampling: only consider tokens with cumulative probability up to this value. |
| `top_k` | `number` | No | Limits token selection to the top K most probable tokens at each step. |
| `stop_sequences` | `string[]` | No | Custom text sequences that will stop generation. When a stop sequence is hit, `stop_reason` is `stop_sequence` and `stop_sequence` contains the matched string. |
| `tools` | `object[]` | No | A list of tools the model may call. Each tool has a `name`, `description`, and `input_schema` (a JSON Schema object). |
| `tool_choice` | `object` | No | Controls which tool (if any) the model calls. |
| `metadata` | `object` | No | An object describing metadata about the request. Supports `user_id` for abuse detection. |

> [accordion] messages full type
>
> ```ts theme={null}
> {
>   role: user | assistant,
>   content: string | (
>     {
>       type: text,
>       text: string
>     } | {
>       type: tool_use,
>       id: string,
>       name: string,
>       input: {
>       }
>     } | {
>       type: tool_result,
>       tool_use_id: string,
>       content: string | {
>         type: text,
>         text: string
>       }[],
>       is_error?: boolean
>     }
>   )[]
> }[]
> ```

> [accordion] system full type
>
> ```ts theme={null}
> string | {
>   type: text,
>   text: string
> }[]
> ```

> [accordion] tools full type
>
> ```ts theme={null}
> {
>   name: string,
>   description?: string,
>   input_schema: {
>   }
> }[]
> ```

> [accordion] tool\_choice full type
>
> ```ts theme={null}
> {
>   type: auto,
>   disable_parallel_tool_use?: boolean
> } | {
>   type: any
> } | {
>   type: tool,
>   name: string
> } | {
>   type: none
> }
> ```

> [accordion] metadata full type
>
> ```ts theme={null}
> {
>   user_id?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | A unique identifier for this message, such as `msg_abc123`. |
| `type` | `string \| null` | No | The object type, always `message`. |
| `role` | `string \| null` | No | The role of the generated message, always `assistant`. |
| `content` | `object[] \| null` | No | An array of content blocks generated by the model. Text responses contain a single `text` block; responses that invoke tools contain `tool_use` blocks. |
| `model` | `string \| null` | No | The model slug that produced the response. |
| `stop_reason` | `string \| null` | No | Why the model stopped generating: `end_turn` (natural stop), `max_tokens` (hit the `max_tokens` limit), `stop_sequence` (matched a `stop_sequences` entry), or `tool_use` (model invoked a tool). |
| `stop_sequence` | `string \| null \| null` | No | The stop sequence that was matched, if `stop_reason` is `stop_sequence`. Otherwise `null`. |
| `usage` | `object \| null` | No | Token usage statistics. |

> [accordion] content full type
>
> ```ts theme={null}
> (
>   {
>     type?: string | null,
>     text?: string | null
>   } | {
>     type?: string | null,
>     id?: string | null,
>     name?: string | null,
>     input?: {
>     } | null
>   }
> )[] | null
> ```

> [accordion] usage full type
>
> ```ts theme={null}
> {
>   input_tokens?: number | null,
>   output_tokens?: number | null,
>   cache_read_input_tokens?: number | null
> } | null
> ```

***

### predict

`inference.predict`

Calls a deployed model's predict endpoint and returns its JSON output. Runs on the model's GPUs, which bill, and can wake a scaled-to-zero deployment. Pick the target with environment (default production), deploymentId, development or regionalEnvironment.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.inference.predict({
	modelId: 'abcd1234',
	input: { prompt: 'Hello' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `modelId` | `string` | Yes | — |
| `environment` | `string` | No | Environment to call, such as `production` (the default) or `staging`. |
| `deploymentId` | `string` | No | Call this deployment by ID instead of an environment. |
| `development` | `true` | No | Call the development deployment instead of an environment. |
| `regionalEnvironment` | `string` | No | A regional environment (such as `prod-us`): sent to its own host, model-\<id>-\<env>.api.baseten.co. |
| `input` | `string \| number \| boolean \| null \| JsonValue[] \| Record<string, JsonValue>` | Yes | The model's input, as its predict function expects it. |

**Output:** `JsonValue`

***

### responses

`inference.responses`

Create a response. Creates a model response from an input string or a list of input items. Requests are stateless: Baseten stores no response, so send prior turns back as input rather than referring to an earlier response. Runs a Model APIs model through the Responses API; billed per token. Returns one JSON reply (no streaming).

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.inference.responses({ model: 'deepseek-ai/DeepSeek-V4.1-Flash', input: 'Say hello in five words.', max_output_tokens: 32 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model` | `string` | Yes | Model slug, such as `zai-org/GLM-5.3`. |
| `input` | `string \| object[]` | Yes | A prompt string, or the full conversation as input items. Include prior user messages, all response output items, and a function\_call\_output for each application function call. |
| `instructions` | `string` | No | System-level instructions for the request. |
| `max_output_tokens` | `number` | No | Upper bound on generated tokens, including reasoning tokens. |
| `temperature` | `number` | No | Sampling temperature, from 0 to 2. |
| `top_p` | `number` | No | Nucleus sampling threshold, from 0 to 1. |
| `tools` | `object[]` | No | Function tools the model can call. |
| `tool_choice` | `auto \| required \| none \| object` | No | Whether the model calls a tool. `auto` lets the model decide, `required` forces a call, `none` forbids one. |
| `parallel_tool_calls` | `boolean` | No | Lets the model emit more than one function call in a response. |
| `text` | `object` | No | Output format for the message text. |
| `reasoning` | `object` | No | Reasoning settings for models that expose them. |
| `metadata` | `Record<string, string>` | No | Up to 16 key-value pairs, echoed back on the response. |
| `truncation` | `auto \| disabled` | No | `auto` or `disabled`. |

> [accordion] input full type
>
> ```ts theme={null}
> string | (
>   {
>     role: user | assistant | system | developer,
>     content: string | {
>       type: input_text | output_text,
>       text: string
>     }[],
>     type?: message
>   } | {
>     type: reasoning,
>     id: string,
>     summary?: {
>     }[],
>     content?: {
>       type: reasoning_text,
>       text: string
>     }[]
>   } | {
>     type: function_call,
>     id?: string,
>     call_id: string,
>     name: string,
>     arguments: string
>   } | {
>     type: function_call_output,
>     call_id: string,
>     output: string
>   }
> )[]
> ```

> [accordion] tools full type
>
> ```ts theme={null}
> {
>   type: function,
>   name: string,
>   description?: string,
>   parameters: {
>   }
> }[]
> ```

> [accordion] tool\_choice full type
>
> ```ts theme={null}
> auto | required | none | {
>   type: function,
>   name: string
> }
> ```

> [accordion] text full type
>
> ```ts theme={null}
> {
>   format?: {
>     type: text
>   } | {
>     type: json_schema,
>     name: string,
>     schema: {
>     },
>     strict?: boolean
>   }
> }
> ```

> [accordion] reasoning full type
>
> ```ts theme={null}
> {
>   effort?: minimal | low | medium | high
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Response identifier, prefixed `resp_`. |
| `object` | `string \| null` | No | — |
| `created_at` | `number \| null` | No | — |
| `completed_at` | `number \| null \| null` | No | — |
| `status` | `string \| null` | No | — |
| `model` | `string \| null` | No | — |
| `output` | `object[] \| null` | No | Output items in the order the model produced them. |
| `usage` | `object \| null` | No | — |
| `incomplete_details` | `object \| null` | No | — |
| `error` | `object \| null` | No | — |
| `metadata` | `Record<string, string> \| null` | No | — |
| `instructions` | `string \| null \| null` | No | — |
| `max_output_tokens` | `number \| null \| null` | No | — |
| `parallel_tool_calls` | `boolean \| null` | No | — |
| `temperature` | `number \| null` | No | — |
| `top_p` | `number \| null` | No | — |
| `tool_choice` | `string \| null` | No | — |
| `tools` | `object[] \| null` | No | — |
| `truncation` | `string \| null` | No | — |
| `service_tier` | `string \| null` | No | — |
| `text` | `object \| null` | No | — |
| `reasoning` | `object \| null` | No | — |

> [accordion] output full type
>
> ```ts theme={null}
> (
>   {
>     type?: string | null,
>     id?: string | null,
>     status?: string | null,
>     role?: string | null,
>     content?: {
>       type?: string | null,
>       text?: string | null,
>       annotations?: {
>       }[] | null
>     }[] | null
>   } | {
>     type?: string | null,
>     id?: string | null,
>     summary?: {
>     }[] | null,
>     content?: {
>       type?: string | null,
>       text?: string | null
>     }[] | null
>   } | {
>     type?: string | null,
>     id?: string | null,
>     call_id?: string | null,
>     name?: string | null,
>     arguments?: string | null
>   }
> )[] | null
> ```

> [accordion] usage full type
>
> ```ts theme={null}
> {
>   input_tokens?: number | null,
>   input_tokens_details?: {
>     cached_tokens?: number | null,
>     cache_write_tokens?: number | null
>   } | null,
>   output_tokens?: number | null,
>   output_tokens_details?: {
>     reasoning_tokens?: number | null
>   } | null,
>   total_tokens?: number | null
> } | null | null
> ```

> [accordion] incomplete\_details full type
>
> ```ts theme={null}
> {
>   reason?: string | null
> } | null | null
> ```

> [accordion] error full type
>
> ```ts theme={null}
> {
> } | null | null
> ```

> [accordion] tools full type
>
> ```ts theme={null}
> {
> }[] | null
> ```

> [accordion] text full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] reasoning full type
>
> ```ts theme={null}
> {
> } | null | null
> ```

***

### runRemote

`inference.runRemote`

Calls a deployed chain's run\_remote entrypoint and returns its JSON output. Runs the chain's chainlets, which bill. Pick the target with environment (default production), deploymentId, development or regionalEnvironment.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.inference.runRemote({
	chainId: 'chn12345',
	input: {
		names: ['Ada', 'Grace'],
	},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `chainId` | `string` | Yes | — |
| `environment` | `string` | No | Environment to call, such as `production` (the default) or `staging`. |
| `deploymentId` | `string` | No | Call this deployment by ID instead of an environment. |
| `development` | `true` | No | Call the development deployment instead of an environment. |
| `regionalEnvironment` | `string` | No | A regional environment (such as `prod-us`): sent to its own host, model-\<id>-\<env>.api.baseten.co. |
| `input` | `Record<string, JsonValue>` | Yes | The chain's input, matching its run\_remote signature. |

**Output:** `JsonValue`

***

### wake

`inference.wake`

Wakes a scaled-to-zero model deployment: starts replicas, which bill while they run. Answers once the wake is accepted. Pick the target with environment (default production), deploymentId, development or regionalEnvironment.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.inference.wake({ modelId: 'abcd1234', development: true });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `modelId` | `string` | Yes | — |
| `environment` | `string` | No | Environment to call, such as `production` (the default) or `staging`. |
| `deploymentId` | `string` | No | Call this deployment by ID instead of an environment. |
| `development` | `true` | No | Call the development deployment instead of an environment. |
| `regionalEnvironment` | `string` | No | A regional environment (such as `prod-us`): sent to its own host, model-\<id>-\<env>.api.baseten.co. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `accepted` | `true` | Yes | — |

***

## Instance Types

### list

`instanceTypes.list`

Gets all available instance types. (GET /v1/instance\_types)

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.instanceTypes.list({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `instance_types` | `object[] \| null` | No | — |

> [accordion] instance\_types full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   memory_limit_mib?: number | null,
>   millicpu_limit?: number | null,
>   gpu_count?: number | null,
>   gpu_type?: string | null | null,
>   gpu_memory_limit_mib?: number | null | null
> }[] | null
> ```

***

### listPrices

`instanceTypes.listPrices`

Gets prices for available instance types.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.instanceTypes.listPrices({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `instance_types` | `object[] \| null` | No | — |

> [accordion] instance\_types full type
>
> ```ts theme={null}
> {
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   price?: number | null
> }[] | null
> ```

***

## Library Listings

### create

`libraryListings.create`

Creates a new library listing. Creates a new library listing for the authenticated user's organization.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.libraryListings.create({ display_name: 'example', user_defined_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `display_name` | `string` | Yes | Display name of the library listing |
| `user_defined_id` | `string` | Yes | User-defined identifier of the library listing |
| `is_public` | `boolean` | No | Whether the listing is publicly accessible |
| `is_listed` | `boolean` | No | Whether the listing appears in catalogs; unlisted listings still deploy from a direct link |
| `closed_source` | `boolean` | No | Whether the listing is closed source (deployers cannot view or download the Truss, and forks copy mirrored weights instead of re-mirroring from upstream) |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `display_name` | `string \| null` | No | Display name of the library listing |
| `user_defined_id` | `string \| null` | No | User-defined identifier of the library listing |
| `is_public` | `boolean \| null` | No | Whether the listing is publicly accessible |
| `is_listed` | `boolean \| null` | No | Whether the listing appears in catalogs; unlisted listings still deploy from a direct link |
| `trending` | `boolean \| null \| null` | No | Whether the listing is trending |
| `closed_source` | `boolean \| null` | No | Whether the listing is closed source (deployers cannot view or download the Truss, and forks copy mirrored weights instead of re-mirroring from upstream) |
| `created_at` | `string \| null` | No | Time the listing was created in ISO 8601 format |
| `modified_at` | `string \| null` | No | Time the listing was last modified |
| `metadata` | `object \| null` | No | Model-level metadata for this listing, if it has been uploaded. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
>   parameter_count?: number | null | null,
>   context_length?: number | null | null,
>   input_modalities?: string[] | null,
>   output_modalities?: string[] | null,
>   license?: string | null,
>   variant?: string | null | null,
>   base_model?: string | null | null,
>   publisher?: string | null | null,
>   model_api_slug?: string | null | null,
>   release_date?: string | null | null,
>   description?: string | null | null,
>   trending?: boolean | null,
>   model_family?: string | null | null
> } | null | null
> ```

***

### delete

`libraryListings.delete`

Deletes a library listing. Deletes a library listing and all of its associated versions. Any versions that are currently live will also be removed. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.libraryListings.delete({ user_defined_listing_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_defined_listing_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_defined_id` | `string \| null` | No | User-defined identifier of the library listing |
| `deleted` | `boolean \| null` | No | Whether the library listing was deleted |

***

### get

`libraryListings.get`

Gets a library listing. Returns a specific library listing by its user-defined identifier.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.libraryListings.get({ user_defined_listing_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_defined_listing_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `display_name` | `string \| null` | No | Display name of the library listing |
| `user_defined_id` | `string \| null` | No | User-defined identifier of the library listing |
| `is_public` | `boolean \| null` | No | Whether the listing is publicly accessible |
| `is_listed` | `boolean \| null` | No | Whether the listing appears in catalogs; unlisted listings still deploy from a direct link |
| `trending` | `boolean \| null \| null` | No | Whether the listing is trending |
| `closed_source` | `boolean \| null` | No | Whether the listing is closed source (deployers cannot view or download the Truss, and forks copy mirrored weights instead of re-mirroring from upstream) |
| `created_at` | `string \| null` | No | Time the listing was created in ISO 8601 format |
| `modified_at` | `string \| null` | No | Time the listing was last modified |
| `metadata` | `object \| null` | No | Model-level metadata for this listing, if it has been uploaded. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
>   parameter_count?: number | null | null,
>   context_length?: number | null | null,
>   input_modalities?: string[] | null,
>   output_modalities?: string[] | null,
>   license?: string | null,
>   variant?: string | null | null,
>   base_model?: string | null | null,
>   publisher?: string | null | null,
>   model_api_slug?: string | null | null,
>   release_date?: string | null | null,
>   description?: string | null | null,
>   trending?: boolean | null,
>   model_family?: string | null | null
> } | null | null
> ```

***

### list

`libraryListings.list`

Gets all library listings. Returns all library listings for the authenticated user's organization.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.libraryListings.list({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `listings` | `object[] \| null` | No | — |

> [accordion] listings full type
>
> ```ts theme={null}
> {
>   display_name?: string | null,
>   user_defined_id?: string | null,
>   is_public?: boolean | null,
>   is_listed?: boolean | null,
>   trending?: boolean | null | null,
>   closed_source?: boolean | null,
>   created_at?: string | null,
>   modified_at?: string | null,
>   metadata?: {
>     parameter_count?: number | null | null,
>     context_length?: number | null | null,
>     input_modalities?: string[] | null,
>     output_modalities?: string[] | null,
>     license?: string | null,
>     variant?: string | null | null,
>     base_model?: string | null | null,
>     publisher?: string | null | null,
>     model_api_slug?: string | null | null,
>     release_date?: string | null | null,
>     description?: string | null | null,
>     trending?: boolean | null,
>     model_family?: string | null | null
>   } | null | null
> }[] | null
> ```

***

### update

`libraryListings.update`

Updates a library listing. Updates a library listing. Supported fields are the display name, public visibility, listed status, trending status, and the model-level metadata. An unlisted listing is left out of catalogs but still deploys from its direct link. When metadata is provided, it replaces the stored metadata.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.libraryListings.update({ user_defined_listing_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_defined_listing_id` | `string` | Yes | — |
| `display_name` | `string \| null` | No | New display name for the library listing |
| `is_public` | `boolean \| null` | No | Whether the listing is publicly accessible |
| `trending` | `boolean \| null` | No | Whether the listing is trending |
| `is_listed` | `boolean \| null` | No | Whether the listing appears in catalogs; unlisted listings still deploy from a direct link |
| `metadata` | `object \| null` | No | Model-level metadata for the listing. When provided, replaces the stored metadata. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
>   parameter_count?: number | null,
>   context_length?: number | null,
>   input_modalities?: (text | image | audio | video | embedding | rerank | decision)[],
>   output_modalities?: (text | image | audio | video | embedding | rerank | decision)[],
>   license: string,
>   variant?: string | null,
>   base_model?: string | null,
>   publisher?: string | null,
>   model_api_slug?: string | null,
>   release_date?: string | null,
>   description?: string | null,
>   trending?: boolean,
>   model_family?: string | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `display_name` | `string \| null` | No | Display name of the library listing |
| `user_defined_id` | `string \| null` | No | User-defined identifier of the library listing |
| `is_public` | `boolean \| null` | No | Whether the listing is publicly accessible |
| `is_listed` | `boolean \| null` | No | Whether the listing appears in catalogs; unlisted listings still deploy from a direct link |
| `trending` | `boolean \| null \| null` | No | Whether the listing is trending |
| `closed_source` | `boolean \| null` | No | Whether the listing is closed source (deployers cannot view or download the Truss, and forks copy mirrored weights instead of re-mirroring from upstream) |
| `created_at` | `string \| null` | No | Time the listing was created in ISO 8601 format |
| `modified_at` | `string \| null` | No | Time the listing was last modified |
| `metadata` | `object \| null` | No | Model-level metadata for this listing, if it has been uploaded. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
>   parameter_count?: number | null | null,
>   context_length?: number | null | null,
>   input_modalities?: string[] | null,
>   output_modalities?: string[] | null,
>   license?: string | null,
>   variant?: string | null | null,
>   base_model?: string | null | null,
>   publisher?: string | null | null,
>   model_api_slug?: string | null | null,
>   release_date?: string | null | null,
>   description?: string | null | null,
>   trending?: boolean | null,
>   model_family?: string | null | null
> } | null | null
> ```

***

### versions.create

`libraryListings.versions.create`

Creates a new library listing version. Creates a new library listing version from an existing model version. The model version must be fully built (have an image\_uri). If a listing with the given id already exists for the org, a new version is added. Otherwise, a new listing is created.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.libraryListings.versions.create({ user_defined_listing_id: 'example', oracle_version_id: 'example', version_tag: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_defined_listing_id` | `string` | Yes | — |
| `display_name` | `string \| null` | No | Display name of the library listing. Required when creating a new listing. |
| `is_public` | `boolean` | No | Whether the listing is publicly accessible. Only used when creating a new listing. |
| `oracle_version_id` | `string` | Yes | Id of the source model version to publish |
| `allow_truss_download` | `boolean` | No | Whether users deploying this model can download the Truss |
| `closed_source` | `boolean` | No | Whether the listing is closed source (deployers cannot view or download the Truss, and forks copy mirrored weights instead of re-mirroring from upstream). Only used when creating a new listing. |
| `version_tag` | `string` | Yes | Human-readable tag for this version |
| `is_listed` | `boolean` | No | Whether the listing appears in catalogs; unlisted listings still deploy from a direct link. Only used when creating a new listing. |
| `replace_model` | `boolean` | No | Allow publishing from a different model than the listing's current one. The listing then points at the new model; earlier versions and existing deployments are unaffected. Fails if the new model already backs another listing. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `version_tag` | `string \| null` | No | Human-readable tag for this version |
| `is_live` | `boolean \| null` | No | Whether this version is the live version |
| `allow_truss_download` | `boolean \| null` | No | Whether users deploying this model can download the Truss |
| `oracle_version_id` | `string \| null` | No | Id of the source model version |
| `created_at` | `string \| null` | No | Time the version was created in ISO 8601 format |
| `modified_at` | `string \| null` | No | Time the version was last modified |
| `benchmark` | `object \| null` | No | Benchmark snapshot for this version, if one has been uploaded. |

> [accordion] benchmark full type
>
> ```ts theme={null}
> {
>   run_id?: string | null,
>   measured_at?: string | null,
>   llm?: {
>     ttft_ms_p50?: number | null | null,
>     output_tokens_per_sec_per_user_p50?: number | null | null,
>     max_concurrent_users_at_50ms_tpot?: number | null | null,
>     requests_per_sec_p50?: number | null | null,
>     cost_per_1m_tokens_usd?: number | null | null
>   } | null | null,
>   tts?: {
>     ttft_ms_p50?: number | null | null,
>     max_concurrent_streams_at_rtf1?: number | null | null,
>     ttft_ms_p50_at_max_concurrency?: number | null | null,
>     cost_per_audio_minute_usd?: number | null | null
>   } | null | null,
>   embedding?: {
>     e2e_latency_ms_p50?: number | null | null,
>     e2e_latency_ms_p99?: number | null | null,
>     input_tokens_per_sec?: number | null | null,
>     requests_per_sec?: number | null | null
>   } | null | null,
>   replicas?: number | null | null,
>   profile?: string | null | null
> } | null | null
> ```

***

### versions.delete

`libraryListings.versions.delete`

Deletes a library listing version. Deletes a specific version of a library listing. Deleting a live version will fail with a 400 error; demote the version first by setting another version as live. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.libraryListings.versions.delete({ user_defined_listing_id: 'example', version_tag: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_defined_listing_id` | `string` | Yes | — |
| `version_tag` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `version_tag` | `string \| null` | No | Human-readable tag for this version |
| `deleted` | `boolean \| null` | No | Whether the library listing version was deleted |

***

### versions.get

`libraryListings.versions.get`

Gets a library listing version. Returns a specific version of a library listing.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.libraryListings.versions.get({ user_defined_listing_id: 'example', version_tag: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_defined_listing_id` | `string` | Yes | — |
| `version_tag` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `version_tag` | `string \| null` | No | Human-readable tag for this version |
| `is_live` | `boolean \| null` | No | Whether this version is the live version |
| `allow_truss_download` | `boolean \| null` | No | Whether users deploying this model can download the Truss |
| `oracle_version_id` | `string \| null` | No | Id of the source model version |
| `created_at` | `string \| null` | No | Time the version was created in ISO 8601 format |
| `modified_at` | `string \| null` | No | Time the version was last modified |
| `benchmark` | `object \| null` | No | Benchmark snapshot for this version, if one has been uploaded. |

> [accordion] benchmark full type
>
> ```ts theme={null}
> {
>   run_id?: string | null,
>   measured_at?: string | null,
>   llm?: {
>     ttft_ms_p50?: number | null | null,
>     output_tokens_per_sec_per_user_p50?: number | null | null,
>     max_concurrent_users_at_50ms_tpot?: number | null | null,
>     requests_per_sec_p50?: number | null | null,
>     cost_per_1m_tokens_usd?: number | null | null
>   } | null | null,
>   tts?: {
>     ttft_ms_p50?: number | null | null,
>     max_concurrent_streams_at_rtf1?: number | null | null,
>     ttft_ms_p50_at_max_concurrency?: number | null | null,
>     cost_per_audio_minute_usd?: number | null | null
>   } | null | null,
>   embedding?: {
>     e2e_latency_ms_p50?: number | null | null,
>     e2e_latency_ms_p99?: number | null | null,
>     input_tokens_per_sec?: number | null | null,
>     requests_per_sec?: number | null | null
>   } | null | null,
>   replicas?: number | null | null,
>   profile?: string | null | null
> } | null | null
> ```

***

### versions.list

`libraryListings.versions.list`

Gets all versions for a library listing. Returns all versions for a specific library listing.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.libraryListings.versions.list({ user_defined_listing_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_defined_listing_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `versions` | `object[] \| null` | No | — |

> [accordion] versions full type
>
> ```ts theme={null}
> {
>   version_tag?: string | null,
>   is_live?: boolean | null,
>   allow_truss_download?: boolean | null,
>   oracle_version_id?: string | null,
>   created_at?: string | null,
>   modified_at?: string | null,
>   benchmark?: {
>     run_id?: string | null,
>     measured_at?: string | null,
>     llm?: {
>       ttft_ms_p50?: number | null | null,
>       output_tokens_per_sec_per_user_p50?: number | null | null,
>       max_concurrent_users_at_50ms_tpot?: number | null | null,
>       requests_per_sec_p50?: number | null | null,
>       cost_per_1m_tokens_usd?: number | null | null
>     } | null | null,
>     tts?: {
>       ttft_ms_p50?: number | null | null,
>       max_concurrent_streams_at_rtf1?: number | null | null,
>       ttft_ms_p50_at_max_concurrency?: number | null | null,
>       cost_per_audio_minute_usd?: number | null | null
>     } | null | null,
>     embedding?: {
>       e2e_latency_ms_p50?: number | null | null,
>       e2e_latency_ms_p99?: number | null | null,
>       input_tokens_per_sec?: number | null | null,
>       requests_per_sec?: number | null | null
>     } | null | null,
>     replicas?: number | null | null,
>     profile?: string | null | null
>   } | null | null
> }[] | null
> ```

***

### versions.update

`libraryListings.versions.update`

Updates a library listing version. Updates a library listing version. Setting is\_live to true will demote the current live version. When a benchmark is provided, it replaces the stored benchmark.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.libraryListings.versions.update({ user_defined_listing_id: 'example', version_tag: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_defined_listing_id` | `string` | Yes | — |
| `version_tag` | `string` | Yes | — |
| `is_live` | `boolean \| null` | No | Whether this version should be the live version. Setting to true demotes the current live version. |
| `allow_truss_download` | `boolean \| null` | No | Whether users deploying this model can download the Truss |
| `benchmark` | `object \| null` | No | Benchmark snapshot for this version. When provided, replaces the stored benchmark. |

> [accordion] benchmark full type
>
> ```ts theme={null}
> {
>   run_id: string,
>   measured_at: string,
>   llm?: {
>     ttft_ms_p50?: number | null,
>     output_tokens_per_sec_per_user_p50?: number | null,
>     max_concurrent_users_at_50ms_tpot?: number | null,
>     requests_per_sec_p50?: number | null,
>     cost_per_1m_tokens_usd?: number | null
>   } | null,
>   tts?: {
>     ttft_ms_p50?: number | null,
>     max_concurrent_streams_at_rtf1?: number | null,
>     ttft_ms_p50_at_max_concurrency?: number | null,
>     cost_per_audio_minute_usd?: number | null
>   } | null,
>   embedding?: {
>     e2e_latency_ms_p50?: number | null,
>     e2e_latency_ms_p99?: number | null,
>     input_tokens_per_sec?: number | null,
>     requests_per_sec?: number | null
>   } | null,
>   replicas?: number | null,
>   profile?: string | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `version_tag` | `string \| null` | No | Human-readable tag for this version |
| `is_live` | `boolean \| null` | No | Whether this version is the live version |
| `allow_truss_download` | `boolean \| null` | No | Whether users deploying this model can download the Truss |
| `oracle_version_id` | `string \| null` | No | Id of the source model version |
| `created_at` | `string \| null` | No | Time the version was created in ISO 8601 format |
| `modified_at` | `string \| null` | No | Time the version was last modified |
| `benchmark` | `object \| null` | No | Benchmark snapshot for this version, if one has been uploaded. |

> [accordion] benchmark full type
>
> ```ts theme={null}
> {
>   run_id?: string | null,
>   measured_at?: string | null,
>   llm?: {
>     ttft_ms_p50?: number | null | null,
>     output_tokens_per_sec_per_user_p50?: number | null | null,
>     max_concurrent_users_at_50ms_tpot?: number | null | null,
>     requests_per_sec_p50?: number | null | null,
>     cost_per_1m_tokens_usd?: number | null | null
>   } | null | null,
>   tts?: {
>     ttft_ms_p50?: number | null | null,
>     max_concurrent_streams_at_rtf1?: number | null | null,
>     ttft_ms_p50_at_max_concurrency?: number | null | null,
>     cost_per_audio_minute_usd?: number | null | null
>   } | null | null,
>   embedding?: {
>     e2e_latency_ms_p50?: number | null | null,
>     e2e_latency_ms_p99?: number | null | null,
>     input_tokens_per_sec?: number | null | null,
>     requests_per_sec?: number | null | null
>   } | null | null,
>   replicas?: number | null | null,
>   profile?: string | null | null
> } | null | null
> ```

***

## Llm Models

### create

`llmModels.create`

Creates a new BIS-LLM deployment. (POST /v1/llm\_models)

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.llmModels.create({
	resources: {},
	name: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `resources` | `object` | Yes | Resources allocated to the model |
| `deployment_name` | `string \| null` | No | Name of the deployment, unique within the model. Use only A-Z, a-z, 0-9, '-', '\_', and '.'. The name 'development' is reserved. If omitted or empty, a name is generated automatically. |
| `region` | `string \| null` | No | Region in which to deploy the model |
| `llm_version` | `string \| null` | No | Version of the helm chart to use. |
| `llm_config` | `object` | No | Configuration specific to the LLM model |
| `environment_variables` | `object` | No | Environment variables for the model |
| `model_metadata` | `object \| null` | No | Model metadata persisted into model\_config |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for the model |
| `additional_autoscaling_config` | `object \| null` | No | Additional autoscaling configuration (e.g. target in-flight tokens) |
| `metadata` | `object \| null` | No | User-defined metadata for the deployment |
| `weights` | `object[] \| null` | No | Weight configurations for BDN model weight distribution |
| `bdn` | `object \| null` | No | BDN configuration: read-only sealed volume mounts, and Hot Load at /bdn on worker pods |
| `egress_restrictions` | `object \| null` | No | Restricts this deployment's egress to the specified FQDNs and IP addresses; an empty block allows none. Requires the organization to have egress restrictions enabled. |
| `runtime` | `object \| null` | No | Runtime configuration for the deployment |
| `name` | `string` | Yes | Name of the model |

> [accordion] resources full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] llm\_config full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] environment\_variables full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] model\_metadata full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null,
>   scale_down_delay?: number | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null,
>   target_in_flight_tokens?: number | null,
>   max_scale_down_rate?: number | null
> } | null
> ```

> [accordion] additional\_autoscaling\_config full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] weights full type
>
> ```ts theme={null}
> {
> }[] | null
> ```

> [accordion] bdn full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] egress\_restrictions full type
>
> ```ts theme={null}
> {
>   fqdn_allow_list?: string[] | null,
>   ip_allow_list?: string[] | null
> } | null
> ```

> [accordion] runtime full type
>
> ```ts theme={null}
> {
>   oidc?: {
>     enabled?: boolean | null,
>     byok?: {
>     } | null
>   } | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string \| null` | No | Unique identifier of the model |
| `version_id` | `string \| null` | No | Unique identifier of the model version |
| `hostname` | `string \| null` | No | Hostname used to invoke the model |
| `instance_type_name` | `string \| null \| null` | No | Name of the instance type the model deployment is running on |

***

### createDeployment

`llmModels.createDeployment`

Creates a new BIS-LLM deployment version.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.llmModels.createDeployment({
	model_id: 'abcd1234',
	resources: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `resources` | `object` | Yes | Resources allocated to the model |
| `deployment_name` | `string \| null` | No | Name of the deployment, unique within the model. Use only A-Z, a-z, 0-9, '-', '\_', and '.'. The name 'development' is reserved. If omitted or empty, a name is generated automatically. |
| `region` | `string \| null` | No | Region in which to deploy the model |
| `llm_version` | `string \| null` | No | Version of the helm chart to use. |
| `llm_config` | `object` | No | Configuration specific to the LLM model |
| `environment_variables` | `object` | No | Environment variables for the model |
| `model_metadata` | `object \| null` | No | Model metadata persisted into model\_config |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for the model |
| `additional_autoscaling_config` | `object \| null` | No | Additional autoscaling configuration (e.g. target in-flight tokens) |
| `metadata` | `object \| null` | No | User-defined metadata for the deployment |
| `weights` | `object[] \| null` | No | Weight configurations for BDN model weight distribution |
| `bdn` | `object \| null` | No | BDN configuration: read-only sealed volume mounts, and Hot Load at /bdn on worker pods |
| `egress_restrictions` | `object \| null` | No | Restricts this deployment's egress to the specified FQDNs and IP addresses; an empty block allows none. Requires the organization to have egress restrictions enabled. |
| `runtime` | `object \| null` | No | Runtime configuration for the deployment |

> [accordion] resources full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] llm\_config full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] environment\_variables full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] model\_metadata full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null,
>   scale_down_delay?: number | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null,
>   target_in_flight_tokens?: number | null,
>   max_scale_down_rate?: number | null
> } | null
> ```

> [accordion] additional\_autoscaling\_config full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] weights full type
>
> ```ts theme={null}
> {
> }[] | null
> ```

> [accordion] bdn full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] egress\_restrictions full type
>
> ```ts theme={null}
> {
>   fqdn_allow_list?: string[] | null,
>   ip_allow_list?: string[] | null
> } | null
> ```

> [accordion] runtime full type
>
> ```ts theme={null}
> {
>   oidc?: {
>     enabled?: boolean | null,
>     byok?: {
>     } | null
>   } | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string \| null` | No | Unique identifier of the model |
| `version_id` | `string \| null` | No | Unique identifier of the model version |
| `hostname` | `string \| null` | No | Hostname used to invoke the model |
| `instance_type_name` | `string \| null \| null` | No | Name of the instance type the model deployment is running on |

***

## Loops

### checkpoints.delete

`loops.checkpoints.delete`

Deletes a Loops checkpoint. Deletes a Loops checkpoint by ID and returns its tombstone. The checkpoint disappears from listings and can't be loaded, sampled, or deployed. Deletion is permanent, and storage for some checkpoints is reclaimed later. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.loops.checkpoints.delete({ checkpoint_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `checkpoint_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The deleted checkpoint ID. |
| `run_id` | `string \| null` | No | The ID of the run that produced the checkpoint. |
| `checkpoint_id` | `string \| null` | No | Deprecated: use `checkpoint_name`, which has the same value. |
| `checkpoint_name` | `string \| null` | No | The name the checkpoint was saved under. |
| `target` | `string \| null` | No | Whether a TrainerServerCheckpoint is loadable by the sampler or the trainer. SAMPLER checkpoints are consumed by the sampling server for inference; TRAINER checkpoints capture full trainer state for resuming training. Mirrored in the bt:// URI as `bt://loops:<trainer_id>/(sampler_weights\|weights)/<name>`. |
| `path` | `string \| null` | No | The checkpoint's bt:// path. |

***

### checkpoints.deploy

`loops.checkpoints.deploy`

Deploys Loops checkpoints. Creates an inference deployment from one or more Loops sampler checkpoints. Confirm the user intends to create billable resources before calling it. This operation is not idempotent; repeating the request can create another deployment.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.loops.checkpoints.deploy({
	checkpoint_ids: ['example'],
	model_name: 'example',
	instance_type_id: 'example',
	hf_secret_name: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `checkpoint_ids` | `string[]` | Yes | Sampler checkpoint IDs to deploy together. |
| `model_name` | `string` | Yes | Name for the created model. |
| `instance_type_id` | `string` | Yes | Instance type ID for the deployment. |
| `hf_secret_name` | `string` | Yes | Name of the team-scoped secret that supplies HF\_TOKEN. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string \| null` | No | ID of the created or updated model. |
| `deployment_id` | `string \| null` | No | ID of the created model version deployment. |

***

### checkpoints.getFiles

`loops.checkpoints.getFiles`

Gets Loops checkpoint files. Gets presigned URLs for the files under a Loops checkpoint. Returns a paginated list.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.checkpoints.getFiles({ checkpoint_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `checkpoint_id` | `string` | Yes | — |
| `page_size` | `number` | No | Max files per page (default 1000). |
| `page_token` | `number` | No | Offset into the file list (default 0). |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `presigned_urls` | `object[] \| null` | No | List of presigned URLs for checkpoint files. |
| `next_page_token` | `number \| null \| null` | No | Token to use for fetching the next page of results. None when there are no more results. |
| `total_count` | `number \| null` | No | Total number of checkpoint files available. |

> [accordion] presigned\_urls full type
>
> ```ts theme={null}
> {
>   url?: string | null,
>   relative_file_name?: string | null,
>   node_rank?: number | null,
>   size_bytes?: number | null,
>   last_modified?: string | null
> }[] | null
> ```

***

### checkpoints.getSource

`loops.checkpoints.getSource`

Gets where a Loops checkpoint's files come from. Reports how to fetch a checkpoint's files: s3 when the files endpoint serves presigned URLs for it, or volume with the ref to pull. Clients that download checkpoints should ask here first.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.checkpoints.getSource({ checkpoint_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `checkpoint_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `source` | `object \| null` | No | `s3` means the files endpoint serves presigned URLs for this checkpoint; `volume` carries the ref to pull instead. |

> [accordion] source full type
>
> ```ts theme={null}
> {
>   kind?: string | null
> } | {
>   kind?: string | null,
>   volume_ref?: string | null,
>   path?: string | null
> } | null
> ```

***

### checkpoints.list

`loops.checkpoints.list`

Lists Loops checkpoints. Lists Loops checkpoints filtered by run id, base model, or bt:// URI. Provide exactly one filter.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.checkpoints.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `run_id` | `string \| null` | No | Filter by run ID. Returns all checkpoints saved by the run. |
| `base_model` | `string \| null` | No | Filter by base model. Returns checkpoints across the caller's runs of this base model. |
| `checkpoint_path` | `string \| null` | No | bt:// URI of a Loops checkpoint. Form: bt://loops:\<run\_id>/(weights\|sampler\_weights)/\<checkpoint\_name>. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `checkpoints` | `object[] \| null` | No | Matching checkpoints. |

> [accordion] checkpoints full type
>
> ```ts theme={null}
> {
>   checkpoint_id?: string | null,
>   checkpoint_name?: string | null,
>   created_at?: string | null,
>   checkpoint_type?: string | null,
>   base_model?: string | null | null,
>   lora_adapter_config?: {
>   } | null | null,
>   size_bytes?: number | null,
>   sync_status?: string | null | null,
>   id?: string | null,
>   lora_config?: {
>     config_version?: string | null,
>     targets?: string[] | null,
>     expert_layout?: string | null | null
>   } | null | null,
>   run_id?: string | null,
>   target?: string | null,
>   expires_at?: string | null | null
> }[] | null
> ```

***

### checkpoints.setTtl

`loops.checkpoints.setTtl`

Sets a Loops checkpoint's TTL. Sets when a Loops checkpoint expires, counted from now, or removes its TTL so it's kept until you delete it. An expired checkpoint is deleted within 24 hours. If it's in use when it expires, it's deleted within 24 hours after it stops being used.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.loops.checkpoints.setTtl({ checkpoint_id: 'example', ttl_seconds: 3600 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `checkpoint_id` | `string` | Yes | — |
| `ttl_seconds` | `number \| null` | Yes | Seconds from now until the checkpoint expires and is deleted, from 3600 (1 hour) to 315360000 (10 years). Null removes the TTL, so the checkpoint never expires. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `checkpoint_id` | `string \| null` | No | Deprecated: use `checkpoint_name`, which has the same value. |
| `checkpoint_name` | `string \| null` | No | The checkpoint's name, for example `checkpoint-500`. To refer to the checkpoint in a URL, use its `id`. |
| `created_at` | `string \| null` | No | The timestamp of the checkpoint in ISO 8601 format. |
| `checkpoint_type` | `string \| null` | No | The type of checkpoint. |
| `base_model` | `string \| null \| null` | No | The base model of the checkpoint. |
| `lora_adapter_config` | `object \| null` | No | The adapter config of the checkpoint. |
| `size_bytes` | `number \| null` | No | The size of the checkpoint in bytes. |
| `sync_status` | `string \| null \| null` | No | Sync state of the checkpoint: SYNCING or COMPLETE. |
| `id` | `string \| null` | No | The checkpoint's unique ID, used in checkpoint URLs. |
| `lora_config` | `object \| null` | No | The immutable LoRA config used to save this checkpoint. Null means the checkpoint is unsupported and cannot be loaded. |
| `run_id` | `string \| null` | No | The ID of the run that produced the checkpoint. |
| `target` | `string \| null` | No | Whether a TrainerServerCheckpoint is loadable by the sampler or the trainer. SAMPLER checkpoints are consumed by the sampling server for inference; TRAINER checkpoints capture full trainer state for resuming training. Mirrored in the bt:// URI as `bt://loops:<trainer_id>/(sampler_weights\|weights)/<name>`. |
| `expires_at` | `string \| null \| null` | No | When the checkpoint expires and is deleted, set from the TTL it was saved with. Null means it's kept until you delete it. A checkpoint that's still in use when it expires, for example deployed, is deleted once it's released. |

> [accordion] lora\_adapter\_config full type
>
> ```ts theme={null}
> {
> } | null | null
> ```

> [accordion] lora\_config full type
>
> ```ts theme={null}
> {
>   config_version?: string | null,
>   targets?: string[] | null,
>   expert_layout?: string | null | null
> } | null | null
> ```

***

### checkpoints.validate

`loops.checkpoints.validate`

Validates a Loops checkpoint bt:// URI. Returns whether the caller can manage and use this checkpoint.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.checkpoints.validate({ checkpoint_path: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `checkpoint_path` | `string` | Yes | bt:// URI of a sampler checkpoint. Form: bt://loops:\<run\_id>/sampler\_weights/\<checkpoint\_name>. |
| `run_id` | `string \| null` | No | Loops run whose sampler will load the checkpoint. The checkpoint must use the run's LoRA config. |

**Output:** *empty object*

***

### deployments.deactivate

`loops.deployments.deactivate`

Deactivates a Loops deployment. Shuts down a Loops deployment by ID. Saved checkpoints remain accessible. Resolving the base model to a deployment ID is the caller's responsibility: list deployments and pick the active one.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.loops.deployments.deactivate({ deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The deactivated Loops deployment ID. |
| `base_model` | `string \| null` | No | The base model whose Loops deployment was deactivated. |
| `user` | `object \| null` | No | A user. |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   email?: string | null | null
> } | null
> ```

***

### deployments.get

`loops.deployments.get`

Gets a Loops deployment. Fetches a Loops deployment by ID, including its latest status.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.deployments.get({ deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `deployment_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deployment` | `object \| null` | No | A Loops deployment — the long-lived run + sampler pair owned by a user. The deployment's current sampler is included inline. The full list of samplers visible to the caller (across all deployments) lives at `GET /v1/loops/samplers`. |

> [accordion] deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   active_run_id?: string | null | null,
>   latest_run_id?: string | null | null,
>   base_model?: string | null,
>   base_checkpoint?: string | null | null,
>   base_url?: string | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   created_at?: string | null,
>   availability_model?: string | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   node_count?: number | null,
>   sampler?: {
>     id?: string | null,
>     session_id?: string | null,
>     base_url?: string | null,
>     base_model?: string | null,
>     created_at?: string | null,
>     model_id?: string | null | null,
>     deployment_id?: string | null | null,
>     status?: {
>       name?: string | null
>     } | null,
>     user?: {
>       email?: string | null | null
>     } | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null | null,
>     node_count?: number | null,
>     base_checkpoint?: string | null | null
>   } | null | null
> } | null
> ```

***

### deployments.getDebugArchiveFiles

`loops.deployments.getDebugArchiveFiles`

Gets Loops debug archive files. Gets presigned download URLs for a Loops deployment's debug archive.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.deployments.getDebugArchiveFiles({ deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `deployment_id` | `string` | Yes | — |
| `page_size` | `number` | No | Max files per page (default and maximum 1000). |
| `page_token` | `string \| null` | No | Opaque token for the next page. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `presigned_urls` | `object[] \| null` | No | — |
| `next_page_token` | `string \| null \| null` | No | — |

> [accordion] presigned\_urls full type
>
> ```ts theme={null}
> {
>   url?: string | null,
>   relative_file_name?: string | null,
>   node_rank?: number | null,
>   size_bytes?: number | null,
>   last_modified?: string | null
> }[] | null
> ```

***

### deployments.getLogs

`loops.deployments.getLogs`

Gets logs for a Loops trainer deployment. Fetches logs from the trainer pods of a Loops deployment. Visible to anyone with training access to the deployment's team.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.deployments.getLogs({ deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `deployment_id` | `string` | Yes | — |
| `start_epoch_millis` | `number \| null` | No | Epoch milliseconds at which to start fetching logs. Defaults to 30 minutes before the end. The window from start to end must not exceed 7 days. |
| `end_epoch_millis` | `number \| null` | No | Epoch milliseconds at which to stop fetching logs. Defaults to the current time. |
| `direction` | `asc \| desc \| null` | No | Sort order for logs |
| `limit` | `number \| null` | No | Limit of logs to fetch in a single request |
| `min_level` | `DEBUG \| INFO \| WARNING \| ERROR \| null` | No | Minimum log severity to include. Omit to return all log lines, including lines that have no level. Any explicit value returns lines at or above that severity and drops lines without a level. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `logs` | `object[] \| null` | No | Logs for a specific entity. |

> [accordion] logs full type
>
> ```ts theme={null}
> {
>   timestamp?: string | null,
>   message?: string | null,
>   replica?: string | null | null,
>   request_id?: string | null | null,
>   level?: string | null | null
> }[] | null
> ```

***

### deployments.getMetrics

`loops.deployments.getMetrics`

Gets metrics for a Loops trainer deployment. Returns per-node GPU/CPU/memory utilization and Knative queue-proxy request rate / concurrency / latency for the trainer pods. The sampler half of a Loops deployment is an OracleVersion and uses the existing model-metrics endpoint.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.deployments.getMetrics({ deployment_id: 'wxyz5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `deployment_id` | `string` | Yes | — |
| `end_epoch_millis` | `number \| null` | No | Epoch millis to end fetching metrics. |
| `start_epoch_millis` | `number \| null` | No | Epoch millis to start fetching metrics. |
| `step_seconds` | `number \| null` | No | Resolution of the returned series, in seconds. When omitted, a step is derived from the time range so large windows return fewer points. |
| `time_divisor_seconds` | `number \| null` | No | Unit of time for request-volume metrics, in seconds (e.g. 60 for requests/minute). Defaults to per-second. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deployment_id` | `string \| null` | No | The trainer deployment ID. |
| `metrics` | `object \| null` | No | Metrics for a trainer (Loops) deployment. Service-level fields summarize HTTP traffic into the trainer pods (the Knative queue-proxy is the source). Compute fields are the leader-pod aggregate; `per_node_metrics` carries the full multinode breakdown. |

> [accordion] metrics full type
>
> ```ts theme={null}
> {
>   inference_volume?: {
>     value?: number | null,
>     timestamp?: string | null
>   }[] | null,
>   concurrent_requests?: {
>     value?: number | null,
>     timestamp?: string | null
>   }[] | null,
>   response_time_stats?: {
>     timestamp?: string | null,
>     p50?: number | null | null,
>     p95?: number | null | null,
>     p99?: number | null | null
>   }[] | null,
>   inference_volume_by_status?: {
>     timestamp?: string | null,
>     status_2xx?: number | null,
>     status_4xx?: number | null,
>     status_5xx?: number | null
>   }[] | null,
>   gpu_memory_usage_bytes?: Record<string, {
>     value?: number | null,
>     timestamp?: string | null
>   }[]> | null,
>   gpu_utilization?: Record<string, {
>     value?: number | null,
>     timestamp?: string | null
>   }[]> | null,
>   cpu_usage?: {
>     value?: number | null,
>     timestamp?: string | null
>   }[] | null,
>   cpu_memory_usage_bytes?: {
>     value?: number | null,
>     timestamp?: string | null
>   }[] | null,
>   ephemeral_storage?: {
>     usage_bytes?: {
>       value?: number | null,
>       timestamp?: string | null
>     }[] | null,
>     utilization?: {
>       value?: number | null,
>       timestamp?: string | null
>     }[] | null
>   } | null,
>   per_node_metrics?: {
>     node_id?: string | null,
>     gpu_memory_usage_bytes?: Record<string, {
>       value?: number | null,
>       timestamp?: string | null
>     }[]> | null,
>     gpu_utilization?: Record<string, {
>       value?: number | null,
>       timestamp?: string | null
>     }[]> | null,
>     cpu_usage?: {
>       value?: number | null,
>       timestamp?: string | null
>     }[] | null,
>     cpu_memory_usage_bytes?: {
>       value?: number | null,
>       timestamp?: string | null
>     }[] | null,
>     ephemeral_storage?: {
>       usage_bytes?: {
>         value?: number | null,
>         timestamp?: string | null
>       }[] | null,
>       utilization?: {
>         value?: number | null,
>         timestamp?: string | null
>       }[] | null
>     } | null
>   }[] | null
> } | null
> ```

***

### deployments.list

`loops.deployments.list`

Lists Loops deployments. Lists Loops deployments. Defaults to the caller's own; pass ?scope=org to list every deployment in the caller's organization. Returns every deployment regardless of status; clients filter terminal states.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.deployments.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `scope` | `string \| null` | No | Defaults to the caller's own deployments; pass 'org' to list every deployment in the caller's organization. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deployments` | `object[] \| null` | No | Active Loops deployments. |

> [accordion] deployments full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   active_run_id?: string | null | null,
>   latest_run_id?: string | null | null,
>   base_model?: string | null,
>   base_checkpoint?: string | null | null,
>   base_url?: string | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   created_at?: string | null,
>   availability_model?: string | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   node_count?: number | null,
>   sampler?: {
>     id?: string | null,
>     session_id?: string | null,
>     base_url?: string | null,
>     base_model?: string | null,
>     created_at?: string | null,
>     model_id?: string | null | null,
>     deployment_id?: string | null | null,
>     status?: {
>       name?: string | null
>     } | null,
>     user?: {
>       email?: string | null | null
>     } | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null | null,
>     node_count?: number | null,
>     base_checkpoint?: string | null | null
>   } | null | null
> }[] | null
> ```

***

### getCapabilities

`loops.getCapabilities`

Gets Loops server capabilities. Returns the list of models supported by the Loops server, including each model's maximum context length and whether it supports vision-language inputs. Each entry carries an 'enabled' flag saying whether this workspace can run it now, and 'enablement\_details' explaining why when it cannot.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.getCapabilities({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model` | `string \| null` | No | Restrict the response to one model, identified by its HuggingFace repo id. A supported model comes back with its 'enabled' flag and, when false, its 'enablement\_details'. Without 'enabled', an empty list means Baseten does not support that model. Omit to list every supported model. |
| `use_case` | `rl \| sft` | No | What the caller intends to run. Reinforcement learning runs a trainer and a sampler; supervised fine-tuning runs a trainer alone. A model can therefore be enabled for one and not the other, and the same model can support a longer sequence length for SFT than for RL. |
| `max_seq_len` | `number \| null` | No | The sequence length the caller intends to train at — the same value they would pass as 'max\_seq\_len' when creating the run. Models that cannot serve it are reported as not enabled rather than returned with a ceiling the caller cannot use. Omit for the model's highest enabled sequence length. |
| `enabled` | `boolean \| null` | No | Pass true to list only the models this workspace can run now, or false for only the ones it cannot. Omit to list both. With 'model', an empty list can also mean the model is supported but filtered out. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `supported_models` | `object[] \| null` | No | Models Baseten supports for this use case, each carrying an 'enabled' flag saying whether this workspace can run it now, and 'enablement\_details' when it cannot. Models this workspace can run come first, then the rest, each group sorted by name. |

> [accordion] supported\_models full type
>
> ```ts theme={null}
> {
>   model_name?: string | null,
>   max_seq_len?: number | null,
>   max_enabled_seq_len?: number | null,
>   max_context_length?: number | null,
>   supports_vision_language?: boolean | null,
>   enabled?: boolean | null,
>   serverless?: boolean | null,
>   serverless_pricing?: {
>     cost_per_million_uncached_prefill_tokens?: number | string | null | null,
>     cost_per_million_cached_prefill_tokens?: number | string | null | null,
>     cost_per_million_sample_tokens?: number | string | null | null,
>     cost_per_million_train_tokens?: number | string | null | null
>   } | null | null,
>   enablement_details?: {
>     reason?: string | null,
>     reason_detail?: string | null,
>     remediation?: string | null
>   } | null | null
> }[] | null
> ```

***

### runs.create

`loops.runs.create`

Creates a Loops run. Creates a Loops run with an associated sampler in the given session.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.loops.runs.create({ session_id: 'example', base_model: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `session_id` | `string` | Yes | ID of the Loops session this run belongs to. |
| `base_model` | `string` | Yes | Base model ID (e.g. 'Qwen/Qwen3-8B'). |
| `name` | `string \| null` | No | Optional display name for the run. Defaults to the base model name when omitted. |
| `max_seq_len` | `number \| null` | No | Maximum prompt length (in tokens) the run must handle. Set this to the longest training example you plan to send. Defaults to the maximum supported by the model configuration. |
| `lora_rank` | `number` | No | LoRA rank. |
| `seed` | `number \| null` | No | Random seed for reproducibility. |
| `scale_down_delay_seconds` | `number` | No | Seconds of inactivity before the run scales to zero. Must be between 1 and 3600 (1 hour). Defaults to 900 (15 minutes). |
| `availability_model` | `standard \| spot` | No | Capacity a training job or Loops trainer runs on. |
| `replicas` | `number` | No | Number of data-parallel trainer replicas. Each replica is one full copy of the model's preset node group, so the trainer deployment runs (preset node\_count \* replicas) nodes (e.g. replicas=4 on a 4-node preset → 16 nodes, 4 DP workers). Must be a positive integer. Defaults to 1. |
| `path` | `string \| null` | No | Optional bt:// URI of an existing checkpoint to load weights from on startup. Form: bt://loops:\<run\_id>/weights/\<checkpoint\_name>. |
| `reuse_from_run_id` | `string \| null` | No | Optional ID of a prior Loops run whose trainer and/or sampler should be reused for this run instead of provisioning fresh. The prior run must use the same base model and belong to the same team. |
| `reuse_from_session_id` | `string \| null` | No | Optional ID of a prior Loops session whose trainer and/or sampler should be reused for this run. Deprecated in favor of reuse\_from\_run\_id. |
| `base_checkpoint` | `string \| null` | No | Optional checkpoint to start training from instead of the base model's weights: a Hugging Face repo (hf://\<org>/\<repo>\[@\<revision>]), an object store path (s3://, gs\://, r2://, cw://, or azure://), or a full Baseten Training checkpoint in the run's team (bt://\<project>@\<job\_id>/\<checkpoint>, with the checkpoint named). It must be a complete, merged checkpoint in safetensors format with the same architecture as base\_model, which still selects the hardware and training configuration. It must include tokenizer files: the run's sampler loads the tokenizer and chat template from the checkpoint. A Hugging Face revision is pinned to a commit when the run is created, and its files are checked then. Any other source is read again by each sampler and resumed run, so do not change it while the run is in use. Checkpoints from a run on a source outside Hugging Face cannot be deployed yet. Cannot be combined with path, reuse\_from\_run\_id, or reuse\_from\_session\_id. |
| `base_checkpoint_auth` | `object \| null` | No | Optional credentials that read base\_checkpoint. Only CUSTOM\_SECRET is supported: set auth\_secret\_name to the team secret that holds a Hugging Face token for a Hugging Face repo, or the credentials for an object store. A Baseten Training checkpoint takes no auth. The run, its samplers, resumed runs, and checkpoint deployments all use this secret. When omitted, a Hugging Face repo is read with the team secret hf\_access\_token if it exists. Requires base\_checkpoint. |
| `sampler_num_replicas` | `number \| null` | No | Number of replicas the run's sampler runs, applied as both its minimum and maximum. Must be at least 1. If omitted, a new sampler uses the platform defaults and a sampler reused from an earlier run keeps its settings. A run that already has a sampler keeps it unchanged. When the run ends, its sampler is scaled down. |

> [accordion] base\_checkpoint\_auth full type
>
> ```ts theme={null}
> {
>   auth_method: CUSTOM_SECRET | AWS_OIDC | GCP_OIDC | HUGGING_FACE_OIDC | AWS_ASSUME_ROLE,
>   auth_secret_name?: string | null,
>   aws_oidc_role_arn?: string | null,
>   aws_oidc_region?: string | null,
>   gcp_oidc_service_account?: string | null,
>   gcp_oidc_workload_id_provider?: string | null,
>   aws_assume_role_arn?: string | null,
>   aws_assume_role_region?: string | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `run` | `object \| null` | No | — |

> [accordion] run full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   session_id?: string | null,
>   deployment_id?: string | null | null,
>   name?: string | null,
>   base_model?: string | null,
>   lora_config_version?: string | null | null,
>   base_checkpoint?: string | null | null,
>   base_url?: string | null,
>   created_at?: string | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   sampler?: {
>     id?: string | null,
>     session_id?: string | null,
>     base_url?: string | null,
>     base_model?: string | null,
>     created_at?: string | null,
>     model_id?: string | null | null,
>     deployment_id?: string | null | null,
>     status?: {
>       name?: string | null
>     } | null,
>     user?: {
>       email?: string | null | null
>     } | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null | null,
>     node_count?: number | null,
>     base_checkpoint?: string | null | null
>   } | null | null
> } | null
> ```

***

### runs.deactivate

`loops.runs.deactivate`

Deactivates a Loops run. Shuts down a Loops run by ID, tearing down both the run and its paired sampler. Succeeds if the run is already inactive. Saved checkpoints remain accessible.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.loops.runs.deactivate({ run_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `run_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The deactivated Loops run ID. |
| `base_model` | `string \| null` | No | The base model whose Loops run was deactivated. |
| `user` | `object \| null` | No | A user. |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   email?: string | null | null
> } | null
> ```

***

### runs.delete

`loops.runs.delete`

Deletes a Loops run. Deletes a Loops run by ID, deactivating it first if it is active, and deletes its checkpoints. Checkpoints still in use, such as deployed ones, are kept and listed in the response; they stay usable until that use stops. Deletion is permanent, and storage for some checkpoints is reclaimed later. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.loops.runs.delete({ run_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `run_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The deleted Loops run ID. |
| `kept_checkpoints` | `object[] \| null` | No | The run's checkpoints that were not deleted because something still uses them, such as a deployment. They stay usable until that stops. |

> [accordion] kept\_checkpoints full type
>
> ```ts theme={null}
> {
>   checkpoint_id?: string | null,
>   checkpoint_name?: string | null,
>   created_at?: string | null,
>   checkpoint_type?: string | null,
>   base_model?: string | null | null,
>   lora_adapter_config?: {
>   } | null | null,
>   size_bytes?: number | null,
>   sync_status?: string | null | null,
>   id?: string | null,
>   lora_config?: {
>     config_version?: string | null,
>     targets?: string[] | null,
>     expert_layout?: string | null | null
>   } | null | null,
>   run_id?: string | null,
>   target?: string | null,
>   expires_at?: string | null | null
> }[] | null
> ```

***

### runs.get

`loops.runs.get`

Gets a Loops run. Fetches a Loops run by ID.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.runs.get({ run_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `run_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `run` | `object \| null` | No | — |

> [accordion] run full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   session_id?: string | null,
>   deployment_id?: string | null | null,
>   name?: string | null,
>   base_model?: string | null,
>   lora_config_version?: string | null | null,
>   base_checkpoint?: string | null | null,
>   base_url?: string | null,
>   created_at?: string | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   sampler?: {
>     id?: string | null,
>     session_id?: string | null,
>     base_url?: string | null,
>     base_model?: string | null,
>     created_at?: string | null,
>     model_id?: string | null | null,
>     deployment_id?: string | null | null,
>     status?: {
>       name?: string | null
>     } | null,
>     user?: {
>       email?: string | null | null
>     } | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null | null,
>     node_count?: number | null,
>     base_checkpoint?: string | null | null
>   } | null | null
> } | null
> ```

***

### runs.list

`loops.runs.list`

Lists Loops runs. Lists Loops runs visible to the requesting user, optionally filtered by run id, base model, and/or session. Defaults to the caller's own runs; pass ?scope=org to list every run in the caller's organization.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.runs.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `run_id` | `string \| null` | No | Filter by run ID. |
| `base_model` | `string \| null` | No | Filter runs by base model name. |
| `session_id` | `string \| null` | No | Filter runs by the session that created them. An unknown or inaccessible session returns an empty list. |
| `scope` | `string \| null` | No | Defaults to the caller's own runs; pass 'org' to list every run in the caller's organization. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `runs` | `object[] \| null` | No | List of runs. |

> [accordion] runs full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   session_id?: string | null,
>   deployment_id?: string | null | null,
>   name?: string | null,
>   base_model?: string | null,
>   lora_config_version?: string | null | null,
>   base_checkpoint?: string | null | null,
>   base_url?: string | null,
>   created_at?: string | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   sampler?: {
>     id?: string | null,
>     session_id?: string | null,
>     base_url?: string | null,
>     base_model?: string | null,
>     created_at?: string | null,
>     model_id?: string | null | null,
>     deployment_id?: string | null | null,
>     status?: {
>       name?: string | null
>     } | null,
>     user?: {
>       email?: string | null | null
>     } | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null | null,
>     node_count?: number | null,
>     base_checkpoint?: string | null | null
>   } | null | null
> }[] | null
> ```

***

### samplers.create

`loops.samplers.create`

Creates a Loops sampler. Creates a standalone Loops sampler not linked to a run.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.loops.samplers.create({ session_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `availability_model` | `standard \| spot \| null` | No | Capacity the sampler runs on. 'spot' allows preemption when its GPUs are reclaimed. Defaults to 'standard' for standalone samplers. Paired samplers inherit their run's availability model; an explicit value must match it. |
| `session_id` | `string` | Yes | ID of the Loops session this sampler belongs to. |
| `base_model` | `string \| null` | No | Base model ID for a standalone sampler (for example, a baseline). |
| `run_id` | `string \| null` | No | ID of an existing run to attach this sampler to. When set, the sampler is paired to the run and weight-syncs from its trainer, and base\_model is inherited from the run. Omit to create a standalone sampler. |
| `max_seq_length` | `number \| null` | No | Maximum prompt length (in tokens) the sampler must handle. Set this to the longest prompt you plan to send. |
| `model_path` | `string \| null` | No | bt:// URI of an existing sampler checkpoint to serve. Form: bt://loops:\<run\_id>/sampler\_weights/\<checkpoint\_name>. |
| `reuse_from_session_id` | `string \| null` | No | Optional ID of a prior Loops session to reuse a trainer and/or sampler from. Deprecated. |
| `num_replicas` | `number \| null` | No | Number of replicas the sampler runs, applied as both its minimum and maximum. Must be at least 1. If omitted, a new sampler uses the platform defaults and a paired sampler reused from an earlier run keeps its settings. A run that already has a sampler keeps it unchanged, and when a run ends, its sampler is scaled down. |
| `scope` | `default \| serverless \| dedicated` | No | Where a Loops run's trainer or a standalone sampler runs. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sampler` | `object \| null` | No | — |

> [accordion] sampler full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   session_id?: string | null,
>   base_url?: string | null,
>   base_model?: string | null,
>   created_at?: string | null,
>   model_id?: string | null | null,
>   deployment_id?: string | null | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null | null,
>   node_count?: number | null,
>   base_checkpoint?: string | null | null
> } | null
> ```

***

### samplers.deactivate

`loops.samplers.deactivate`

Deactivates a standalone Loops sampler. Shuts down a standalone Loops sampler by ID. Succeeds if it is already inactive. A sampler paired to a run always returns 409 with the run's ID, even if it is inactive.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.loops.samplers.deactivate({ sampler_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sampler_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | The deactivated Loops sampler ID. |
| `base_model` | `string \| null` | No | The base model the deactivated sampler was serving. |
| `user` | `object \| null` | No | A user. |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   email?: string | null | null
> } | null
> ```

***

### samplers.get

`loops.samplers.get`

Gets a Loops sampler. Fetches a Loops sampler by ID.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.samplers.get({ sampler_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sampler_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sampler` | `object \| null` | No | — |

> [accordion] sampler full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   session_id?: string | null,
>   base_url?: string | null,
>   base_model?: string | null,
>   created_at?: string | null,
>   model_id?: string | null | null,
>   deployment_id?: string | null | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null | null,
>   node_count?: number | null,
>   base_checkpoint?: string | null | null
> } | null
> ```

***

### samplers.list

`loops.samplers.list`

Lists Loops samplers. Lists Loops samplers (paired and standalone), optionally filtered by session. Defaults to the caller's own; pass ?scope=org to list every sampler in the caller's organization.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.samplers.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `session_id` | `string \| null` | No | Filter samplers by the session that created them. An unknown or inaccessible session returns an empty list. |
| `scope` | `string \| null` | No | Defaults to the caller's own samplers; pass 'org' to include samplers owned by other users in the caller's organization. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `samplers` | `object[] \| null` | No | List of samplers. |

> [accordion] samplers full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   session_id?: string | null,
>   base_url?: string | null,
>   base_model?: string | null,
>   created_at?: string | null,
>   model_id?: string | null | null,
>   deployment_id?: string | null | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null | null,
>   node_count?: number | null,
>   base_checkpoint?: string | null | null
> }[] | null
> ```

***

### sessions.create

`loops.sessions.create`

Creates a Loops session. Creates a Loops session scoped to the calling org.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.loops.sessions.create({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `session` | `object \| null` | No | — |

> [accordion] session full type
>
> ```ts theme={null}
> {
>   id?: string | null
> } | null
> ```

***

### sessions.get

`loops.sessions.get`

Gets a Loops session. Fetches a Loops session by ID.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.sessions.get({ session_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `session_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `session` | `object \| null` | No | — |

> [accordion] session full type
>
> ```ts theme={null}
> {
>   id?: string | null
> } | null
> ```

***

### trainers.create

`loops.trainers.create`

Creates a Loops trainer. Creates a trainer-only Loops run in the given session, without a sampler. To sample from it, create a sampler with POST /v1/loops/samplers and pass this run's ID as run\_id to pair the two. List and read the trainer through the /v1/loops/runs endpoints.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.loops.trainers.create({ session_id: 'example', base_model: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `session_id` | `string` | Yes | ID of the Loops session this run belongs to. |
| `base_model` | `string` | Yes | Base model ID (e.g. 'Qwen/Qwen3-8B'). |
| `name` | `string \| null` | No | Optional display name for the run. Defaults to the base model name when omitted. |
| `max_seq_len` | `number \| null` | No | Maximum prompt length (in tokens) the run must handle. Set this to the longest training example you plan to send. Defaults to the maximum supported by the model configuration. |
| `lora_rank` | `number` | No | LoRA rank. |
| `seed` | `number \| null` | No | Random seed for reproducibility. |
| `scale_down_delay_seconds` | `number` | No | Seconds of inactivity before the run scales to zero. Must be between 1 and 3600 (1 hour). Defaults to 900 (15 minutes). |
| `availability_model` | `standard \| spot` | No | Capacity a training job or Loops trainer runs on. |
| `replicas` | `number` | No | Number of data-parallel trainer replicas. Each replica is one full copy of the model's preset node group, so the trainer deployment runs (preset node\_count \* replicas) nodes (e.g. replicas=4 on a 4-node preset → 16 nodes, 4 DP workers). Must be a positive integer. Defaults to 1. |
| `path` | `string \| null` | No | Optional bt:// URI of an existing checkpoint to load weights from on startup. Form: bt://loops:\<run\_id>/weights/\<checkpoint\_name>. |
| `reuse_from_run_id` | `string \| null` | No | Optional ID of a prior Loops run whose trainer and/or sampler should be reused for this run instead of provisioning fresh. The prior run must use the same base model and belong to the same team. |
| `reuse_from_session_id` | `string \| null` | No | Optional ID of a prior Loops session whose trainer and/or sampler should be reused for this run. Deprecated in favor of reuse\_from\_run\_id. |
| `base_checkpoint` | `string \| null` | No | Optional checkpoint to start training from instead of the base model's weights: a Hugging Face repo (hf://\<org>/\<repo>\[@\<revision>]), an object store path (s3://, gs\://, r2://, cw://, or azure://), or a full Baseten Training checkpoint in the run's team (bt://\<project>@\<job\_id>/\<checkpoint>, with the checkpoint named). It must be a complete, merged checkpoint in safetensors format with the same architecture as base\_model, which still selects the hardware and training configuration. It must include tokenizer files: the run's sampler loads the tokenizer and chat template from the checkpoint. A Hugging Face revision is pinned to a commit when the run is created, and its files are checked then. Any other source is read again by each sampler and resumed run, so do not change it while the run is in use. Checkpoints from a run on a source outside Hugging Face cannot be deployed yet. Cannot be combined with path, reuse\_from\_run\_id, or reuse\_from\_session\_id. |
| `base_checkpoint_auth` | `object \| null` | No | Optional credentials that read base\_checkpoint. Only CUSTOM\_SECRET is supported: set auth\_secret\_name to the team secret that holds a Hugging Face token for a Hugging Face repo, or the credentials for an object store. A Baseten Training checkpoint takes no auth. The run, its samplers, resumed runs, and checkpoint deployments all use this secret. When omitted, a Hugging Face repo is read with the team secret hf\_access\_token if it exists. Requires base\_checkpoint. |
| `scope` | `default \| serverless \| dedicated` | No | Where a Loops run's trainer or a standalone sampler runs. |

> [accordion] base\_checkpoint\_auth full type
>
> ```ts theme={null}
> {
>   auth_method: CUSTOM_SECRET | AWS_OIDC | GCP_OIDC | HUGGING_FACE_OIDC | AWS_ASSUME_ROLE,
>   auth_secret_name?: string | null,
>   aws_oidc_role_arn?: string | null,
>   aws_oidc_region?: string | null,
>   gcp_oidc_service_account?: string | null,
>   gcp_oidc_workload_id_provider?: string | null,
>   aws_assume_role_arn?: string | null,
>   aws_assume_role_region?: string | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `run` | `object \| null` | No | — |

> [accordion] run full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   session_id?: string | null,
>   deployment_id?: string | null | null,
>   name?: string | null,
>   base_model?: string | null,
>   lora_config_version?: string | null | null,
>   base_checkpoint?: string | null | null,
>   base_url?: string | null,
>   created_at?: string | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   sampler?: {
>     id?: string | null,
>     session_id?: string | null,
>     base_url?: string | null,
>     base_model?: string | null,
>     created_at?: string | null,
>     model_id?: string | null | null,
>     deployment_id?: string | null | null,
>     status?: {
>       name?: string | null
>     } | null,
>     user?: {
>       email?: string | null | null
>     } | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null | null,
>     node_count?: number | null,
>     base_checkpoint?: string | null | null
>   } | null | null
> } | null
> ```

***

### userConfig.get

`loops.userConfig.get`

Gets the caller's Loops user config. Returns the caller's Loops user config (per-user accelerator priorities). Null fields mean 'inherit the org-level allowlist'.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.loops.userConfig.get({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_config` | `object \| null` | No | The caller's Loops user-level config (accelerator priorities). |

> [accordion] user\_config full type
>
> ```ts theme={null}
> {
>   trainer_accelerator_priority?: string[] | null | null,
>   sampler_accelerator_priority?: string[] | null | null
> } | null
> ```

***

### userConfig.update

`loops.userConfig.update`

Patches the caller's Loops user config. Updates the caller's Loops user config using JSON Merge Patch (RFC 7396) semantics per field: omit a field to leave it unchanged, send null to clear (inherit the org-level allowlist), or send a list to set the allowlist. Empty lists are rejected.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.loops.userConfig.update({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trainer_accelerator_priority` | `string[] \| null` | No | Ordered list of GPU types for trainer deployments, highest priority first. Send a list to set; send null to clear (inherit org allowlist); omit to leave unchanged. Empty list is rejected. |
| `sampler_accelerator_priority` | `string[] \| null` | No | Ordered list of GPU types for sampler deployments, highest priority first. Send a list to set; send null to clear (inherit org allowlist); omit to leave unchanged. Empty list is rejected. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_config` | `object \| null` | No | The caller's Loops user-level config (accelerator priorities). |

> [accordion] user\_config full type
>
> ```ts theme={null}
> {
>   trainer_accelerator_priority?: string[] | null | null,
>   sampler_accelerator_priority?: string[] | null | null
> } | null
> ```

***

## Model Apis

### get

`modelApis.get`

Gets a Model API. Returns model metadata with added-model details for teams where you can invoke Model APIs. Legacy Default Team fields remain deprecated but unchanged. Pass team\_ids to narrow team details; unauthorized teams cause a 403.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.modelApis.get({ model_api_name: 'deepseek-ai/DeepSeek-V4.1-Flash' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_api_name` | `string` | Yes | — |
| `team_ids` | `string[]` | No | Select teams for added-model details, repeated once per team. Defaults to all teams where you can invoke Model APIs. Any unauthorized team causes a 403. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Identifier of the Model API. Stable, URL-safe slug used as the public identifier. |
| `display_name` | `string \| null` | No | Human-readable name of the Model API. |
| `description` | `string \| null` | No | Description of the Model API. |
| `model_family` | `string \| null \| null` | No | Family the underlying model belongs to. |
| `release_date` | `string \| null` | No | Date the Model API was made available. |
| `invoke_url` | `string \| null` | No | Base URL for invoking the Model API. OpenAI-shaped routes (e.g. /v1/chat/completions) live underneath this host. |
| `context_length` | `number \| null` | No | The model's context window length, in tokens. |
| `cost_per_million_input_tokens` | `number \| string \| null \| null` | No | Deprecated and will be removed in a future version. Legacy effective input-token price. Use team\_details pricing instead. Retained during migration; null when pricing is unavailable. |
| `cost_per_million_cached_input_tokens` | `number \| string \| null \| null` | No | Effective cost per million cached input tokens, in dollars. Null when pricing is unavailable or the Model API has no cached input price. |
| `cost_per_million_output_tokens` | `number \| string \| null \| null` | No | Deprecated and will be removed in a future version. Legacy effective output-token price. Use team\_details pricing instead. Retained during migration; null when pricing is unavailable. |
| `rate_limits` | `object[] \| null` | No | Deprecated and will be removed in a future version. Legacy Default Team effective limits, independent of team\_ids, or catalog defaults when not added or unauthorized. Use team\_details for team limits; this field is not the org-pool limit view. |
| `org_details` | `object \| null` | No | Deprecated and will be removed in a future version. Legacy Default Team state, independent of team\_ids. Use team\_details instead. Null when not added or unauthorized. |
| `team_details` | `object[] \| null` | No | Added Model API details for authorized teams, ordered by team ID. Empty when no team in the selected scope has added this Model API. |

> [accordion] rate\_limits full type
>
> ```ts theme={null}
> {
>   type?: string | null,
>   unit?: string | null,
>   threshold?: number | null,
>   is_pooled?: boolean | null,
>   service_tier?: string | null,
>   baseline_threshold?: number | null
> }[] | null
> ```

> [accordion] org\_details full type
>
> ```ts theme={null}
> {
>   added_at?: string | null,
>   last_used_at?: string | null | null
> } | null | null
> ```

> [accordion] team\_details full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   team_id?: string | null,
>   team_name?: string | null,
>   added_at?: string | null,
>   last_used_at?: string | null | null,
>   rate_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null,
>     is_pooled?: boolean | null,
>     service_tier?: string | null,
>     baseline_threshold?: number | null
>   }[] | null,
>   cost_per_million_input_tokens?: number | string | null | null,
>   cost_per_million_output_tokens?: number | string | null | null
> }[] | null
> ```

***

### getMetrics

`modelApis.getMetrics`

Gets the metrics for a Model API. Gets the metrics for a Model API in the given time range for the teams you can manage, with each series labeled by team\_id. Organization admins receive organization-wide metrics by default.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.modelApis.getMetrics({ model_api_name: 'deepseek-ai/DeepSeek-V4.1-Flash' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_api_name` | `string` | Yes | — |
| `mode` | `CURRENT \| SUMMARY \| SERIES` | No | How metric values are aggregated over the request. |
| `start_epoch_millis` | `number \| null` | No | Epoch millis timestamp to start fetching metrics. Defaults to one hour before the end. |
| `end_epoch_millis` | `number \| null` | No | Epoch millis timestamp to end fetching metrics. Defaults to the current time. The window between start and end must not exceed 7 days. |
| `metrics` | `string[]` | No | Names of the metrics to return; see [https://docs.baseten.co/observability/export-metrics/supported-metrics](https://docs.baseten.co/observability/export-metrics/supported-metrics) for the available names. When omitted, a default set is returned: baseten\_model\_api\_inference\_requests\_total, baseten\_model\_api\_incoming\_inference\_requests\_total, and baseten\_model\_api\_tokens\_total. Unknown names are rejected; valid names that are not enabled for your organization are omitted from the response. |
| `team_ids` | `string[]` | No | Return only metrics for these teams, repeated once per team. Defaults to all teams you can manage. Any unauthorized team causes a 403. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `start_epoch_millis` | `number \| null` | No | Start of the returned window. |
| `end_epoch_millis` | `number \| null` | No | End of the returned window. |
| `mode` | `string \| null` | No | How metric values are aggregated over the request. |
| `step_seconds` | `number \| null \| null` | No | Seconds per step; populated only in SERIES mode, null otherwise. |
| `metric_descriptors` | `object[] \| null` | No | Descriptors for each metric; position defines the values index. |
| `metric_values` | `object[] \| null` | No | Metric values per time step covering the window. In summary mode this always contains exactly one value set spanning the whole window. |

> [accordion] metric\_descriptors full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   unit_hint?: string | null,
>   kind?: string | null,
>   label_sets?: Record<string, string>[] | null
> }[] | null
> ```

> [accordion] metric\_values full type
>
> ```ts theme={null}
> {
>   start_epoch_millis?: number | null,
>   values?: (number | null)[][] | null
> }[] | null
> ```

***

### getUsage

`modelApis.getUsage`

Gets Model APIs token usage in time buckets. Returns Model APIs token usage for the teams you can manage as a series of contiguous time buckets, broken down by the dimensions you pass in group\_by.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.modelApis.getUsage({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `start_time` | `string \| null` | No | Start of the query range (ISO 8601, UTC), inclusive. Snapped down to the start of its bucket. Required on the first page, and ignored when you pass a cursor. |
| `end_time` | `string \| null` | No | End of the query range (ISO 8601, UTC), exclusive. Defaults to the current time. |
| `bucket_width` | `1m \| 1h \| 1d` | No | — |
| `group_by` | `(api_key \| user \| model \| team)[]` | No | Dimensions to break usage down by, repeated once per dimension: api\_key, user, model, or team. Defaults to model. |
| `api_keys` | `string[]` | No | Return only usage for these API key prefixes, repeated once per prefix. |
| `user_ids` | `string[]` | No | Return only usage attributed to these user IDs, repeated once per ID. |
| `models` | `string[]` | No | Return only usage for these models, repeated once per model. |
| `team_ids` | `string[]` | No | Return only usage for these teams, repeated once per team. Defaults to all teams you can manage. |
| `limit` | `number \| null` | No | Number of time buckets to return. Defaults and maximums depend on bucket\_width: 1d defaults to 7 and allows 31, 1h defaults to 24 and allows 168, 1m defaults to 60 and allows 1440. |
| `cursor` | `string \| null` | No | Opaque cursor from the pagination.cursor field of a previous response |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   start_time?: string | null,
>   end_time?: string | null,
>   results?: {
>     api_key_prefix?: string | null | null,
>     user_id?: string | null | null,
>     model?: string | null | null,
>     team_id?: string | null | null,
>     input_tokens?: number | null,
>     cached_input_tokens?: number | null,
>     uncached_input_tokens?: number | null,
>     output_tokens?: number | null,
>     request_count?: number | null
>   }[] | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### list

`modelApis.list`

Lists Model APIs. Lists model metadata with added-model details for teams where you can invoke Model APIs. Legacy Default Team fields remain deprecated but unchanged. Pass team\_ids to narrow team details; unauthorized teams cause a 403. added\_only=true returns models added by any team in scope.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.modelApis.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `team_ids` | `string[]` | No | Select teams for added-model details, filtering, and ordering, repeated once per team. Defaults to all teams where you can invoke Model APIs. Any unauthorized team causes a 403. |
| `added_only` | `boolean` | No | When true, restrict the result to Model APIs added by any team where you can invoke Model APIs. Explicit team\_ids narrow this to the selected teams. Defaults to the full visible catalog. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   display_name?: string | null,
>   description?: string | null,
>   model_family?: string | null | null,
>   release_date?: string | null,
>   invoke_url?: string | null,
>   context_length?: number | null,
>   cost_per_million_input_tokens?: number | string | null | null,
>   cost_per_million_cached_input_tokens?: number | string | null | null,
>   cost_per_million_output_tokens?: number | string | null | null,
>   rate_limits?: {
>     type?: string | null,
>     unit?: string | null,
>     threshold?: number | null,
>     is_pooled?: boolean | null,
>     service_tier?: string | null,
>     baseline_threshold?: number | null
>   }[] | null,
>   org_details?: {
>     added_at?: string | null,
>     last_used_at?: string | null | null
>   } | null | null,
>   team_details?: {
>     id?: string | null,
>     team_id?: string | null,
>     team_name?: string | null,
>     added_at?: string | null,
>     last_used_at?: string | null | null,
>     rate_limits?: {
>       type?: string | null,
>       unit?: string | null,
>       threshold?: number | null,
>       is_pooled?: boolean | null,
>       service_tier?: string | null,
>       baseline_threshold?: number | null
>     }[] | null,
>     cost_per_million_input_tokens?: number | string | null | null,
>     cost_per_million_output_tokens?: number | string | null | null
>   }[] | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

## Models

### create

`models.create`

Creates a new model from a source. Creates a new model in the caller's organization. The source field selects how the model is constructed (currently library\_listing, which forks an accessible listing from GET /v1/library\_models). The deployment isn't instantly ready; poll the GET endpoint until status is ACTIVE.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.models.create({
	source: { lab_display_name: 'example', user_defined_listing_id: 'example' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `source` | `object` | Yes | Where the new model is created from. |

> [accordion] source full type
>
> ```ts theme={null}
> {
>   kind?: library_listing,
>   lab_display_name: string,
>   user_defined_listing_id: string,
>   deployed_model_name?: string | null
> } | {
>   kind?: model_archive,
>   name: string,
>   deployment: {
>     config: {
>     },
>     raw_config?: string | null,
>     user_env?: {
>     } | null,
>     environment_name?: string | null,
>     create_environment_if_missing?: boolean,
>     region?: string | null,
>     preserve_env_instance_type?: boolean,
>     deploy_timeout_minutes?: number | null,
>     deployment_name?: string | null,
>     labels?: {
>     } | null,
>     is_development?: boolean,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null,
>       scale_down_delay?: number | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null,
>       target_in_flight_tokens?: number | null,
>       max_scale_down_rate?: number | null
>     } | null,
>     request_backpressure_settings?: {
>       policy?: QUEUE_ON_FULL | REJECT_ON_FULL | null
>     } | null,
>     autoscaling_schedule_settings?: {
>       timezone?: string | null,
>       schedules?: (
>         {
>           id?: string | null,
>           name: string,
>           enabled: boolean,
>           autoscaling_settings: {
>             min_replica: number,
>             max_replica: number,
>             autoscaling_window: number | null,
>             scale_down_delay: number | null,
>             concurrency_target: number | null,
>             target_utilization_percentage: number | null,
>             target_in_flight_tokens: number | null,
>             max_scale_down_rate: number | null
>           },
>           cadence: DAILY | HOURLY,
>           weekdays: (SUNDAY | MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY)[],
>           start_hour?: number | null,
>           start_minute: number,
>           end_hour?: number | null,
>           end_minute: number
>         } | {
>           id?: string | null,
>           name: string,
>           enabled: boolean,
>           autoscaling_settings: {
>             min_replica: number,
>             max_replica: number,
>             autoscaling_window: number | null,
>             scale_down_delay: number | null,
>             concurrency_target: number | null,
>             target_utilization_percentage: number | null,
>             target_in_flight_tokens: number | null,
>             max_scale_down_rate: number | null
>           },
>           cadence: ONE_TIME,
>           start_at: string,
>           end_at: string
>         }
>       )[],
>       delete_schedules?: string[]
>     } | null,
>     promotion_settings_override?: {
>       redeploy_on_promotion?: boolean | null,
>       rolling_deploy?: boolean | null,
>       promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>       rolling_deploy_config?: {
>         rolling_deploy_strategy?: REPLICA | null,
>         max_surge_percent?: number | null,
>         max_unavailable_percent?: number | null,
>         stabilization_time_seconds?: number | null,
>         replica_overhead_percent?: number | null
>       } | null,
>       ramp_up_while_promoting?: boolean | null,
>       ramp_up_duration_seconds?: number | null
>     } | null,
>     instance_type_id?: string | null
>   },
>   s3_key?: string | null,
>   disable_archive_download?: boolean
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `model` | `object \| null` | No | A model. |
| `deployment` | `object \| null` | No | A deployment of a model. |

> [accordion] model full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   deployments_count?: number | null,
>   production_deployment_id?: string | null | null,
>   development_deployment_id?: string | null | null,
>   instance_type_name?: string | null,
>   team_name?: string | null
> } | null
> ```

> [accordion] deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   model_id?: string | null,
>   is_production?: boolean | null,
>   is_development?: boolean | null,
>   status?: string | null,
>   active_replica_count?: number | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type_name?: string | null | null,
>   environment?: string | null | null,
>   labels?: {
>   } | null | null,
>   region?: {
>     slug?: string | null,
>     display_name?: string | null
>   } | null | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   failure_reason?: string | null | null
> } | null
> ```

***

### delete

`models.delete`

Deletes a model by ID. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.models.delete({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the model |
| `deleted` | `boolean \| null` | No | Whether the model was deleted |

***

### get

`models.get`

Gets a model by ID. (GET /v1/models/\{model\_id})

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.models.get({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the model |
| `created_at` | `string \| null` | No | Time the model was created in ISO 8601 format |
| `name` | `string \| null` | No | Name of the model |
| `deployments_count` | `number \| null` | No | Number of deployments of the model |
| `production_deployment_id` | `string \| null \| null` | No | Unique identifier of the production deployment of the model |
| `development_deployment_id` | `string \| null \| null` | No | Unique identifier of the development deployment of the model |
| `instance_type_name` | `string \| null` | No | Name of the instance type for the production deployment of the model |
| `team_name` | `string \| null` | No | Name of the team associated with the model. |

***

### getAuditLogs

`models.getAuditLogs`

Gets the audit log for a model. Returns audit-log entries for a single model, newest first. Use the filters to narrow by event type, actor, deployment, environment, source, or time window, and the cursor to page.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.models.getAuditLogs({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of entries to return per page. Defaults to 20, and must be between 1 and 200. |
| `direction` | `DESC \| ASC` | No | Sort order of returned entries, by creation time. |
| `search` | `string \| null` | No | Case-insensitive substring matched against resource names and IDs in the entry. |
| `event_type_groups` | `(DEPLOYED \| PROMOTED \| ACTIVATED_DEACTIVATED \| AUTOSCALING_SETTINGS \| REQUEST_BACKPRESSURE_SETTINGS \| INSTANCE_TYPE_CHANGED \| ENVIRONMENT_SETTINGS \| REPLICA_TERMINATED \| DELETED \| METADATA \| SECRETS \| API_KEYS \| GATEWAY \| GRID \| WEBHOOK_SIGNING_SECRETS \| USER_MANAGEMENT \| DIRECTORY_GROUP_MANAGEMENT \| SSH \| TELEMETRY_EXPORT \| WORKLOAD_IDENTITY \| ACCESS_CONTROL)[]` | No | When set, returns only entries whose event type falls in one of these groups. |
| `user_ids` | `string[]` | No | When set, returns only entries whose acting user is one of these IDs. |
| `deployment_ids` | `string[]` | No | When set, returns only entries referencing one of these model deployment IDs. |
| `chain_deployment_ids` | `string[]` | No | When set, returns only entries referencing one of these chain deployment IDs. |
| `environment_names` | `string[]` | No | When set, returns only entries for one of these environments. |
| `sources` | `(UI \| API \| MCP \| SYSTEM \| OTHER)[]` | No | When set, returns only entries issued from one of these surfaces. |
| `start_epoch_millis` | `number \| null` | No | Epoch milliseconds for the start of the window. Defaults to the beginning of the audit-log history. |
| `end_epoch_millis` | `number \| null` | No | Epoch milliseconds for the end of the window. Defaults to the current time. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created?: string | null,
>   event_type?: string | null,
>   event_data?: {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     scale_previous_to_zero?: boolean | null,
>     trusted?: boolean | null,
>     publish?: boolean | null,
>     environment_name?: string | null | null,
>     region_update?: string | null | null,
>     instance_type_id_update?: string | null | null,
>     promotion_settings_override?: {
>       redeploy_on_promotion?: boolean | null | null,
>       rolling_deploy?: boolean | null | null,
>       rolling_deploy_strategy?: string | null | null,
>       max_unavailable_percent?: number | null | null,
>       max_surge_percent?: number | null | null,
>       stabilization_time_seconds?: number | null | null,
>       replica_overhead_percent?: number | null | null,
>       promotion_cleanup_strategy?: string | null | null
>     } | null | null,
>     autoscaling_settings_update?: {
>       min_replica?: number | null | null,
>       max_replica?: number | null | null,
>       concurrency_target?: number | null | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     request_backpressure_settings_update?: {
>       policy?: string | null | null
>     } | null | null,
>     autoscaling_schedule_settings_update?: {
>       timezone?: string | null | null,
>       schedules?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null,
>         schedule_id?: string | null | null
>       }[] | null,
>       delete_schedule_ids?: string[] | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     retried?: boolean | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     environment_name?: string | null | null,
>     environment_id?: string | null | null,
>     region_update?: string | null | null,
>     instance_type_id_update?: string | null | null,
>     promotion_settings_override?: {
>       redeploy_on_promotion?: boolean | null | null,
>       rolling_deploy?: boolean | null | null,
>       rolling_deploy_strategy?: string | null | null,
>       max_unavailable_percent?: number | null | null,
>       max_surge_percent?: number | null | null,
>       stabilization_time_seconds?: number | null | null,
>       replica_overhead_percent?: number | null | null,
>       promotion_cleanup_strategy?: string | null | null
>     } | null | null,
>     autoscaling_settings_update?: {
>       min_replica?: number | null | null,
>       max_replica?: number | null | null,
>       concurrency_target?: number | null | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null,
>     request_backpressure_settings_update?: {
>       policy?: string | null | null
>     } | null | null,
>     autoscaling_schedule_settings_update?: {
>       timezone?: string | null | null,
>       schedules?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null,
>         schedule_id?: string | null | null
>       }[] | null,
>       delete_schedule_ids?: string[] | null
>     } | null | null
>   } | {
>     schedules?: {
>       action?: string | null,
>       schedule_id?: string | null,
>       previous?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null
>       } | null | null,
>       current?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null
>       } | null | null
>     }[] | null | null,
>     min_replica?: number | null,
>     max_replica?: number | null,
>     concurrency_target?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null,
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     deployment_type?: string | null | null,
>     previous_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       concurrency_target?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     policy?: string | null | null,
>     previous_policy?: string | null | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     instance_type_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     previous_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null,
>     is_primary?: boolean | null,
>     publish?: boolean | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null,
>     environment_name?: string | null | null,
>     environment_id?: string | null | null
>   } | {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     concurrency_target?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null,
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null,
>     chainlet_name?: string | null,
>     chainlet_id?: string | null,
>     previous_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       concurrency_target?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     chain_deployment_name?: string | null | null,
>     chainlet_name?: string | null,
>     chainlet_id?: string | null,
>     instance_type_name?: string | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_id?: string | null,
>     deployment_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     chain_deployment_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     environment_name?: string | null,
>     redeploy_on_promotion?: boolean | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null
>   } | {
>     event_type?: string | null,
>     chain_id?: string | null,
>     chain_name?: string | null,
>     environment_name?: string | null,
>     redeploy_on_promotion?: boolean | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null
>   } | {
>     event_type?: string | null,
>     secret_id?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     secret_id?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     api_key_id?: string | null,
>     api_key_type?: string | null,
>     prefix?: string | null
>   } | {
>     event_type?: string | null,
>     api_key_id?: string | null,
>     api_key_type?: string | null,
>     prefix?: string | null,
>     revocation_reason?: string | null | null
>   } | {
>     event_type?: string | null,
>     organization_id?: string | null,
>     previous_personal_limit_days?: number | null | null,
>     new_personal_limit_days?: number | null | null,
>     previous_team_limit_days?: number | null | null,
>     new_team_limit_days?: number | null | null
>   } | {
>     event_type?: string | null,
>     organization_id?: string | null,
>     previous_allow_personal_api_keys?: boolean | null,
>     new_allow_personal_api_keys?: boolean | null,
>     previous_allow_service_account_api_keys?: boolean | null,
>     new_allow_service_account_api_keys?: boolean | null
>   } | {
>     event_type?: string | null,
>     gateway_endpoint_id?: string | null,
>     slug?: string | null
>   } | {
>     event_type?: string | null,
>     gateway_endpoint_id?: string | null,
>     slug?: string | null,
>     previous_slug?: string | null | null
>   } | {
>     event_type?: string | null,
>     gateway_endpoint_id?: string | null,
>     slug?: string | null
>   } | {
>     event_type?: string | null,
>     provider_connection_id?: string | null,
>     provider?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     provider_connection_id?: string | null,
>     provider?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     provider_connection_id?: string | null,
>     provider?: string | null,
>     secret_name?: string | null
>   } | {
>     event_type?: string | null,
>     machine_user_id?: string | null,
>     machine_user_name?: string | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     machine_user_id?: string | null,
>     machine_user_name?: string | null,
>     previous_machine_user_name?: string | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     machine_user_id?: string | null,
>     machine_user_name?: string | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     grid_guardrail_id?: string | null,
>     guardrail_name?: string | null,
>     provider?: string | null,
>     provider_guardrail_id?: string | null | null,
>     provider_guardrail_version?: string | null | null,
>     enabled?: boolean | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     grid_guardrail_id?: string | null,
>     guardrail_name?: string | null,
>     provider?: string | null,
>     provider_guardrail_id?: string | null | null,
>     provider_guardrail_version?: string | null | null,
>     enabled?: boolean | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     grid_guardrail_id?: string | null,
>     guardrail_name?: string | null,
>     provider?: string | null,
>     provider_guardrail_id?: string | null | null,
>     provider_guardrail_version?: string | null | null,
>     enabled?: boolean | null,
>     team_id?: string | null,
>     team_name?: string | null
>   } | {
>     event_type?: string | null,
>     invited_user_email?: string | null,
>     role_name?: string | null
>   } | {
>     event_type?: string | null,
>     new_user_email?: string | null,
>     user_id?: string | null
>   } | {
>     event_type?: string | null,
>     webhook_signing_secret_id?: string | null
>   } | {
>     event_type?: string | null,
>     webhook_signing_secret_id?: string | null
>   } | {
>     event_type?: string | null,
>     webhook_signing_secret_id?: string | null
>   } | {
>     event_type?: string | null,
>     user_id?: string | null,
>     user_email?: string | null,
>     new_role_name?: string | null
>   } | {
>     event_type?: string | null,
>     user_id?: string | null,
>     user_email?: string | null,
>     team_id?: string | null,
>     team_name?: string | null,
>     new_role_name?: string | null
>   } | {
>     event_type?: string | null,
>     removed_user_email?: string | null
>   } | {
>     event_type?: string | null,
>     directory_group_id?: string | null,
>     directory_group_name?: string | null,
>     new_role_name?: string | null,
>     team_id?: string | null | null,
>     team_name?: string | null | null
>   } | {
>     event_type?: string | null,
>     organization_id?: string | null
>   } | {
>     redeploy_on_promotion?: boolean | null | null,
>     rolling_deploy?: boolean | null | null,
>     rolling_deploy_strategy?: string | null | null,
>     max_unavailable_percent?: number | null | null,
>     max_surge_percent?: number | null | null,
>     stabilization_time_seconds?: number | null | null,
>     replica_overhead_percent?: number | null | null,
>     promotion_cleanup_strategy?: string | null | null,
>     min_replica?: number | null,
>     max_replica?: number | null,
>     concurrency_target?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null,
>     ramp_up_step_size?: number | null | null,
>     request_backpressure_policy?: string | null | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     environment_name?: string | null,
>     deployment_type?: string | null | null,
>     event_type?: string | null
>   } | {
>     schedules?: {
>       action?: string | null,
>       schedule_id?: string | null,
>       previous?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null
>       } | null | null,
>       current?: {
>         min_replica?: number | null,
>         max_replica?: number | null,
>         concurrency_target?: number | null | null,
>         autoscaling_window?: number | null | null,
>         scale_down_delay?: number | null | null,
>         target_utilization_percentage?: number | null | null,
>         target_in_flight_tokens?: number | null | null,
>         max_scale_down_rate?: number | null | null,
>         schedule_name?: string | null,
>         enabled?: boolean | null,
>         cadence?: string | null,
>         timezone?: string | null,
>         weekdays?: string[] | null | null,
>         start_hour?: number | null | null,
>         start_minute?: number | null | null,
>         end_hour?: number | null | null,
>         end_minute?: number | null | null,
>         start_at?: string | null | null,
>         end_at?: string | null | null
>       } | null | null
>     }[] | null | null,
>     redeploy_on_promotion?: boolean | null | null,
>     rolling_deploy?: boolean | null | null,
>     rolling_deploy_strategy?: string | null | null,
>     max_unavailable_percent?: number | null | null,
>     max_surge_percent?: number | null | null,
>     stabilization_time_seconds?: number | null | null,
>     replica_overhead_percent?: number | null | null,
>     promotion_cleanup_strategy?: string | null | null,
>     min_replica?: number | null,
>     max_replica?: number | null,
>     concurrency_target?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null,
>     ramp_up_while_promoting?: boolean | null | null,
>     ramp_up_duration_seconds?: number | null | null,
>     ramp_up_step_size?: number | null | null,
>     request_backpressure_policy?: string | null | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     environment_name?: string | null,
>     deployment_type?: string | null | null,
>     event_type?: string | null,
>     previous_settings?: {
>       redeploy_on_promotion?: boolean | null | null,
>       rolling_deploy?: boolean | null | null,
>       rolling_deploy_strategy?: string | null | null,
>       max_unavailable_percent?: number | null | null,
>       max_surge_percent?: number | null | null,
>       stabilization_time_seconds?: number | null | null,
>       replica_overhead_percent?: number | null | null,
>       promotion_cleanup_strategy?: string | null | null,
>       min_replica?: number | null,
>       max_replica?: number | null,
>       concurrency_target?: number | null,
>       autoscaling_window?: number | null | null,
>       scale_down_delay?: number | null | null,
>       target_utilization_percentage?: number | null | null,
>       target_in_flight_tokens?: number | null | null,
>       max_scale_down_rate?: number | null | null,
>       ramp_up_while_promoting?: boolean | null | null,
>       ramp_up_duration_seconds?: number | null | null,
>       ramp_up_step_size?: number | null | null,
>       request_backpressure_policy?: string | null | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     environment_name?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     replica_id?: string | null
>   } | {
>     event_type?: string | null,
>     model_id?: string | null,
>     model_name?: string | null,
>     deployment_id?: string | null,
>     deployment_name?: string | null,
>     environment_name?: string | null,
>     environment_id?: string | null | null,
>     action?: string | null
>   } | {
>     event_type?: string | null,
>     workload_type?: string | null,
>     workload_id?: string | null,
>     project_id?: string | null,
>     replica_id?: string | null,
>     proxy_address?: string | null,
>     expires_at?: string | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     namespace?: string | null,
>     volume_name?: string | null,
>     versions_deleted?: number | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     namespace?: string | null,
>     volume_name?: string | null,
>     version?: string | null,
>     digest?: string | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     namespace?: string | null,
>     volume_name?: string | null,
>     version?: string | null,
>     digest?: string | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     tag?: string | null,
>     digest?: string | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     tag?: string | null,
>     deleted?: boolean | null
>   } | {
>     volume_ref?: string | null,
>     hosting?: string | null,
>     event_type?: string | null,
>     expires_at?: string | null | null,
>     previous_expires_at?: string | null | null
>   } | {
>     telemetry_export_configuration_id?: string | null,
>     event_type?: string | null
>   } | {
>     telemetry_export_configuration_id?: string | null,
>     event_type?: string | null,
>     credential_rotated?: boolean | null,
>     enabled?: boolean | null | null
>   } | {
>     telemetry_export_configuration_id?: string | null,
>     event_type?: string | null
>   } | {
>     event_type?: string | null,
>     service_account_id?: string | null,
>     name?: string | null,
>     description?: string | null | null,
>     owner_team_id?: string | null | null,
>     preset_permissions?: {
>       api_key_type?: string | null,
>       model_ids?: string[] | null,
>       environment_names?: string[] | null,
>       model_api_slugs?: string[] | null
>     } | null
>   } | {
>     event_type?: string | null,
>     service_account_id?: string | null,
>     name?: string | null,
>     changes?: Record<string, {
>       old?: any | null,
>       new?: any | null
>     }> | null
>   } | {
>     event_type?: string | null,
>     service_account_id?: string | null,
>     name?: string | null
>   } | {
>     event_type?: string | null,
>     identity_provider_id?: string | null,
>     name?: string | null,
>     description?: string | null | null,
>     predefined?: {
>       kind?: string | null,
>       issuer_url?: string | null
>     } | null | null,
>     custom?: {
>       issuer_url?: string | null,
>       jwks?: {
>       } | null
>     } | null | null
>   } | {
>     event_type?: string | null,
>     identity_provider_id?: string | null,
>     name?: string | null,
>     changes?: Record<string, {
>       old?: any | null,
>       new?: any | null
>     }> | null
>   } | {
>     event_type?: string | null,
>     identity_provider_id?: string | null,
>     name?: string | null
>   } | {
>     event_type?: string | null,
>     trust_rule_id?: string | null,
>     name?: string | null,
>     description?: string | null | null,
>     identity_provider_id?: string | null,
>     service_account_id?: string | null,
>     condition?: string | null,
>     audience?: string | null,
>     max_access_token_lifetime_seconds?: number | null
>   } | {
>     event_type?: string | null,
>     trust_rule_id?: string | null,
>     name?: string | null,
>     changes?: Record<string, {
>       old?: any | null,
>       new?: any | null
>     }> | null
>   } | {
>     event_type?: string | null,
>     trust_rule_id?: string | null,
>     name?: string | null
>   } | {
>     event_type?: string | null,
>     role_id?: string | null,
>     name?: string | null,
>     kind?: string | null,
>     team_id?: string | null | null,
>     description?: string | null | null,
>     permissions?: string[] | null,
>     includes?: string[] | null
>   } | {
>     event_type?: string | null,
>     role_id?: string | null,
>     name?: string | null,
>     changes?: Record<string, {
>       old?: any | null,
>       new?: any | null
>     }> | null
>   } | {
>     event_type?: string | null,
>     role_id?: string | null,
>     name?: string | null
>   } | {
>     event_type?: string | null,
>     role_assignment_id?: string | null,
>     role_id?: string | null,
>     role_name?: string | null,
>     subject_type?: string | null,
>     subject_id?: string | null,
>     team_id?: string | null | null,
>     resource_sets?: {
>       all_of?: {
>         resource_type?: string | null,
>         resource_id?: string | null
>       }[] | null
>     }[] | null
>   } | {
>     event_type?: string | null,
>     role_assignment_id?: string | null,
>     role_id?: string | null,
>     subject_type?: string | null,
>     subject_id?: string | null,
>     team_id?: string | null | null
>   } | {
>     event_type?: string | null,
>     organization_id?: string | null,
>     previous_allow_team_admins_to_manage_roles?: boolean | null,
>     new_allow_team_admins_to_manage_roles?: boolean | null
>   } | null,
>   source?: string | null | null,
>   actor?: {
>     type?: string | null,
>     email?: string | null | null,
>     api_key_prefix?: string | null | null,
>     api_key_name?: string | null | null,
>     service_account_id?: string | null | null,
>     service_account_name?: string | null | null,
>     trust_rule_id?: string | null | null
>   } | null,
>   client_name?: string | null | null,
>   client_version?: string | null | null,
>   client_session_id?: string | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### list

`models.list`

Gets all models. (GET /v1/models)

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.models.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | When set, returns only models with this exact name, if any. On a team-scoped route this matches at most one model; on the org-wide route it may match models in multiple teams, since names are unique only within a team. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `models` | `object[] \| null` | No | — |

> [accordion] models full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   deployments_count?: number | null,
>   production_deployment_id?: string | null | null,
>   development_deployment_id?: string | null | null,
>   instance_type_name?: string | null,
>   team_name?: string | null
> }[] | null
> ```

***

### prepareUpload

`models.prepareUpload`

Validates a model push payload and issues upload credentials.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.models.prepareUpload({
	deployment: {
		config: {},
	},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `deployment` | `object` | Yes | Deployment-level fields for a model-archive push. Shared by every endpoint that creates a deployment from an uploaded archive: `POST /v1/prepare_model_upload`, the `model_archive` source on `POST /v1/models`, and `POST /v1/models/{model_id}/deployments`. |
| `name` | `string \| null` | No | Set to validate a new-model push. Exactly one of `name` or `model_id` is required. |
| `team_id` | `string \| null` | No | Team the new model will belong to. Only valid when `name` is set; defaults to the organization's default team when omitted. Must not be set when `model_id` is set (the existing model already has a team). |
| `model_id` | `string \| null` | No | Set to validate an add-deployment push to an existing model. Exactly one of `name` or `model_id` is required. |
| `dry_run` | `boolean` | No | If true, validate the payload only and do not issue upload credentials. The response sets `creds`, `s3_bucket`, and `s3_key` to `null`. |

> [accordion] deployment full type
>
> ```ts theme={null}
> {
>   config: {
>   },
>   raw_config?: string | null,
>   user_env?: {
>   } | null,
>   environment_name?: string | null,
>   create_environment_if_missing?: boolean,
>   region?: string | null,
>   preserve_env_instance_type?: boolean,
>   deploy_timeout_minutes?: number | null,
>   deployment_name?: string | null,
>   labels?: {
>   } | null,
>   is_development?: boolean,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null,
>     scale_down_delay?: number | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null,
>     target_in_flight_tokens?: number | null,
>     max_scale_down_rate?: number | null
>   } | null,
>   request_backpressure_settings?: {
>     policy?: QUEUE_ON_FULL | REJECT_ON_FULL | null
>   } | null,
>   autoscaling_schedule_settings?: {
>     timezone?: string | null,
>     schedules?: (
>       {
>         id?: string | null,
>         name: string,
>         enabled: boolean,
>         autoscaling_settings: {
>           min_replica: number,
>           max_replica: number,
>           autoscaling_window: number | null,
>           scale_down_delay: number | null,
>           concurrency_target: number | null,
>           target_utilization_percentage: number | null,
>           target_in_flight_tokens: number | null,
>           max_scale_down_rate: number | null
>         },
>         cadence: DAILY | HOURLY,
>         weekdays: (SUNDAY | MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY)[],
>         start_hour?: number | null,
>         start_minute: number,
>         end_hour?: number | null,
>         end_minute: number
>       } | {
>         id?: string | null,
>         name: string,
>         enabled: boolean,
>         autoscaling_settings: {
>           min_replica: number,
>           max_replica: number,
>           autoscaling_window: number | null,
>           scale_down_delay: number | null,
>           concurrency_target: number | null,
>           target_utilization_percentage: number | null,
>           target_in_flight_tokens: number | null,
>           max_scale_down_rate: number | null
>         },
>         cadence: ONE_TIME,
>         start_at: string,
>         end_at: string
>       }
>     )[],
>     delete_schedules?: string[]
>   } | null,
>   promotion_settings_override?: {
>     redeploy_on_promotion?: boolean | null,
>     rolling_deploy?: boolean | null,
>     promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>     rolling_deploy_config?: {
>       rolling_deploy_strategy?: REPLICA | null,
>       max_surge_percent?: number | null,
>       max_unavailable_percent?: number | null,
>       stabilization_time_seconds?: number | null,
>       replica_overhead_percent?: number | null
>     } | null,
>     ramp_up_while_promoting?: boolean | null,
>     ramp_up_duration_seconds?: number | null
>   } | null,
>   instance_type_id?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `creds` | `object \| null` | No | STS credentials to upload the model archive. Null when no archive upload is required. |
| `s3_bucket` | `string \| null \| null` | No | S3 bucket the credentials are scoped to. Null when no archive upload is required. |
| `s3_key` | `string \| null \| null` | No | S3 key the credentials are scoped to. Pass this to `POST /v1/models` (in the `model_archive` source) once the upload completes. Null when no archive upload is required. |
| `s3_region` | `string \| null \| null` | No | AWS region the S3 bucket resides in. Null when no archive upload is required. |

> [accordion] creds full type
>
> ```ts theme={null}
> {
>   aws_access_key_id?: string | null,
>   aws_secret_access_key?: string | null,
>   aws_session_token?: string | null
> } | null | null
> ```

***

### update

`models.update`

Updates a model by ID. Updates the mutable fields of a model and returns the updated model. Renaming does not change the model ID, endpoints, or deployments. Pushes that still use the old model\_name create another model or target a model that now uses that name, so update config.yaml after renaming.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.models.update({ model_id: 'abcd1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string` | Yes | — |
| `name` | `string \| null` | No | New name for the model, unique within its team. Renaming does not change the model ID, endpoints, or deployments. Pushes that still use the old model\_name create another model or target a model that now uses that name, so update config.yaml after renaming. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the model |
| `created_at` | `string \| null` | No | Time the model was created in ISO 8601 format |
| `name` | `string \| null` | No | Name of the model |
| `deployments_count` | `number \| null` | No | Number of deployments of the model |
| `production_deployment_id` | `string \| null \| null` | No | Unique identifier of the production deployment of the model |
| `development_deployment_id` | `string \| null \| null` | No | Unique identifier of the development deployment of the model |
| `instance_type_name` | `string \| null` | No | Name of the instance type for the production deployment of the model |
| `team_name` | `string \| null` | No | Name of the team associated with the model. |

***

## Organization

### get

`organization.get`

Gets the authenticated organization. Returns info about the organization of the user making the request.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.organization.get({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `org_id` | `string \| null` | No | Unique identifier for the organization |
| `name` | `string \| null \| null` | No | Display name of the organization |
| `created_at` | `string \| null` | No | Time the organization was created in ISO 8601 format |
| `aws_assume_role` | `object \| null` | No | AWS AssumeRole trust-policy inputs; null while the method is not enabled for the organization |
| `allow_personal_api_keys` | `boolean \| null` | No | Whether members can create new personal API keys. Existing keys keep working. |
| `allow_service_account_api_keys` | `boolean \| null` | No | Whether new team and organization API keys can be created. Existing keys keep working. |
| `allow_team_admins_to_manage_roles` | `boolean \| null \| null` | No | Whether team admins create, change, and delete their team's custom roles. When false, only organization admins do, and team admins still assign roles in their team. Null when custom roles aren't available to your organization, or you can't read its roles. |

> [accordion] aws\_assume\_role full type
>
> ```ts theme={null}
> {
>   baseten_role_arn?: string | null,
>   external_id?: string | null
> } | null | null
> ```

***

### update

`organization.update`

Updates the authenticated organization. Updates settings of the organization of the user making the request. Only organization admins can call it. Omitted fields are unchanged.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.organization.update({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `allow_personal_api_keys` | `boolean \| null` | No | Whether members can create new personal API keys. Null is not accepted. |
| `allow_service_account_api_keys` | `boolean \| null` | No | Whether new team and organization API keys can be created. Null is not accepted. |
| `allow_team_admins_to_manage_roles` | `boolean \| null` | No | Whether team admins create, change, and delete their team's custom roles. Needs `access.role.write` for the organization. Null is not accepted. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `org_id` | `string \| null` | No | Unique identifier for the organization |
| `name` | `string \| null \| null` | No | Display name of the organization |
| `created_at` | `string \| null` | No | Time the organization was created in ISO 8601 format |
| `aws_assume_role` | `object \| null` | No | AWS AssumeRole trust-policy inputs; null while the method is not enabled for the organization |
| `allow_personal_api_keys` | `boolean \| null` | No | Whether members can create new personal API keys. Existing keys keep working. |
| `allow_service_account_api_keys` | `boolean \| null` | No | Whether new team and organization API keys can be created. Existing keys keep working. |
| `allow_team_admins_to_manage_roles` | `boolean \| null \| null` | No | Whether team admins create, change, and delete their team's custom roles. When false, only organization admins do, and team admins still assign roles in their team. Null when custom roles aren't available to your organization, or you can't read its roles. |

> [accordion] aws\_assume\_role full type
>
> ```ts theme={null}
> {
>   baseten_role_arn?: string | null,
>   external_id?: string | null
> } | null | null
> ```

***

## Regions

### list

`regions.list`

Lists regions available to the organization. Lists the regions available for new deployments in the caller's organization. A workspace without region access answers 403 (live 12-01).

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.regions.list({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `regions` | `object[] \| null` | No | — |

> [accordion] regions full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   display_name?: string | null
> }[] | null
> ```

***

## Sandboxes

### create

`sandboxes.create`

Create a sandbox. Create a sandbox with an optional client-provided name, generated by the server when omitted. The request waits briefly for deployment, then returns the created resource. Deployment may continue after the response; inspect status to determine readiness.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.sandboxes.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `create_if_not_exists` | `boolean` | No | When true, return the existing live sandbox with this name or recreate it if it is failed, terminated, or being deleted. The server handles concurrent creation and deletion races with a bounded wait; persistent contention returns a conflict. Requires name. Existing configuration is preserved. Defaults to false when omitted. |
| `name` | `string` | No | Optional unique sandbox name. Generated by the server when omitted; immutable after creation. |
| `lifecycle` | `object` | No | Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates |
| `region` | `string` | No | Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the default sandbox region is used. |
| `envs` | `object[]` | No | Environment variables injected into the sandbox. |
| `image` | `string` | No | Image reference including its tag. Defaults to baseten/base-image:latest, the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images. |
| `memory` | `number` | No | Memory allocation in megabytes. Must be between 1024 and 262144. Defaults to 4096, or to 8192 MB per vCPU (a 1:8 ratio) when only cpu is set, capped at the account's memory quota. When cpu is omitted, memory also determines the CPU allocation (by default 2048 MB = 1 vCPU, 4096 MB = 2, 8192 MB = 4, 16384 MB = 6, 32768 MB = 8, 65536 MB = 16, 131072 MB or more = 32). |
| `cpu` | `number` | No | Optional number of vCPUs, a whole number between 1 and 32. When omitted, the CPU allocation is derived from memory. When set, memory must be between 1024 and 8192 megabytes per vCPU (a ratio from 1:1 to 1:8), and cpu must not exceed the account's per-sandbox cpu quota. A value equal to the allocation memory alone would give is always accepted. When memory is omitted, it defaults to 8192 MB per vCPU, capped at the account's memory quota. Immutable after creation. |
| `filesystem` | `object` | No | Filesystem configuration. Set at creation only. |
| `volumes` | `object[]` | No | Volumes mounted in the sandbox. Set at creation only. |
| `ports` | `object[]` | No | Set of ports for a resource |
| `external_id` | `string` | No | Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash. |
| `labels` | `object` | No | Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy. |

> [accordion] lifecycle full type
>
> ```ts theme={null}
> {
>   expiration_policies?: (
>     {
>       action: DELETE,
>       type: TTL_IDLE,
>       value: string
>     } | {
>       action: DELETE,
>       type: TTL_MAX_AGE,
>       value: string
>     } | {
>       action: DELETE,
>       type: DATE,
>       value: string
>     }
>   )[],
>   terminated_retention?: string
> }
> ```

> [accordion] envs full type
>
> ```ts theme={null}
> {
>   name?: string,
>   secret?: boolean,
>   value?: string
> }[]
> ```

> [accordion] filesystem full type
>
> ```ts theme={null}
> {
>   max_memory_usage?: string | number
> }
> ```

> [accordion] volumes full type
>
> ```ts theme={null}
> {
>   name: string,
>   mount_path: string,
>   read_only?: boolean
> }[]
> ```

> [accordion] ports full type
>
> ```ts theme={null}
> {
>   name?: string,
>   protocol?: HTTP | TCP | UDP | TLS,
>   target: number
> }[]
> ```

> [accordion] labels full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `lifecycle` | `object \| null` | No | Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates |
| `region` | `string \| null` | No | Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the default sandbox region is used. |
| `envs` | `object[] \| null` | No | Environment variables injected into the sandbox. |
| `image` | `string \| null` | No | Image reference including its tag. Built-in image references are returned in the canonical baseten/ namespace. Use baseten/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images. |
| `memory` | `number \| null` | No | Memory allocation in megabytes. Must be between 1024 and 262144. When cpu is not set at creation, memory also determines the CPU allocation (by default 2048 MB = 1 vCPU, 4096 MB = 2, 8192 MB = 4, 16384 MB = 6, 32768 MB = 8, 65536 MB = 16, 131072 MB or more = 32). |
| `cpu` | `number \| null` | No | Number of vCPUs the sandbox runs with. Always returned, including for sandboxes created without cpu, whose CPU allocation was derived from memory. Set at creation only. |
| `filesystem` | `object \| null` | No | Filesystem configuration. Set at creation only. |
| `volumes` | `object[] \| null` | No | Volumes mounted in the sandbox. Set at creation only. |
| `ports` | `object[] \| null` | No | Set of ports for a resource |
| `external_id` | `string \| null` | No | Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash. |
| `labels` | `object \| null` | No | Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy. |
| `name` | `string \| null` | No | Immutable sandbox name, provided by the client or generated by the server, used in sandbox\_name path parameters. |
| `url` | `string \| null` | No | Base URL of this sandbox's execution API, always present on successful creation. The URL is assigned before deployment completes; inspect status for readiness. Use this exact returned URL; do not reconstruct its hostname. Authenticate requests with your authentication token using Authorization: Bearer \<token>. Do not send the Baseten API key directly. No additional routing headers are required. Fetch GET \{url}/swagger/doc.json with that header for the API reference served by this sandbox. For example, POST \{url}/process with Content-Type: application/json and \{"command":"echo hello","waitForCompletion":true} executes a command and waits for its result. Execution API fields use camelCase, independently of this API's snake\_case fields. |
| `status` | `string \| null` | No | Sandbox deployment status. |
| `created_at` | `string \| null` | No | Time the sandbox was created. |
| `updated_at` | `string \| null` | No | Time the sandbox was last updated. |
| `created_by` | `string \| null` | No | User or service account that created the sandbox. |
| `updated_by` | `string \| null` | No | User or service account that last updated the sandbox. |
| `last_used_at` | `string \| null` | No | Time the sandbox was last used. |
| `expires_in` | `number \| null` | No | Seconds remaining before automatic deletion, when expiration is configured. |

> [accordion] lifecycle full type
>
> ```ts theme={null}
> {
>   expiration_policies?: (
>     {
>       action?: string | null,
>       type?: string | null,
>       value?: string | null
>     } | {
>       action?: string | null,
>       type?: string | null,
>       value?: string | null
>     } | {
>       action?: string | null,
>       type?: string | null,
>       value?: string | null
>     }
>   )[] | null,
>   terminated_retention?: string | null
> } | null
> ```

> [accordion] envs full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   secret?: boolean | null,
>   value?: string | null
> }[] | null
> ```

> [accordion] filesystem full type
>
> ```ts theme={null}
> {
>   max_memory_usage?: string | number | null
> } | null
> ```

> [accordion] volumes full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   mount_path?: string | null,
>   read_only?: boolean | null
> }[] | null
> ```

> [accordion] ports full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   protocol?: string | null,
>   target?: number | null
> }[] | null
> ```

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null
> ```

***

### createAccessToken

`sandboxes.createAccessToken`

Creates a sandbox access token. Exchanges your Baseten credentials for a short-lived token that authenticates against the sandbox API. The token carries every team you belong to. Tokens expire after two hours, or when the workload identity access token that requested them expires, whichever is sooner.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.sandboxes.createAccessToken({
	scopes: ['sandboxes'],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `scopes` | `sandboxes[]` | Yes | What the token should grant access to. Only `sandboxes` is supported today; the token then authenticates against the sandbox API. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `token` | `string \| null` | No | Short-lived bearer token for the sandbox API. Send it as Authorization: Bearer \<token>. |
| `expires_at` | `string \| null` | No | Token expiry in ISO 8601 format. Tokens cannot be renewed; request a new one. |

***

### delete

`sandboxes.delete`

Delete a sandbox. Permanently delete the sandbox and its local data asynchronously. The returned resource has status DELETING. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.sandboxes.delete({ sandbox_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sandbox_name` | `string` | Yes | Immutable sandbox name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `lifecycle` | `object \| null` | No | Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates |
| `region` | `string \| null` | No | Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the default sandbox region is used. |
| `envs` | `object[] \| null` | No | Environment variables injected into the sandbox. |
| `image` | `string \| null` | No | Image reference including its tag. Built-in image references are returned in the canonical baseten/ namespace. Use baseten/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images. |
| `memory` | `number \| null` | No | Memory allocation in megabytes. Must be between 1024 and 262144. When cpu is not set at creation, memory also determines the CPU allocation (by default 2048 MB = 1 vCPU, 4096 MB = 2, 8192 MB = 4, 16384 MB = 6, 32768 MB = 8, 65536 MB = 16, 131072 MB or more = 32). |
| `cpu` | `number \| null` | No | Number of vCPUs the sandbox runs with. Always returned, including for sandboxes created without cpu, whose CPU allocation was derived from memory. Set at creation only. |
| `filesystem` | `object \| null` | No | Filesystem configuration. Set at creation only. |
| `volumes` | `object[] \| null` | No | Volumes mounted in the sandbox. Set at creation only. |
| `ports` | `object[] \| null` | No | Set of ports for a resource |
| `external_id` | `string \| null` | No | Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash. |
| `labels` | `object \| null` | No | Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy. |
| `name` | `string \| null` | No | Immutable sandbox name, provided by the client or generated by the server, used in sandbox\_name path parameters. |
| `url` | `string \| null` | No | Base URL of this sandbox's execution API, always present on successful creation. The URL is assigned before deployment completes; inspect status for readiness. Use this exact returned URL; do not reconstruct its hostname. Authenticate requests with your authentication token using Authorization: Bearer \<token>. Do not send the Baseten API key directly. No additional routing headers are required. Fetch GET \{url}/swagger/doc.json with that header for the API reference served by this sandbox. For example, POST \{url}/process with Content-Type: application/json and \{"command":"echo hello","waitForCompletion":true} executes a command and waits for its result. Execution API fields use camelCase, independently of this API's snake\_case fields. |
| `status` | `string \| null` | No | Sandbox deployment status. |
| `created_at` | `string \| null` | No | Time the sandbox was created. |
| `updated_at` | `string \| null` | No | Time the sandbox was last updated. |
| `created_by` | `string \| null` | No | User or service account that created the sandbox. |
| `updated_by` | `string \| null` | No | User or service account that last updated the sandbox. |
| `last_used_at` | `string \| null` | No | Time the sandbox was last used. |
| `expires_in` | `number \| null` | No | Seconds remaining before automatic deletion, when expiration is configured. |

> [accordion] lifecycle full type
>
> ```ts theme={null}
> {
>   expiration_policies?: (
>     {
>       action?: string | null,
>       type?: string | null,
>       value?: string | null
>     } | {
>       action?: string | null,
>       type?: string | null,
>       value?: string | null
>     } | {
>       action?: string | null,
>       type?: string | null,
>       value?: string | null
>     }
>   )[] | null,
>   terminated_retention?: string | null
> } | null
> ```

> [accordion] envs full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   secret?: boolean | null,
>   value?: string | null
> }[] | null
> ```

> [accordion] filesystem full type
>
> ```ts theme={null}
> {
>   max_memory_usage?: string | number | null
> } | null
> ```

> [accordion] volumes full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   mount_path?: string | null,
>   read_only?: boolean | null
> }[] | null
> ```

> [accordion] ports full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   protocol?: string | null,
>   target?: number | null
> }[] | null
> ```

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null
> ```

***

### get

`sandboxes.get`

Get a sandbox. Return the sandbox configuration and status.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.get({ sandbox_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sandbox_name` | `string` | Yes | Immutable sandbox name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `show_secrets` | `boolean` | No | Reveal environment variable values for workspace administrators. Defaults to false. Callers without the admin role receive masked values even when true. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `lifecycle` | `object \| null` | No | Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates |
| `region` | `string \| null` | No | Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the default sandbox region is used. |
| `envs` | `object[] \| null` | No | Environment variables injected into the sandbox. |
| `image` | `string \| null` | No | Image reference including its tag. Built-in image references are returned in the canonical baseten/ namespace. Use baseten/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images. |
| `memory` | `number \| null` | No | Memory allocation in megabytes. Must be between 1024 and 262144. When cpu is not set at creation, memory also determines the CPU allocation (by default 2048 MB = 1 vCPU, 4096 MB = 2, 8192 MB = 4, 16384 MB = 6, 32768 MB = 8, 65536 MB = 16, 131072 MB or more = 32). |
| `cpu` | `number \| null` | No | Number of vCPUs the sandbox runs with. Always returned, including for sandboxes created without cpu, whose CPU allocation was derived from memory. Set at creation only. |
| `filesystem` | `object \| null` | No | Filesystem configuration. Set at creation only. |
| `volumes` | `object[] \| null` | No | Volumes mounted in the sandbox. Set at creation only. |
| `ports` | `object[] \| null` | No | Set of ports for a resource |
| `external_id` | `string \| null` | No | Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash. |
| `labels` | `object \| null` | No | Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy. |
| `name` | `string \| null` | No | Immutable sandbox name, provided by the client or generated by the server, used in sandbox\_name path parameters. |
| `url` | `string \| null` | No | Base URL of this sandbox's execution API, always present on successful creation. The URL is assigned before deployment completes; inspect status for readiness. Use this exact returned URL; do not reconstruct its hostname. Authenticate requests with your authentication token using Authorization: Bearer \<token>. Do not send the Baseten API key directly. No additional routing headers are required. Fetch GET \{url}/swagger/doc.json with that header for the API reference served by this sandbox. For example, POST \{url}/process with Content-Type: application/json and \{"command":"echo hello","waitForCompletion":true} executes a command and waits for its result. Execution API fields use camelCase, independently of this API's snake\_case fields. |
| `status` | `string \| null` | No | Sandbox deployment status. |
| `created_at` | `string \| null` | No | Time the sandbox was created. |
| `updated_at` | `string \| null` | No | Time the sandbox was last updated. |
| `created_by` | `string \| null` | No | User or service account that created the sandbox. |
| `updated_by` | `string \| null` | No | User or service account that last updated the sandbox. |
| `last_used_at` | `string \| null` | No | Time the sandbox was last used. |
| `expires_in` | `number \| null` | No | Seconds remaining before automatic deletion, when expiration is configured. |

> [accordion] lifecycle full type
>
> ```ts theme={null}
> {
>   expiration_policies?: (
>     {
>       action?: string | null,
>       type?: string | null,
>       value?: string | null
>     } | {
>       action?: string | null,
>       type?: string | null,
>       value?: string | null
>     } | {
>       action?: string | null,
>       type?: string | null,
>       value?: string | null
>     }
>   )[] | null,
>   terminated_retention?: string | null
> } | null
> ```

> [accordion] envs full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   secret?: boolean | null,
>   value?: string | null
> }[] | null
> ```

> [accordion] filesystem full type
>
> ```ts theme={null}
> {
>   max_memory_usage?: string | number | null
> } | null
> ```

> [accordion] volumes full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   mount_path?: string | null,
>   read_only?: boolean | null
> }[] | null
> ```

> [accordion] ports full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   protocol?: string | null,
>   target?: number | null
> }[] | null
> ```

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null
> ```

***

### getConfiguration

`sandboxes.getConfiguration`

Get sandbox configuration. Return available Carbon-compatible sandbox regions. Configuration is the same for every team, so no team is selected. Only enabled regions supporting Carbon are returned. This describes regional capability, not the runtime selected for a particular team or sandbox.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.getConfiguration({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `regions` | `object[] \| null` | No | Available Carbon-compatible regions, sorted by name. Empty when none are available. |

> [accordion] regions full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   country?: string | null,
>   continent?: string | null,
>   location?: string | null,
>   info_generation?: string | null
> }[] | null
> ```

***

### getLogs

`sandboxes.getLogs`

Get sandbox logs. Returns sandbox runtime logs, newest first, within the half-open range \[start\_time, end\_time). Ranges are limited to 7 days. Follow next\_cursor until it is null to retrieve all pages, keeping the same range and limit. Logs before sandbox creation are excluded. Unavailable telemetry returns an error.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.getLogs({ sandbox_name: 'example', start_time: 'example', end_time: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `sandbox_name` | `string` | Yes | Immutable sandbox name returned by creation. |
| `start_time` | `string` | Yes | — |
| `end_time` | `string` | Yes | — |
| `limit` | `number` | No | — |
| `cursor` | `string` | No | Opaque next\_cursor from the previous page. Omit for the first page. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sandbox_name` | `string \| null` | No | — |
| `start_time` | `string \| null` | No | — |
| `end_time` | `string \| null` | No | — |
| `logs` | `object[] \| null` | No | — |
| `next_cursor` | `string \| null \| null` | No | Opaque cursor for the next page; null when there are no more entries. |

> [accordion] logs full type
>
> ```ts theme={null}
> {
>   timestamp?: string | null,
>   message?: string | null,
>   severity?: number | null,
>   trace_id?: string | null,
>   action?: string | null
> }[] | null
> ```

***

### getMetrics

`sandboxes.getMetrics`

Get sandbox metrics. Returns every interval with labeled request counts, CPU cores, and RSS memory bytes. CURRENT returns one snapshot at now, with request counts over the preceding minute and latest gauges. SUMMARY returns one value set over the window.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.getMetrics({ sandbox_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sandbox_name` | `string` | Yes | Immutable sandbox name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `mode` | `CURRENT \| SUMMARY \| SERIES` | No | — |
| `start_epoch_millis` | `number` | No | Unix milliseconds. Defaults to one hour before end; SERIES snaps outward. |
| `end_epoch_millis` | `number` | No | Exclusive end in Unix milliseconds, default now. Maximum aligned window is 7 days. |
| `metrics` | `(baseten_sandbox_requests_total \| baseten_sandbox_cpu_usage_cores \| baseten_sandbox_memory_bytes)[]` | No | Metric names in response order. Omit to request all three signals. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `start_epoch_millis` | `number \| null` | No | Returned window start, snapped outward in SERIES. Equal to end for CURRENT. |
| `end_epoch_millis` | `number \| null` | No | Returned exclusive window end, snapped outward in SERIES. Snapshot timestamp for CURRENT. |
| `mode` | `string \| null` | No | — |
| `step_seconds` | `number \| null \| null` | No | Seconds per SERIES interval; null in CURRENT and SUMMARY. |
| `metric_descriptors` | `object[] \| null` | No | — |
| `metric_values` | `object[] \| null` | No | — |

> [accordion] metric\_descriptors full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   unit_hint?: string | null,
>   kind?: string | null,
>   label_sets?: Record<string, string>[] | null
> }[] | null
> ```

> [accordion] metric\_values full type
>
> ```ts theme={null}
> {
>   start_epoch_millis?: number | null,
>   values?: (number | null)[][] | null
> }[] | null
> ```

***

### images.cleanup

`sandboxes.images.cleanup`

Clean up unused images. Remove unused sandbox image versions. Versions referenced by active deployments are preserved. One call runs for a limited time; when has\_more is true, only part of the unused versions were removed and the call should be repeated.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.sandboxes.images.cleanup({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deleted` | `number \| null` | No | Number of image versions removed. |
| `message` | `string \| null` | No | Human-readable cleanup result. |
| `remaining` | `number \| null` | No | Number of unused image versions left for a next call. |
| `has_more` | `boolean \| null` | No | True when the cleanup stopped on its time limit before every unused version was removed. Call it again to continue. |

***

### images.delete

`sandboxes.images.delete`

Delete a sandbox image. Delete the image repository and all its tags. Reject deletion if any version is referenced by an active deployment. Return the deleted image. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.sandboxes.images.delete({ image_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `image_name` | `string` | Yes | Image repository name. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Stable repository name supplied when pushing the image. |
| `status` | `string \| null` | No | Image processing status. Only BUILT images are ready to use. |
| `created_at` | `string \| null` | No | Time the image was created. |
| `updated_at` | `string \| null` | No | Time the image was last updated. |
| `last_deployed_at` | `string \| null` | No | Most recent deployment time across all tags, if deployed. |
| `size` | `number \| null` | No | Total repository size in bytes. |
| `tag_count` | `number \| null` | No | Number of image versions in the repository. |

***

### images.get

`sandboxes.images.get`

Get a sandbox image. Return the repository summary and processing status. Use the tag listing endpoint for image versions.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.images.get({ image_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `image_name` | `string` | Yes | Image repository name. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Stable repository name supplied when pushing the image. |
| `status` | `string \| null` | No | Image processing status. Only BUILT images are ready to use. |
| `created_at` | `string \| null` | No | Time the image was created. |
| `updated_at` | `string \| null` | No | Time the image was last updated. |
| `last_deployed_at` | `string \| null` | No | Most recent deployment time across all tags, if deployed. |
| `size` | `number \| null` | No | Total repository size in bytes. |
| `tag_count` | `number \| null` | No | Number of image versions in the repository. |

***

### images.getBuildLogs

`sandboxes.images.getBuildLogs`

Get image build logs. Return one page of logs from the latest recorded build of this image, including failed builds, newest first. Logs may take a short time to appear. Defaults to the last 24 hours; the requested time range must not exceed 7 days. Keep start\_time and end\_time fixed when paging with offset.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.images.getBuildLogs({ image_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `image_name` | `string` | Yes | Image repository name. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `start_time` | `string` | No | Inclusive RFC 3339 start time. Defaults to 24 hours before end\_time. |
| `end_time` | `string` | No | RFC 3339 end time. Defaults to the current time. |
| `limit` | `number` | No | Maximum number of log entries to return. |
| `offset` | `number` | No | Number of log entries to skip. Narrow the time range beyond 10000 entries. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `logs` | `object[] \| null` | No | — |
| `total_count` | `number \| null` | No | Number of matching log entries in the requested time range. |

> [accordion] logs full type
>
> ```ts theme={null}
> {
>   timestamp?: string | null,
>   message?: string | null,
>   severity?: number | null
> }[] | null
> ```

***

### images.list

`sandboxes.images.list`

List sandbox images. Return one cursor-paginated page of image repository summaries. Tags are listed separately. Pages can be empty when non-sandbox repositories are excluded; follow pagination.cursor while pagination.has\_more is true. Prefix search forces ascending name order.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.images.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `cursor` | `string` | No | Opaque cursor from the previous page; omit for the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `sort` | `string` | No | Sort by repository name or creation time: name:asc, name:desc, createdAt:asc, or createdAt:desc. Keep the same sort when following a cursor. |
| `q` | `string` | No | Case-sensitive repository name prefix. Search is applied before pagination. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Image repositories on this page. |
| `pagination` | `object \| null` | No | Cursor pagination information. The cursor is present only when another page is available. |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   status?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   last_deployed_at?: string | null,
>   size?: number | null,
>   tag_count?: number | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null
> } | null
> ```

***

### images.listLibrary

`sandboxes.images.listLibrary`

List built-in sandbox images. Return the built-in sandbox images, the same for every team, so no team is selected. Use the image field directly as the image of a sandbox, without building or pushing it. Hidden and upcoming images are excluded.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.images.listLibrary({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Built-in images. |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   display_name?: string | null,
>   description?: string | null,
>   long_description?: string | null,
>   image?: string | null,
>   memory?: number | null,
>   ports?: {
>     name?: string | null,
>     protocol?: string | null,
>     target?: number | null
>   }[] | null,
>   categories?: string[] | null,
>   tags?: string[] | null,
>   url?: string | null,
>   icon?: string | null,
>   icon_light?: string | null,
>   icon_dark?: string | null,
>   enterprise?: boolean | null,
>   hidden?: boolean | null,
>   coming_soon?: boolean | null,
>   creation_options?: {
>     extra_args?: Record<string, string> | null,
>     volumes?: {
>       name?: string | null,
>       mount_path?: string | null,
>       read_only?: boolean | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### images.push

`sandboxes.images.push`

Push a sandbox image. With image supplied, import the registry image asynchronously. Otherwise return an upload URL for a ZIP source archive containing its Dockerfile and build context. The uploaded ZIP archive must not exceed 5 GB. Processing starts after upload. No sandbox is created.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.sandboxes.images.push({ name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `name` | `string` | Yes | Target image repository name. Reusing a name pushes a new version to the existing repository. |
| `image` | `string` | No | Optional source registry image reference including a registry hostname. When omitted, the response provides an archive upload URL. The uploaded ZIP archive must not exceed 5 GB. |
| `docker_config` | `string` | No | Optional serialized registry authentication configuration for importing a private image. Used only when image is supplied; never returned. |
| `memory` | `number` | No | Memory in megabytes of the temporary environment that builds the source archive or imports the registry image. Omit it to use the default size. Does not change the memory of sandboxes created from the image. |
| `volume` | `number` | No | Scratch disk in megabytes attached to the temporary build environment for intermediate layers. Set it for large images that run out of space while building or importing. 0 builds in memory, which is the default. Teams with HIPAA compliance enabled accept only 0. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Target image repository name. |
| `status` | `string \| null` | No | Image processing status. Only BUILT images are ready to use. |
| `upload_url` | `string \| null` | No | Temporary signed URL for uploading the source ZIP archive with HTTP PUT. Present only when no source image was supplied. The uploaded ZIP archive must not exceed 5 GB. Uploading starts asynchronous processing. This storage upload is separate from the API endpoints. |
| `upload_headers` | `Record<string, string> \| null` | No | Headers the source archive upload must send, in addition to Content-Type, with exactly these names and values. Present only with upload\_url, when memory or volume was set. upload\_url is signed for these headers, so storage rejects an upload that omits or changes them. Treat names and values as opaque. |
| `image` | `string \| null` | No | Registered image reference including its tag, when available. Tags are assigned by the service; GET /sandboxes/images/\{image\_name}/tags returns the available tags once processing completes. |

***

### images.tags.delete

`sandboxes.images.tags.delete`

Delete an image tag. Delete a specific image version. Reject deletion if the version is referenced by an active deployment. Return the updated repository summary. Use the tag listing endpoint for remaining image versions. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.sandboxes.images.tags.delete({ image_name: 'example', tag_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `image_name` | `string` | Yes | Image repository name. |
| `tag_name` | `string` | Yes | Image tag name. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Stable repository name supplied when pushing the image. |
| `status` | `string \| null` | No | Image processing status. Only BUILT images are ready to use. |
| `created_at` | `string \| null` | No | Time the image was created. |
| `updated_at` | `string \| null` | No | Time the image was last updated. |
| `last_deployed_at` | `string \| null` | No | Most recent deployment time across all tags, if deployed. |
| `size` | `number \| null` | No | Total repository size in bytes. |
| `tag_count` | `number \| null` | No | Number of image versions in the repository. |

***

### images.tags.list

`sandboxes.images.tags.list`

List image tags. Return one cursor-paginated page of image versions.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.images.tags.list({ image_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `image_name` | `string` | Yes | Image repository name. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `cursor` | `string` | No | Opaque cursor from the previous page; omit for the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `sort` | `string` | No | Sort by tag name: name:asc or name:desc. Keep the same sort when following a cursor. |
| `q` | `string` | No | Case-sensitive tag name prefix. Cannot be combined with name. Forces ascending name order. |
| `name` | `string` | No | Exact tag name. Cannot be combined with q. Forces ascending name order. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | — |
| `pagination` | `object \| null` | No | Cursor pagination information. The cursor is present only when another page is available. |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   size?: number | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null
> } | null
> ```

***

### list

`sandboxes.list`

List sandboxes. Return a cursor-paginated page of sandboxes. Terminated sandboxes are hidden by default.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `cursor` | `string` | No | Opaque cursor from the previous page; omit for the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `q` | `string` | No | Search indexed sandbox names and labels. Search is applied before pagination. |
| `status` | `string[]` | No | Deployment statuses. Repeat the query parameter for each status, for example status=DEPLOYED\&status=FAILED. Unknown values are rejected. Cannot be combined with external\_id. |
| `external_id` | `string` | No | Filter by a caller-owned external identifier. Cannot be combined with status. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Resources on this page. |
| `pagination` | `object \| null` | No | Cursor pagination information. The cursor is present only when another page is available. |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   lifecycle?: {
>     expiration_policies?: (
>       {
>         action?: string | null,
>         type?: string | null,
>         value?: string | null
>       } | {
>         action?: string | null,
>         type?: string | null,
>         value?: string | null
>       } | {
>         action?: string | null,
>         type?: string | null,
>         value?: string | null
>       }
>     )[] | null,
>     terminated_retention?: string | null
>   } | null,
>   region?: string | null,
>   envs?: {
>     name?: string | null,
>     secret?: boolean | null,
>     value?: string | null
>   }[] | null,
>   image?: string | null,
>   memory?: number | null,
>   cpu?: number | null,
>   filesystem?: {
>     max_memory_usage?: string | number | null
>   } | null,
>   volumes?: {
>     name?: string | null,
>     mount_path?: string | null,
>     read_only?: boolean | null
>   }[] | null,
>   ports?: {
>     name?: string | null,
>     protocol?: string | null,
>     target?: number | null
>   }[] | null,
>   external_id?: string | null,
>   labels?: {
>   } | null,
>   name?: string | null,
>   url?: string | null,
>   status?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   created_by?: string | null,
>   updated_by?: string | null,
>   last_used_at?: string | null,
>   expires_in?: number | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null
> } | null
> ```

***

### previews.create

`sandboxes.previews.create`

Create a sandbox preview. Expose a port of the sandbox on an HTTPS URL. A public preview is reachable by anyone with the URL.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.sandboxes.previews.create({ sandbox_name: 'example', port: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sandbox_name` | `string` | Yes | Immutable sandbox name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `public` | `boolean` | No | Whether the URL is reachable without a preview token. Defaults to false on creation; a PATCH without it keeps the current value. |
| `response_headers` | `object` | No | Headers added to every response served by the preview, for example CORS headers. |
| `request_headers` | `object` | No | Headers added to every request forwarded to the sandbox, for example an Authorization header expected by the application. Responses return each name with the value "****", except a GET with show\_secrets=true by a workspace administrator. Sending "****" back as a value returns 400. A PATCH replaces the whole set. Some header names are reserved by the platform. |
| `expires_at` | `string` | No | Time at which the preview is deleted. Must be in the future. |
| `ttl` | `string` | No | Lifetime counted from the request, using seconds, minutes, hours or composite durations such as 1h30m. Whole days are also supported, for example 7d; days cannot be combined with other units. The preview is deleted when it elapses. |
| `create_if_not_exists` | `boolean` | No | When true, return the existing preview with this name instead of failing with a conflict. Without name, the name is public-\<port> or private-\<port>, so the same port and visibility return the same preview. Existing configuration is preserved. Defaults to false when omitted. |
| `name` | `string` | No | Preview name, unique within the sandbox. When omitted, generated from the sandbox name and port, or public-\<port> or private-\<port> when create\_if\_not\_exists is true. |
| `port` | `number` | Yes | Sandbox port to expose. |

> [accordion] response\_headers full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] request\_headers full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `public` | `boolean \| null` | No | Whether the URL is reachable without a preview token. Defaults to false on creation; a PATCH without it keeps the current value. |
| `response_headers` | `object \| null` | No | Headers added to every response served by the preview, for example CORS headers. |
| `request_headers` | `object \| null` | No | Headers added to every request forwarded to the sandbox, for example an Authorization header expected by the application. Responses return each name with the value "****", except a GET with show\_secrets=true by a workspace administrator. Sending "****" back as a value returns 400. A PATCH replaces the whole set. Some header names are reserved by the platform. |
| `expires_at` | `string \| null` | No | Time at which the preview is deleted. Must be in the future. |
| `name` | `string \| null` | No | Preview name, used in preview\_name path parameters. |
| `port` | `number \| null` | No | Exposed sandbox port. |
| `url` | `string \| null` | No | HTTPS URL serving the port, including the region label. Use this exact URL. Requests to a private preview need a token. |
| `status` | `string \| null` | No | Preview status, always uppercase. |
| `region` | `string \| null` | No | Region serving the preview, the sandbox's region. |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_by` | `string \| null` | No | — |
| `updated_by` | `string \| null` | No | — |

> [accordion] response\_headers full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] request\_headers full type
>
> ```ts theme={null}
> {
> } | null
> ```

***

### previews.delete

`sandboxes.previews.delete`

Delete a sandbox preview. Delete the preview and revoke its tokens. The URL stops serving immediately. Return the deleted preview, with status TERMINATED, or DELETING while a preview with many tokens finishes in the background. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.sandboxes.previews.delete({ sandbox_name: 'example', preview_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sandbox_name` | `string` | Yes | Immutable sandbox name returned by creation. |
| `preview_name` | `string` | Yes | Preview name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `public` | `boolean \| null` | No | Whether the URL is reachable without a preview token. Defaults to false on creation; a PATCH without it keeps the current value. |
| `response_headers` | `object \| null` | No | Headers added to every response served by the preview, for example CORS headers. |
| `request_headers` | `object \| null` | No | Headers added to every request forwarded to the sandbox, for example an Authorization header expected by the application. Responses return each name with the value "****", except a GET with show\_secrets=true by a workspace administrator. Sending "****" back as a value returns 400. A PATCH replaces the whole set. Some header names are reserved by the platform. |
| `expires_at` | `string \| null` | No | Time at which the preview is deleted. Must be in the future. |
| `name` | `string \| null` | No | Preview name, used in preview\_name path parameters. |
| `port` | `number \| null` | No | Exposed sandbox port. |
| `url` | `string \| null` | No | HTTPS URL serving the port, including the region label. Use this exact URL. Requests to a private preview need a token. |
| `status` | `string \| null` | No | Preview status, always uppercase. |
| `region` | `string \| null` | No | Region serving the preview, the sandbox's region. |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_by` | `string \| null` | No | — |
| `updated_by` | `string \| null` | No | — |

> [accordion] response\_headers full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] request\_headers full type
>
> ```ts theme={null}
> {
> } | null
> ```

***

### previews.get

`sandboxes.previews.get`

Get a sandbox preview. Return the preview configuration, URL and status.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.previews.get({ sandbox_name: 'example', preview_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sandbox_name` | `string` | Yes | Immutable sandbox name returned by creation. |
| `preview_name` | `string` | Yes | Preview name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `show_secrets` | `boolean` | No | Reveal request header values for workspace administrators, for example to change one header and send the full set back in a PATCH. Defaults to false. Callers without the admin role receive masked values even when true. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `public` | `boolean \| null` | No | Whether the URL is reachable without a preview token. Defaults to false on creation; a PATCH without it keeps the current value. |
| `response_headers` | `object \| null` | No | Headers added to every response served by the preview, for example CORS headers. |
| `request_headers` | `object \| null` | No | Headers added to every request forwarded to the sandbox, for example an Authorization header expected by the application. Responses return each name with the value "****", except a GET with show\_secrets=true by a workspace administrator. Sending "****" back as a value returns 400. A PATCH replaces the whole set. Some header names are reserved by the platform. |
| `expires_at` | `string \| null` | No | Time at which the preview is deleted. Must be in the future. |
| `name` | `string \| null` | No | Preview name, used in preview\_name path parameters. |
| `port` | `number \| null` | No | Exposed sandbox port. |
| `url` | `string \| null` | No | HTTPS URL serving the port, including the region label. Use this exact URL. Requests to a private preview need a token. |
| `status` | `string \| null` | No | Preview status, always uppercase. |
| `region` | `string \| null` | No | Region serving the preview, the sandbox's region. |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_by` | `string \| null` | No | — |
| `updated_by` | `string \| null` | No | — |

> [accordion] response\_headers full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] request\_headers full type
>
> ```ts theme={null}
> {
> } | null
> ```

***

### previews.list

`sandboxes.previews.list`

List sandbox previews. Return the previews of the sandbox in the paginated list format. cursor and limit are accepted but not applied yet; all previews fit on one page, so has\_more is false. Follow pagination.cursor while has\_more is true to stay compatible when they are applied.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.previews.list({ sandbox_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sandbox_name` | `string` | Yes | Immutable sandbox name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `cursor` | `string` | No | Opaque cursor from the previous page; omit for the first page. |
| `limit` | `number` | No | Maximum number of items to return. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Resources on this page. |
| `pagination` | `object \| null` | No | Cursor pagination information. The cursor is present only when another page is available. |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   public?: boolean | null,
>   response_headers?: {
>   } | null,
>   request_headers?: {
>   } | null,
>   expires_at?: string | null,
>   name?: string | null,
>   port?: number | null,
>   url?: string | null,
>   status?: string | null,
>   region?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   created_by?: string | null,
>   updated_by?: string | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null
> } | null
> ```

***

### previews.tokens.create

`sandboxes.previews.tokens.create`

Create a preview token. Create a token granting access to a private preview until expires\_at. Append it to the preview URL as ?preview\_token=\<token>.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.sandboxes.previews.tokens.create({ sandbox_name: 'example', preview_name: 'example', expires_at: '2026-04-09T10:00:00Z' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sandbox_name` | `string` | Yes | Immutable sandbox name returned by creation. |
| `preview_name` | `string` | Yes | Preview name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `create_if_not_exists` | `boolean` | No | When true, may return an existing unexpired token of this preview that stays valid at least until expires\_at instead of creating a new one. A token created a moment earlier may not be found yet, in which case a new token is created. Defaults to false when omitted. |
| `expires_at` | `string` | Yes | Time at which the token stops working. Must be in the future. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Token name, used in token\_name path parameters. |
| `token` | `string \| null` | No | Value to send as the preview\_token query parameter. |
| `expires_at` | `string \| null` | No | — |
| `expired` | `boolean \| null` | No | Whether expires\_at has passed. |

***

### previews.tokens.delete

`sandboxes.previews.tokens.delete`

Delete a preview token. Revoke the token. Requests using it are rejected immediately. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.sandboxes.previews.tokens.delete({ sandbox_name: 'example', preview_name: 'example', token_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sandbox_name` | `string` | Yes | Immutable sandbox name returned by creation. |
| `preview_name` | `string` | Yes | Preview name returned by creation. |
| `token_name` | `string` | Yes | Token name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `true` | Yes | Baseten accepted the call; it answered with no body. |

***

### previews.tokens.list

`sandboxes.previews.tokens.list`

List preview tokens. Return the tokens of a private preview in the paginated list format, including expired tokens until they are removed. cursor and limit are accepted but not applied yet; all tokens fit on one page, so has\_more is false.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.previews.tokens.list({ sandbox_name: 'example', preview_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sandbox_name` | `string` | Yes | Immutable sandbox name returned by creation. |
| `preview_name` | `string` | Yes | Preview name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `cursor` | `string` | No | Opaque cursor from the previous page; omit for the first page. |
| `limit` | `number` | No | Maximum number of items to return. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Resources on this page. |
| `pagination` | `object \| null` | No | Cursor pagination information. The cursor is present only when another page is available. |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   token?: string | null,
>   expires_at?: string | null,
>   expired?: boolean | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null
> } | null
> ```

***

### previews.update

`sandboxes.previews.update`

Update a sandbox preview. Partially update the preview. Omitted fields remain unchanged; supplied header maps replace their previous values. The URL does not change. Setting ttl or expires\_at replaces any previous expiration and restarts it from now. The name and port are immutable; supplying either returns 400.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.sandboxes.previews.update({ sandbox_name: 'example', preview_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sandbox_name` | `string` | Yes | Immutable sandbox name returned by creation. |
| `preview_name` | `string` | Yes | Preview name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `public` | `boolean` | No | Whether the URL is reachable without a preview token. Defaults to false on creation; a PATCH without it keeps the current value. |
| `response_headers` | `object` | No | Headers added to every response served by the preview, for example CORS headers. |
| `request_headers` | `object` | No | Headers added to every request forwarded to the sandbox, for example an Authorization header expected by the application. Responses return each name with the value "****", except a GET with show\_secrets=true by a workspace administrator. Sending "****" back as a value returns 400. A PATCH replaces the whole set. Some header names are reserved by the platform. |
| `expires_at` | `string` | No | Time at which the preview is deleted. Must be in the future. |
| `ttl` | `string` | No | Lifetime counted from the request, using seconds, minutes, hours or composite durations such as 1h30m. Whole days are also supported, for example 7d; days cannot be combined with other units. The preview is deleted when it elapses. |

> [accordion] response\_headers full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] request\_headers full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `public` | `boolean \| null` | No | Whether the URL is reachable without a preview token. Defaults to false on creation; a PATCH without it keeps the current value. |
| `response_headers` | `object \| null` | No | Headers added to every response served by the preview, for example CORS headers. |
| `request_headers` | `object \| null` | No | Headers added to every request forwarded to the sandbox, for example an Authorization header expected by the application. Responses return each name with the value "****", except a GET with show\_secrets=true by a workspace administrator. Sending "****" back as a value returns 400. A PATCH replaces the whole set. Some header names are reserved by the platform. |
| `expires_at` | `string \| null` | No | Time at which the preview is deleted. Must be in the future. |
| `name` | `string \| null` | No | Preview name, used in preview\_name path parameters. |
| `port` | `number \| null` | No | Exposed sandbox port. |
| `url` | `string \| null` | No | HTTPS URL serving the port, including the region label. Use this exact URL. Requests to a private preview need a token. |
| `status` | `string \| null` | No | Preview status, always uppercase. |
| `region` | `string \| null` | No | Region serving the preview, the sandbox's region. |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_by` | `string \| null` | No | — |
| `updated_by` | `string \| null` | No | — |

> [accordion] response\_headers full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] request\_headers full type
>
> ```ts theme={null}
> {
> } | null
> ```

***

### update

`sandboxes.update`

Update a sandbox. Partially update configuration. Omitted fields remain unchanged; supplied arrays and maps replace their previous values. Structured objects update only supplied fields. The name, memory, region, image, ports, filesystem, and volumes are immutable after creation.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.sandboxes.update({ sandbox_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sandbox_name` | `string` | Yes | Immutable sandbox name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `lifecycle` | `object` | No | Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates |
| `envs` | `object[]` | No | Environment variables injected into the sandbox. |
| `external_id` | `string` | No | Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash. |
| `labels` | `object` | No | Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy. |

> [accordion] lifecycle full type
>
> ```ts theme={null}
> {
>   expiration_policies?: (
>     {
>       action: DELETE,
>       type: TTL_IDLE,
>       value: string
>     } | {
>       action: DELETE,
>       type: TTL_MAX_AGE,
>       value: string
>     } | {
>       action: DELETE,
>       type: DATE,
>       value: string
>     }
>   )[],
>   terminated_retention?: string
> }
> ```

> [accordion] envs full type
>
> ```ts theme={null}
> {
>   name?: string,
>   secret?: boolean,
>   value?: string
> }[]
> ```

> [accordion] labels full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `lifecycle` | `object \| null` | No | Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates |
| `region` | `string \| null` | No | Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the default sandbox region is used. |
| `envs` | `object[] \| null` | No | Environment variables injected into the sandbox. |
| `image` | `string \| null` | No | Image reference including its tag. Built-in image references are returned in the canonical baseten/ namespace. Use baseten/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images. |
| `memory` | `number \| null` | No | Memory allocation in megabytes. Must be between 1024 and 262144. When cpu is not set at creation, memory also determines the CPU allocation (by default 2048 MB = 1 vCPU, 4096 MB = 2, 8192 MB = 4, 16384 MB = 6, 32768 MB = 8, 65536 MB = 16, 131072 MB or more = 32). |
| `cpu` | `number \| null` | No | Number of vCPUs the sandbox runs with. Always returned, including for sandboxes created without cpu, whose CPU allocation was derived from memory. Set at creation only. |
| `filesystem` | `object \| null` | No | Filesystem configuration. Set at creation only. |
| `volumes` | `object[] \| null` | No | Volumes mounted in the sandbox. Set at creation only. |
| `ports` | `object[] \| null` | No | Set of ports for a resource |
| `external_id` | `string \| null` | No | Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash. |
| `labels` | `object \| null` | No | Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy. |
| `name` | `string \| null` | No | Immutable sandbox name, provided by the client or generated by the server, used in sandbox\_name path parameters. |
| `url` | `string \| null` | No | Base URL of this sandbox's execution API, always present on successful creation. The URL is assigned before deployment completes; inspect status for readiness. Use this exact returned URL; do not reconstruct its hostname. Authenticate requests with your authentication token using Authorization: Bearer \<token>. Do not send the Baseten API key directly. No additional routing headers are required. Fetch GET \{url}/swagger/doc.json with that header for the API reference served by this sandbox. For example, POST \{url}/process with Content-Type: application/json and \{"command":"echo hello","waitForCompletion":true} executes a command and waits for its result. Execution API fields use camelCase, independently of this API's snake\_case fields. |
| `status` | `string \| null` | No | Sandbox deployment status. |
| `created_at` | `string \| null` | No | Time the sandbox was created. |
| `updated_at` | `string \| null` | No | Time the sandbox was last updated. |
| `created_by` | `string \| null` | No | User or service account that created the sandbox. |
| `updated_by` | `string \| null` | No | User or service account that last updated the sandbox. |
| `last_used_at` | `string \| null` | No | Time the sandbox was last used. |
| `expires_in` | `number \| null` | No | Seconds remaining before automatic deletion, when expiration is configured. |

> [accordion] lifecycle full type
>
> ```ts theme={null}
> {
>   expiration_policies?: (
>     {
>       action?: string | null,
>       type?: string | null,
>       value?: string | null
>     } | {
>       action?: string | null,
>       type?: string | null,
>       value?: string | null
>     } | {
>       action?: string | null,
>       type?: string | null,
>       value?: string | null
>     }
>   )[] | null,
>   terminated_retention?: string | null
> } | null
> ```

> [accordion] envs full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   secret?: boolean | null,
>   value?: string | null
> }[] | null
> ```

> [accordion] filesystem full type
>
> ```ts theme={null}
> {
>   max_memory_usage?: string | number | null
> } | null
> ```

> [accordion] volumes full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   mount_path?: string | null,
>   read_only?: boolean | null
> }[] | null
> ```

> [accordion] ports full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   protocol?: string | null,
>   target?: number | null
> }[] | null
> ```

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null
> ```

***

### volumes.create

`sandboxes.volumes.create`

Create a volume. Create a persistent volume that outlives the sandboxes it is mounted in. Mount it at sandbox creation with the volumes field; a volume is mounted in at most one sandbox at a time and must be in the same region. The name is generated when omitted. Volume size and count are limited by the team's plan.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.sandboxes.volumes.create({ size: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `name` | `string` | No | Volume name, unique in the team. Generated when omitted. |
| `size` | `string \| number` | Yes | Capacity, as a size (e.g. "10Gi", "512Mi") or a number of Mi (e.g. 1024). Can grow later, never shrink. |
| `region` | `string` | No | Region of the volume. Defaults to the default sandbox region. Sandboxes mounting it must be in the same region. |
| `labels` | `Record<string, string>` | No | Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Volume name, used in volume\_name path parameters and sandbox volumes. |
| `size` | `string \| number \| null` | No | Capacity, as a size (e.g. "10Gi", "512Mi") or a number of Mi (e.g. 1024). |
| `region` | `string \| null` | No | Region of the volume. |
| `status` | `string \| null` | No | Volume status, always uppercase. |
| `attached_to` | `string \| null` | No | Name of the sandbox the volume is mounted in. Absent when not mounted. |
| `labels` | `object \| null` | No | Labels. Omitted from list responses. |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_by` | `string \| null` | No | User or service account that created the volume. |
| `updated_by` | `string \| null` | No | User or service account that last updated the volume. |

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null
> ```

***

### volumes.delete

`sandboxes.volumes.delete`

Delete a volume. Permanently delete the volume and its data asynchronously. The returned resource has status DELETING. A volume mounted in a sandbox cannot be deleted (409); delete the sandbox first. Repeating the call while it is deleting returns the same resource. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.sandboxes.volumes.delete({ volume_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_name` | `string` | Yes | Volume name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Volume name, used in volume\_name path parameters and sandbox volumes. |
| `size` | `string \| number \| null` | No | Capacity, as a size (e.g. "10Gi", "512Mi") or a number of Mi (e.g. 1024). |
| `region` | `string \| null` | No | Region of the volume. |
| `status` | `string \| null` | No | Volume status, always uppercase. |
| `attached_to` | `string \| null` | No | Name of the sandbox the volume is mounted in. Absent when not mounted. |
| `labels` | `object \| null` | No | Labels. Omitted from list responses. |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_by` | `string \| null` | No | User or service account that created the volume. |
| `updated_by` | `string \| null` | No | User or service account that last updated the volume. |

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null
> ```

***

### volumes.get

`sandboxes.volumes.get`

Get a volume. Return the volume, its status and the sandbox it is mounted in, if any.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.volumes.get({ volume_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_name` | `string` | Yes | Volume name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Volume name, used in volume\_name path parameters and sandbox volumes. |
| `size` | `string \| number \| null` | No | Capacity, as a size (e.g. "10Gi", "512Mi") or a number of Mi (e.g. 1024). |
| `region` | `string \| null` | No | Region of the volume. |
| `status` | `string \| null` | No | Volume status, always uppercase. |
| `attached_to` | `string \| null` | No | Name of the sandbox the volume is mounted in. Absent when not mounted. |
| `labels` | `object \| null` | No | Labels. Omitted from list responses. |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_by` | `string \| null` | No | User or service account that created the volume. |
| `updated_by` | `string \| null` | No | User or service account that last updated the volume. |

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null
> ```

***

### volumes.list

`sandboxes.volumes.list`

List volumes. Return a cursor-paginated page of persistent volumes, newest first. Keep q and status unchanged when following a cursor.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.sandboxes.volumes.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `cursor` | `string` | No | Opaque cursor from the previous page; omit for the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `q` | `string` | No | Search volume names. Search is applied before pagination. |
| `status` | `(DEPLOYING \| DEPLOYED \| FAILED \| DELETING)[]` | No | Volume statuses. Repeat the query parameter for each status, for example status=DEPLOYED\&status=FAILED. Unknown values are rejected. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Resources on this page. |
| `pagination` | `object \| null` | No | Cursor pagination information. The cursor is present only when another page is available. |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   size?: string | number | null,
>   region?: string | null,
>   status?: string | null,
>   attached_to?: string | null,
>   labels?: {
>   } | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   created_by?: string | null,
>   updated_by?: string | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null
> } | null
> ```

***

### volumes.update

`sandboxes.volumes.update`

Update a volume. Grow the volume or replace its labels. size can only increase. The name and region are immutable; supplying either returns 400.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.sandboxes.volumes.update({ volume_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_name` | `string` | Yes | Volume name returned by creation. |
| `team_id` | `string` | No | Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden. |
| `size` | `string \| number` | No | New capacity, as a size (e.g. "20Gi") or a number of Mi, greater than or equal to the current size. |
| `labels` | `object` | No | Labels replacing all current labels, not merged with them. Omit to keep them. |

> [accordion] labels full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Volume name, used in volume\_name path parameters and sandbox volumes. |
| `size` | `string \| number \| null` | No | Capacity, as a size (e.g. "10Gi", "512Mi") or a number of Mi (e.g. 1024). |
| `region` | `string \| null` | No | Region of the volume. |
| `status` | `string \| null` | No | Volume status, always uppercase. |
| `attached_to` | `string \| null` | No | Name of the sandbox the volume is mounted in. Absent when not mounted. |
| `labels` | `object \| null` | No | Labels. Omitted from list responses. |
| `created_at` | `string \| null` | No | — |
| `updated_at` | `string \| null` | No | — |
| `created_by` | `string \| null` | No | User or service account that created the volume. |
| `updated_by` | `string \| null` | No | User or service account that last updated the volume. |

> [accordion] labels full type
>
> ```ts theme={null}
> {
> } | null
> ```

***

## Secrets

### delete

`secrets.delete`

Deletes a secret by name. Deletes a secret by name in the specified team, or in the caller's organization default team when no team is specified. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.secrets.delete({ secret_name: 'corsair_example_secret' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `secret_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Name of the deleted secret |

***

### list

`secrets.list`

Gets all secrets (metadata only, no plain text keys). Names and dates only: secret values are never returned.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.secrets.list({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `secrets` | `object[] \| null` | No | — |

> [accordion] secrets full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   team_name?: string | null
> }[] | null
> ```

***

### upsert

`secrets.upsert`

Upserts a secret. Creates or updates a secret by name. Scoped to the caller's primary team; use the team-scoped variant to target a specific team. Replaces the value of an existing secret with the same name: try it with a new name or on a test team.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.secrets.upsert({ name: 'corsair_example_secret', value: 'example-value' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | Name of the new or existing secret |
| `value` | `string` | Yes | Value of the secret |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable identifier for the secret. Unchanged across rotation. |
| `created_at` | `string \| null` | No | Time the secret was created in ISO 8601 format |
| `name` | `string \| null` | No | Name of the secret |
| `team_name` | `string \| null` | No | Name of the team the secret belongs to |

***

## Service Accounts

### create

`serviceAccounts.create`

Creates a service account. Creates a service account that workload identity federation tokens act as. It's enabled at once. Omit team\_id for an organization account, which only an organization admin can create. A team admin can create accounts for their own team.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.serviceAccounts.create({
	name: 'example',
	preset_permissions: { type: 'WORKSPACE_MANAGE_ALL' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | Name, unique in the organization. Can be changed later. |
| `description` | `string \| null` | No | Optional description, up to 1,024 characters |
| `team_id` | `string \| null` | No | The team that owns the account. Omit for an organization account. Can't be changed. |
| `preset_permissions` | `object` | Yes | A service account's access, as sent. Omit a list for no restriction; never send it empty. |

> [accordion] preset\_permissions full type
>
> ```ts theme={null}
> {
>   type: WORKSPACE_MANAGE_ALL | WORKSPACE_INVOKE | WORKSPACE_EXPORT_METRICS | WORKSPACE_MANAGE_API_KEYS | WORKSPACE_INVOKE_MODEL_APIS,
>   model_ids?: string[] | null,
>   environment_names?: string[] | null,
>   model_api_slugs?: string[] | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Service account ID |
| `name` | `string \| null` | No | Name, unique in the organization |
| `description` | `string \| null \| null` | No | Description |
| `team_id` | `string \| null \| null` | No | The team that owns the account. Null for an organization account. |
| `preset_permissions` | `object \| null` | No | A service account's access: one of the access types API keys have. Temporary: mirrors API key access until fine-grained access control is available, and may be removed. |
| `disabled` | `boolean \| null` | No | Whether the account is disabled. A disabled account can't be used. |
| `last_used_at` | `string \| null \| null` | No | Last time a request authenticated as this account, to within an hour. Null until the first. |
| `created_at` | `string \| null` | No | Time the account was created |
| `updated_at` | `string \| null` | No | Time the account was last updated |

> [accordion] preset\_permissions full type
>
> ```ts theme={null}
> {
>   type?: string | null,
>   model_ids?: string[] | null | null,
>   environment_names?: string[] | null | null,
>   model_api_slugs?: string[] | null | null
> } | null
> ```

***

### delete

`serviceAccounts.delete`

Deletes a service account. Deletes a disabled service account that no trust rule uses. Disable the account and delete its trust rules first. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.serviceAccounts.delete({ service_account_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `service_account_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | ID of the deleted service account |
| `deleted` | `boolean \| null` | No | Always true |

***

### get

`serviceAccounts.get`

Gets a service account. (GET /v1/service\_accounts/\{service\_account\_id})

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.serviceAccounts.get({ service_account_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `service_account_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Service account ID |
| `name` | `string \| null` | No | Name, unique in the organization |
| `description` | `string \| null \| null` | No | Description |
| `team_id` | `string \| null \| null` | No | The team that owns the account. Null for an organization account. |
| `preset_permissions` | `object \| null` | No | A service account's access: one of the access types API keys have. Temporary: mirrors API key access until fine-grained access control is available, and may be removed. |
| `disabled` | `boolean \| null` | No | Whether the account is disabled. A disabled account can't be used. |
| `last_used_at` | `string \| null \| null` | No | Last time a request authenticated as this account, to within an hour. Null until the first. |
| `created_at` | `string \| null` | No | Time the account was created |
| `updated_at` | `string \| null` | No | Time the account was last updated |

> [accordion] preset\_permissions full type
>
> ```ts theme={null}
> {
>   type?: string | null,
>   model_ids?: string[] | null | null,
>   environment_names?: string[] | null | null,
>   model_api_slugs?: string[] | null | null
> } | null
> ```

***

### getAccess

`serviceAccounts.getAccess`

Gets a service account's roles and the permissions they grant. Needs service\_account.read where the account belongs.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.serviceAccounts.getAccess({ service_account_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `service_account_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subject_type` | `string \| null` | No | Who holds a role. |
| `subject_id` | `string \| null` | No | ID of the user or service account |
| `subject_name` | `string \| null` | No | Name of the user or service account |
| `assignments` | `object[] \| null` | No | Every role held: assigned to the user or service account, or to a directory group it is in, or held through organization or team membership |
| `permissions` | `object[] \| null` | No | Every permission held, and where. Null until fine-grained authorization decides your organization's requests. |

> [accordion] assignments full type
>
> ```ts theme={null}
> {
>   id?: string | null | null,
>   granted_via?: string | null,
>   role_id?: string | null,
>   role_name?: string | null,
>   subject_type?: string | null,
>   subject_id?: string | null,
>   subject_name?: string | null,
>   team_id?: string | null | null,
>   team_name?: string | null | null,
>   resource_sets?: {
>     all_of?: {
>       type?: string | null,
>       identifier?: string | null
>     }[] | null
>   }[] | null,
>   created_by?: string | null | null,
>   created_at?: string | null | null
> }[] | null
> ```

> [accordion] permissions full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   display_name?: string | null,
>   category?: string | null,
>   grants?: {
>     team_id?: string | null | null,
>     team_name?: string | null | null,
>     resource_set?: {
>       type?: string | null,
>       identifier?: string | null
>     }[] | null
>   }[] | null
> }[] | null | null
> ```

***

### list

`serviceAccounts.list`

Lists service accounts. Lists the service accounts you administer: every account for an organization admin, and your teams' accounts for a team admin. Workload identity federation tokens act as service accounts.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.serviceAccounts.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `name` | `string \| null` | No | Only the account with this name, ignoring case |
| `team_id` | `string \| null` | No | Only this team's accounts |
| `disabled` | `boolean \| null` | No | Only disabled or enabled accounts |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null | null,
>   team_id?: string | null | null,
>   preset_permissions?: {
>     type?: string | null,
>     model_ids?: string[] | null | null,
>     environment_names?: string[] | null | null,
>     model_api_slugs?: string[] | null | null
>   } | null,
>   disabled?: boolean | null,
>   last_used_at?: string | null | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### update

`serviceAccounts.update`

Updates a service account. Updates the fields you send. Set disabled to true to stop the account being used, and back to false to restore it. preset\_permissions replaces the account's access as a whole. The owning team can't change.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.serviceAccounts.update({ service_account_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `service_account_id` | `string` | Yes | — |
| `name` | `string \| null` | No | Name, unique in the organization |
| `description` | `string \| null` | No | Description, up to 1,024 characters; null clears it |
| `disabled` | `boolean \| null` | No | Disable the account to stop it being used, or enable it again. Disabling the account permanently revokes its access tokens. |
| `preset_permissions` | `object \| null` | No | Replaces the account's access as a whole. Temporary; may be removed once fine-grained access control is available. |

> [accordion] preset\_permissions full type
>
> ```ts theme={null}
> {
>   type: WORKSPACE_MANAGE_ALL | WORKSPACE_INVOKE | WORKSPACE_EXPORT_METRICS | WORKSPACE_MANAGE_API_KEYS | WORKSPACE_INVOKE_MODEL_APIS,
>   model_ids?: string[] | null,
>   environment_names?: string[] | null,
>   model_api_slugs?: string[] | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Service account ID |
| `name` | `string \| null` | No | Name, unique in the organization |
| `description` | `string \| null \| null` | No | Description |
| `team_id` | `string \| null \| null` | No | The team that owns the account. Null for an organization account. |
| `preset_permissions` | `object \| null` | No | A service account's access: one of the access types API keys have. Temporary: mirrors API key access until fine-grained access control is available, and may be removed. |
| `disabled` | `boolean \| null` | No | Whether the account is disabled. A disabled account can't be used. |
| `last_used_at` | `string \| null \| null` | No | Last time a request authenticated as this account, to within an hour. Null until the first. |
| `created_at` | `string \| null` | No | Time the account was created |
| `updated_at` | `string \| null` | No | Time the account was last updated |

> [accordion] preset\_permissions full type
>
> ```ts theme={null}
> {
>   type?: string | null,
>   model_ids?: string[] | null | null,
>   environment_names?: string[] | null | null,
>   model_api_slugs?: string[] | null | null
> } | null
> ```

***

## Teams

### createApiKey

`teams.createApiKey`

Creates a team API key. Creates a team API key with the provided name and type. The API key is returned in the response. Returns the new key's secret once.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.teams.createApiKey({ team_id: 'team1234', type: 'PERSONAL' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `name` | `string \| null` | No | Optional name for the API key |
| `type` | `PERSONAL \| GRID \| WORKSPACE_MANAGE_ALL \| WORKSPACE_EXPORT_METRICS \| WORKSPACE_INVOKE \| WORKSPACE_MANAGE_API_KEYS` | Yes | Enum representing the category of an API key. |
| `model_ids` | `string[] \| null` | No | List of model IDs to scope the API key to, only present if type is 'WORKSPACE\_EXPORT\_METRICS' or 'WORKSPACE\_INVOKE' |
| `expires_at` | `string \| null` | No | Expiration time in UTC. Must be in the future. Personal keys must expire within 90 days, or sooner if your organization sets a lower limit. Team and organization keys require an expiration within your organization's limit when one is set; otherwise they may omit it or use null. Organization lifetime limits do not apply to Grid keys. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `api_key` | `string \| null` | No | The API key string |

***

### environmentGroups.get

`teams.environmentGroups.get`

Gets an environment group by name. Gets a single environment group by name. The team-scoped path targets the team in the path; the top-level path targets the caller's organization default team.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.teams.environmentGroups.get({ team_id: 'team1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Name of the environment group, matching the environment name it governs. |
| `team_id` | `string \| null` | No | Unique identifier of the team the environment group belongs to. |
| `team_name` | `string \| null` | No | Name of the team the environment group belongs to. |
| `manage_access` | `object \| null` | No | Who is allowed to manage an environment group. |

> [accordion] manage\_access full type
>
> ```ts theme={null}
> {
>   is_restricted?: boolean | null,
>   users?: {
>     user_id?: string | null,
>     email?: string | null | null,
>     name?: string | null | null
>   }[] | null
> } | null
> ```

***

### environmentGroups.list

`teams.environmentGroups.list`

Lists environment groups. Lists environment groups. The team-scoped path targets the team in the path; the top-level path targets the caller's organization default team.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.teams.environmentGroups.list({ team_id: 'team1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   team_id?: string | null,
>   team_name?: string | null,
>   manage_access?: {
>     is_restricted?: boolean | null,
>     users?: {
>       user_id?: string | null,
>       email?: string | null | null,
>       name?: string | null | null
>     }[] | null
>   } | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### environmentGroups.update

`teams.environmentGroups.update`

Updates an environment group's restriction settings. Sets whether the environment is restricted and replaces the list of users granted manage access. The team-scoped path targets the team in the path; the top-level path targets the caller's organization default team.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.teams.environmentGroups.update({ team_id: 'team1234', env_name: 'staging' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `env_name` | `string` | Yes | — |
| `manage_access` | `object \| null` | No | Manage-access settings to apply. Omit to leave manage access unchanged. |

> [accordion] manage\_access full type
>
> ```ts theme={null}
> {
>   is_restricted: boolean,
>   user_ids?: string[]
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Name of the environment group, matching the environment name it governs. |
| `team_id` | `string \| null` | No | Unique identifier of the team the environment group belongs to. |
| `team_name` | `string \| null` | No | Name of the team the environment group belongs to. |
| `manage_access` | `object \| null` | No | Who is allowed to manage an environment group. |

> [accordion] manage\_access full type
>
> ```ts theme={null}
> {
>   is_restricted?: boolean | null,
>   users?: {
>     user_id?: string | null,
>     email?: string | null | null,
>     name?: string | null | null
>   }[] | null
> } | null
> ```

***

### get

`teams.get`

Gets a team by ID. Returns a team the authenticated user has access to.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.teams.get({ team_id: 'team1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the team |
| `name` | `string \| null` | No | Name of the team |
| `default` | `boolean \| null` | No | Whether this is the default team for the organization |
| `created_at` | `string \| null` | No | Time the team was created in ISO 8601 format |

***

### list

`teams.list`

Lists all teams. Returns a list of all teams the authenticated user has access to.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.teams.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | When set, returns only the team with this exact name, if any. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `teams` | `object[] \| null` | No | A list of teams |

> [accordion] teams full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   default?: boolean | null,
>   created_at?: string | null
> }[] | null
> ```

***

### llmModels.create

`teams.llmModels.create`

Creates a new BIS-LLM deployment. (POST /v1/teams/\{team\_id}/llm\_models)

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.teams.llmModels.create({
	team_id: 'team1234',
	resources: {},
	name: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `resources` | `object` | Yes | Resources allocated to the model |
| `deployment_name` | `string \| null` | No | Name of the deployment, unique within the model. Use only A-Z, a-z, 0-9, '-', '\_', and '.'. The name 'development' is reserved. If omitted or empty, a name is generated automatically. |
| `region` | `string \| null` | No | Region in which to deploy the model |
| `llm_version` | `string \| null` | No | Version of the helm chart to use. |
| `llm_config` | `object` | No | Configuration specific to the LLM model |
| `environment_variables` | `object` | No | Environment variables for the model |
| `model_metadata` | `object \| null` | No | Model metadata persisted into model\_config |
| `autoscaling_settings` | `object \| null` | No | Autoscaling settings for the model |
| `additional_autoscaling_config` | `object \| null` | No | Additional autoscaling configuration (e.g. target in-flight tokens) |
| `metadata` | `object \| null` | No | User-defined metadata for the deployment |
| `weights` | `object[] \| null` | No | Weight configurations for BDN model weight distribution |
| `bdn` | `object \| null` | No | BDN configuration: read-only sealed volume mounts, and Hot Load at /bdn on worker pods |
| `egress_restrictions` | `object \| null` | No | Restricts this deployment's egress to the specified FQDNs and IP addresses; an empty block allows none. Requires the organization to have egress restrictions enabled. |
| `runtime` | `object \| null` | No | Runtime configuration for the deployment |
| `name` | `string` | Yes | Name of the model |

> [accordion] resources full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] llm\_config full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] environment\_variables full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] model\_metadata full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] autoscaling\_settings full type
>
> ```ts theme={null}
> {
>   min_replica?: number | null,
>   max_replica?: number | null,
>   autoscaling_window?: number | null,
>   scale_down_delay?: number | null,
>   concurrency_target?: number | null,
>   target_utilization_percentage?: number | null,
>   target_in_flight_tokens?: number | null,
>   max_scale_down_rate?: number | null
> } | null
> ```

> [accordion] additional\_autoscaling\_config full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] weights full type
>
> ```ts theme={null}
> {
> }[] | null
> ```

> [accordion] bdn full type
>
> ```ts theme={null}
> {
> } | null
> ```

> [accordion] egress\_restrictions full type
>
> ```ts theme={null}
> {
>   fqdn_allow_list?: string[] | null,
>   ip_allow_list?: string[] | null
> } | null
> ```

> [accordion] runtime full type
>
> ```ts theme={null}
> {
>   oidc?: {
>     enabled?: boolean | null,
>     byok?: {
>     } | null
>   } | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `model_id` | `string \| null` | No | Unique identifier of the model |
| `version_id` | `string \| null` | No | Unique identifier of the model version |
| `hostname` | `string \| null` | No | Hostname used to invoke the model |
| `instance_type_name` | `string \| null \| null` | No | Name of the instance type the model deployment is running on |

***

### loops.runs.create

`teams.loops.runs.create`

Creates a Loops run in a team. Creates a Loops run with an associated sampler in the given session; the run's infrastructure belongs to the given team.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.teams.loops.runs.create({ team_id: 'team1234', session_id: 'example', base_model: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `session_id` | `string` | Yes | ID of the Loops session this run belongs to. |
| `base_model` | `string` | Yes | Base model ID (e.g. 'Qwen/Qwen3-8B'). |
| `name` | `string \| null` | No | Optional display name for the run. Defaults to the base model name when omitted. |
| `max_seq_len` | `number \| null` | No | Maximum prompt length (in tokens) the run must handle. Set this to the longest training example you plan to send. Defaults to the maximum supported by the model configuration. |
| `lora_rank` | `number` | No | LoRA rank. |
| `seed` | `number \| null` | No | Random seed for reproducibility. |
| `scale_down_delay_seconds` | `number` | No | Seconds of inactivity before the run scales to zero. Must be between 1 and 3600 (1 hour). Defaults to 900 (15 minutes). |
| `availability_model` | `standard \| spot` | No | Capacity a training job or Loops trainer runs on. |
| `replicas` | `number` | No | Number of data-parallel trainer replicas. Each replica is one full copy of the model's preset node group, so the trainer deployment runs (preset node\_count \* replicas) nodes (e.g. replicas=4 on a 4-node preset → 16 nodes, 4 DP workers). Must be a positive integer. Defaults to 1. |
| `path` | `string \| null` | No | Optional bt:// URI of an existing checkpoint to load weights from on startup. Form: bt://loops:\<run\_id>/weights/\<checkpoint\_name>. |
| `reuse_from_run_id` | `string \| null` | No | Optional ID of a prior Loops run whose trainer and/or sampler should be reused for this run instead of provisioning fresh. The prior run must use the same base model and belong to the same team. |
| `reuse_from_session_id` | `string \| null` | No | Optional ID of a prior Loops session whose trainer and/or sampler should be reused for this run. Deprecated in favor of reuse\_from\_run\_id. |
| `base_checkpoint` | `string \| null` | No | Optional checkpoint to start training from instead of the base model's weights: a Hugging Face repo (hf://\<org>/\<repo>\[@\<revision>]), an object store path (s3://, gs\://, r2://, cw://, or azure://), or a full Baseten Training checkpoint in the run's team (bt://\<project>@\<job\_id>/\<checkpoint>, with the checkpoint named). It must be a complete, merged checkpoint in safetensors format with the same architecture as base\_model, which still selects the hardware and training configuration. It must include tokenizer files: the run's sampler loads the tokenizer and chat template from the checkpoint. A Hugging Face revision is pinned to a commit when the run is created, and its files are checked then. Any other source is read again by each sampler and resumed run, so do not change it while the run is in use. Checkpoints from a run on a source outside Hugging Face cannot be deployed yet. Cannot be combined with path, reuse\_from\_run\_id, or reuse\_from\_session\_id. |
| `base_checkpoint_auth` | `object \| null` | No | Optional credentials that read base\_checkpoint. Only CUSTOM\_SECRET is supported: set auth\_secret\_name to the team secret that holds a Hugging Face token for a Hugging Face repo, or the credentials for an object store. A Baseten Training checkpoint takes no auth. The run, its samplers, resumed runs, and checkpoint deployments all use this secret. When omitted, a Hugging Face repo is read with the team secret hf\_access\_token if it exists. Requires base\_checkpoint. |
| `sampler_num_replicas` | `number \| null` | No | Number of replicas the run's sampler runs, applied as both its minimum and maximum. Must be at least 1. If omitted, a new sampler uses the platform defaults and a sampler reused from an earlier run keeps its settings. A run that already has a sampler keeps it unchanged. When the run ends, its sampler is scaled down. |

> [accordion] base\_checkpoint\_auth full type
>
> ```ts theme={null}
> {
>   auth_method: CUSTOM_SECRET | AWS_OIDC | GCP_OIDC | HUGGING_FACE_OIDC | AWS_ASSUME_ROLE,
>   auth_secret_name?: string | null,
>   aws_oidc_role_arn?: string | null,
>   aws_oidc_region?: string | null,
>   gcp_oidc_service_account?: string | null,
>   gcp_oidc_workload_id_provider?: string | null,
>   aws_assume_role_arn?: string | null,
>   aws_assume_role_region?: string | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `run` | `object \| null` | No | — |

> [accordion] run full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   session_id?: string | null,
>   deployment_id?: string | null | null,
>   name?: string | null,
>   base_model?: string | null,
>   lora_config_version?: string | null | null,
>   base_checkpoint?: string | null | null,
>   base_url?: string | null,
>   created_at?: string | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   sampler?: {
>     id?: string | null,
>     session_id?: string | null,
>     base_url?: string | null,
>     base_model?: string | null,
>     created_at?: string | null,
>     model_id?: string | null | null,
>     deployment_id?: string | null | null,
>     status?: {
>       name?: string | null
>     } | null,
>     user?: {
>       email?: string | null | null
>     } | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null | null,
>     node_count?: number | null,
>     base_checkpoint?: string | null | null
>   } | null | null
> } | null
> ```

***

### loops.runs.list

`teams.loops.runs.list`

Lists a team's Loops runs. Lists Loops runs in the given team, visible to the requesting user, optionally filtered by run id, base model, and/or session.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.teams.loops.runs.list({ team_id: 'team1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `run_id` | `string \| null` | No | Filter by run ID. |
| `base_model` | `string \| null` | No | Filter runs by base model name. |
| `session_id` | `string \| null` | No | Filter runs by the session that created them. An unknown or inaccessible session returns an empty list. |
| `scope` | `string \| null` | No | Defaults to the caller's own runs; pass 'org' to list every run in the caller's organization. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `runs` | `object[] \| null` | No | List of runs. |

> [accordion] runs full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   session_id?: string | null,
>   deployment_id?: string | null | null,
>   name?: string | null,
>   base_model?: string | null,
>   lora_config_version?: string | null | null,
>   base_checkpoint?: string | null | null,
>   base_url?: string | null,
>   created_at?: string | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   sampler?: {
>     id?: string | null,
>     session_id?: string | null,
>     base_url?: string | null,
>     base_model?: string | null,
>     created_at?: string | null,
>     model_id?: string | null | null,
>     deployment_id?: string | null | null,
>     status?: {
>       name?: string | null
>     } | null,
>     user?: {
>       email?: string | null | null
>     } | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null | null,
>     node_count?: number | null,
>     base_checkpoint?: string | null | null
>   } | null | null
> }[] | null
> ```

***

### loops.samplers.create

`teams.loops.samplers.create`

Creates a Loops sampler in a team. Creates a standalone Loops sampler not linked to a run; the sampler belongs to the given team.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.teams.loops.samplers.create({ team_id: 'team1234', session_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `availability_model` | `standard \| spot \| null` | No | Capacity the sampler runs on. 'spot' allows preemption when its GPUs are reclaimed. Defaults to 'standard' for standalone samplers. Paired samplers inherit their run's availability model; an explicit value must match it. |
| `session_id` | `string` | Yes | ID of the Loops session this sampler belongs to. |
| `base_model` | `string \| null` | No | Base model ID for a standalone sampler (for example, a baseline). |
| `run_id` | `string \| null` | No | ID of an existing run to attach this sampler to. When set, the sampler is paired to the run and weight-syncs from its trainer, and base\_model is inherited from the run. Omit to create a standalone sampler. |
| `max_seq_length` | `number \| null` | No | Maximum prompt length (in tokens) the sampler must handle. Set this to the longest prompt you plan to send. |
| `model_path` | `string \| null` | No | bt:// URI of an existing sampler checkpoint to serve. Form: bt://loops:\<run\_id>/sampler\_weights/\<checkpoint\_name>. |
| `reuse_from_session_id` | `string \| null` | No | Optional ID of a prior Loops session to reuse a trainer and/or sampler from. Deprecated. |
| `num_replicas` | `number \| null` | No | Number of replicas the sampler runs, applied as both its minimum and maximum. Must be at least 1. If omitted, a new sampler uses the platform defaults and a paired sampler reused from an earlier run keeps its settings. A run that already has a sampler keeps it unchanged, and when a run ends, its sampler is scaled down. |
| `scope` | `default \| serverless \| dedicated` | No | Where a Loops run's trainer or a standalone sampler runs. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sampler` | `object \| null` | No | — |

> [accordion] sampler full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   session_id?: string | null,
>   base_url?: string | null,
>   base_model?: string | null,
>   created_at?: string | null,
>   model_id?: string | null | null,
>   deployment_id?: string | null | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null | null,
>   node_count?: number | null,
>   base_checkpoint?: string | null | null
> } | null
> ```

***

### loops.samplers.list

`teams.loops.samplers.list`

Lists a team's Loops samplers. Lists Loops samplers (paired and standalone) in the given team, visible to the requesting user, optionally filtered by session. Defaults to the caller's own; pass ?scope=org to list every sampler in the team.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.teams.loops.samplers.list({ team_id: 'team1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `session_id` | `string \| null` | No | Filter samplers by the session that created them. An unknown or inaccessible session returns an empty list. |
| `scope` | `string \| null` | No | Defaults to the caller's own samplers; pass 'org' to include samplers owned by other users in the caller's organization. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `samplers` | `object[] \| null` | No | List of samplers. |

> [accordion] samplers full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   session_id?: string | null,
>   base_url?: string | null,
>   base_model?: string | null,
>   created_at?: string | null,
>   model_id?: string | null | null,
>   deployment_id?: string | null | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null | null,
>   node_count?: number | null,
>   base_checkpoint?: string | null | null
> }[] | null
> ```

***

### loops.sessions.create

`teams.loops.sessions.create`

Creates a Loops session. Creates a Loops session scoped to the calling org.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.teams.loops.sessions.create({ team_id: 'team1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `session` | `object \| null` | No | — |

> [accordion] session full type
>
> ```ts theme={null}
> {
>   id?: string | null
> } | null
> ```

***

### loops.trainers.create

`teams.loops.trainers.create`

Creates a Loops trainer. Creates a trainer-only Loops run in the given session, without a sampler. To sample from it, create a sampler with POST /v1/loops/samplers and pass this run's ID as run\_id to pair the two. List and read the trainer through the /v1/loops/runs endpoints.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.teams.loops.trainers.create({ team_id: 'team1234', session_id: 'example', base_model: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `session_id` | `string` | Yes | ID of the Loops session this run belongs to. |
| `base_model` | `string` | Yes | Base model ID (e.g. 'Qwen/Qwen3-8B'). |
| `name` | `string \| null` | No | Optional display name for the run. Defaults to the base model name when omitted. |
| `max_seq_len` | `number \| null` | No | Maximum prompt length (in tokens) the run must handle. Set this to the longest training example you plan to send. Defaults to the maximum supported by the model configuration. |
| `lora_rank` | `number` | No | LoRA rank. |
| `seed` | `number \| null` | No | Random seed for reproducibility. |
| `scale_down_delay_seconds` | `number` | No | Seconds of inactivity before the run scales to zero. Must be between 1 and 3600 (1 hour). Defaults to 900 (15 minutes). |
| `availability_model` | `standard \| spot` | No | Capacity a training job or Loops trainer runs on. |
| `replicas` | `number` | No | Number of data-parallel trainer replicas. Each replica is one full copy of the model's preset node group, so the trainer deployment runs (preset node\_count \* replicas) nodes (e.g. replicas=4 on a 4-node preset → 16 nodes, 4 DP workers). Must be a positive integer. Defaults to 1. |
| `path` | `string \| null` | No | Optional bt:// URI of an existing checkpoint to load weights from on startup. Form: bt://loops:\<run\_id>/weights/\<checkpoint\_name>. |
| `reuse_from_run_id` | `string \| null` | No | Optional ID of a prior Loops run whose trainer and/or sampler should be reused for this run instead of provisioning fresh. The prior run must use the same base model and belong to the same team. |
| `reuse_from_session_id` | `string \| null` | No | Optional ID of a prior Loops session whose trainer and/or sampler should be reused for this run. Deprecated in favor of reuse\_from\_run\_id. |
| `base_checkpoint` | `string \| null` | No | Optional checkpoint to start training from instead of the base model's weights: a Hugging Face repo (hf://\<org>/\<repo>\[@\<revision>]), an object store path (s3://, gs\://, r2://, cw://, or azure://), or a full Baseten Training checkpoint in the run's team (bt://\<project>@\<job\_id>/\<checkpoint>, with the checkpoint named). It must be a complete, merged checkpoint in safetensors format with the same architecture as base\_model, which still selects the hardware and training configuration. It must include tokenizer files: the run's sampler loads the tokenizer and chat template from the checkpoint. A Hugging Face revision is pinned to a commit when the run is created, and its files are checked then. Any other source is read again by each sampler and resumed run, so do not change it while the run is in use. Checkpoints from a run on a source outside Hugging Face cannot be deployed yet. Cannot be combined with path, reuse\_from\_run\_id, or reuse\_from\_session\_id. |
| `base_checkpoint_auth` | `object \| null` | No | Optional credentials that read base\_checkpoint. Only CUSTOM\_SECRET is supported: set auth\_secret\_name to the team secret that holds a Hugging Face token for a Hugging Face repo, or the credentials for an object store. A Baseten Training checkpoint takes no auth. The run, its samplers, resumed runs, and checkpoint deployments all use this secret. When omitted, a Hugging Face repo is read with the team secret hf\_access\_token if it exists. Requires base\_checkpoint. |
| `scope` | `default \| serverless \| dedicated` | No | Where a Loops run's trainer or a standalone sampler runs. |

> [accordion] base\_checkpoint\_auth full type
>
> ```ts theme={null}
> {
>   auth_method: CUSTOM_SECRET | AWS_OIDC | GCP_OIDC | HUGGING_FACE_OIDC | AWS_ASSUME_ROLE,
>   auth_secret_name?: string | null,
>   aws_oidc_role_arn?: string | null,
>   aws_oidc_region?: string | null,
>   gcp_oidc_service_account?: string | null,
>   gcp_oidc_workload_id_provider?: string | null,
>   aws_assume_role_arn?: string | null,
>   aws_assume_role_region?: string | null
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `run` | `object \| null` | No | — |

> [accordion] run full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   session_id?: string | null,
>   deployment_id?: string | null | null,
>   name?: string | null,
>   base_model?: string | null,
>   lora_config_version?: string | null | null,
>   base_checkpoint?: string | null | null,
>   base_url?: string | null,
>   created_at?: string | null,
>   status?: {
>     name?: string | null
>   } | null,
>   user?: {
>     email?: string | null | null
>   } | null,
>   sampler?: {
>     id?: string | null,
>     session_id?: string | null,
>     base_url?: string | null,
>     base_model?: string | null,
>     created_at?: string | null,
>     model_id?: string | null | null,
>     deployment_id?: string | null | null,
>     status?: {
>       name?: string | null
>     } | null,
>     user?: {
>       email?: string | null | null
>     } | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null | null,
>     node_count?: number | null,
>     base_checkpoint?: string | null | null
>   } | null | null
> } | null
> ```

***

### models.create

`teams.models.create`

Creates a new model from a source. Creates a new model in the caller's organization. The source field selects how the model is constructed (currently library\_listing, which forks an accessible listing from GET /v1/library\_models). The deployment isn't instantly ready; poll the GET endpoint until status is ACTIVE.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.teams.models.create({
	team_id: 'team1234',
	source: { lab_display_name: 'example', user_defined_listing_id: 'example' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `source` | `object` | Yes | Where the new model is created from. |

> [accordion] source full type
>
> ```ts theme={null}
> {
>   kind?: library_listing,
>   lab_display_name: string,
>   user_defined_listing_id: string,
>   deployed_model_name?: string | null
> } | {
>   kind?: model_archive,
>   name: string,
>   deployment: {
>     config: {
>     },
>     raw_config?: string | null,
>     user_env?: {
>     } | null,
>     environment_name?: string | null,
>     create_environment_if_missing?: boolean,
>     region?: string | null,
>     preserve_env_instance_type?: boolean,
>     deploy_timeout_minutes?: number | null,
>     deployment_name?: string | null,
>     labels?: {
>     } | null,
>     is_development?: boolean,
>     autoscaling_settings?: {
>       min_replica?: number | null,
>       max_replica?: number | null,
>       autoscaling_window?: number | null,
>       scale_down_delay?: number | null,
>       concurrency_target?: number | null,
>       target_utilization_percentage?: number | null,
>       target_in_flight_tokens?: number | null,
>       max_scale_down_rate?: number | null
>     } | null,
>     request_backpressure_settings?: {
>       policy?: QUEUE_ON_FULL | REJECT_ON_FULL | null
>     } | null,
>     autoscaling_schedule_settings?: {
>       timezone?: string | null,
>       schedules?: (
>         {
>           id?: string | null,
>           name: string,
>           enabled: boolean,
>           autoscaling_settings: {
>             min_replica: number,
>             max_replica: number,
>             autoscaling_window: number | null,
>             scale_down_delay: number | null,
>             concurrency_target: number | null,
>             target_utilization_percentage: number | null,
>             target_in_flight_tokens: number | null,
>             max_scale_down_rate: number | null
>           },
>           cadence: DAILY | HOURLY,
>           weekdays: (SUNDAY | MONDAY | TUESDAY | WEDNESDAY | THURSDAY | FRIDAY | SATURDAY)[],
>           start_hour?: number | null,
>           start_minute: number,
>           end_hour?: number | null,
>           end_minute: number
>         } | {
>           id?: string | null,
>           name: string,
>           enabled: boolean,
>           autoscaling_settings: {
>             min_replica: number,
>             max_replica: number,
>             autoscaling_window: number | null,
>             scale_down_delay: number | null,
>             concurrency_target: number | null,
>             target_utilization_percentage: number | null,
>             target_in_flight_tokens: number | null,
>             max_scale_down_rate: number | null
>           },
>           cadence: ONE_TIME,
>           start_at: string,
>           end_at: string
>         }
>       )[],
>       delete_schedules?: string[]
>     } | null,
>     promotion_settings_override?: {
>       redeploy_on_promotion?: boolean | null,
>       rolling_deploy?: boolean | null,
>       promotion_cleanup_strategy?: KEEP | SCALE_TO_ZERO | DEACTIVATE | null,
>       rolling_deploy_config?: {
>         rolling_deploy_strategy?: REPLICA | null,
>         max_surge_percent?: number | null,
>         max_unavailable_percent?: number | null,
>         stabilization_time_seconds?: number | null,
>         replica_overhead_percent?: number | null
>       } | null,
>       ramp_up_while_promoting?: boolean | null,
>       ramp_up_duration_seconds?: number | null
>     } | null,
>     instance_type_id?: string | null
>   },
>   s3_key?: string | null,
>   disable_archive_download?: boolean
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `model` | `object \| null` | No | A model. |
| `deployment` | `object \| null` | No | A deployment of a model. |

> [accordion] model full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   deployments_count?: number | null,
>   production_deployment_id?: string | null | null,
>   development_deployment_id?: string | null | null,
>   instance_type_name?: string | null,
>   team_name?: string | null
> } | null
> ```

> [accordion] deployment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   model_id?: string | null,
>   is_production?: boolean | null,
>   is_development?: boolean | null,
>   status?: string | null,
>   active_replica_count?: number | null,
>   autoscaling_settings?: {
>     min_replica?: number | null,
>     max_replica?: number | null,
>     autoscaling_window?: number | null | null,
>     scale_down_delay?: number | null | null,
>     concurrency_target?: number | null,
>     target_utilization_percentage?: number | null | null,
>     target_in_flight_tokens?: number | null | null,
>     max_scale_down_rate?: number | null | null
>   } | null | null,
>   instance_type_name?: string | null | null,
>   environment?: string | null | null,
>   labels?: {
>   } | null | null,
>   region?: {
>     slug?: string | null,
>     display_name?: string | null
>   } | null | null,
>   request_backpressure_settings?: {
>     policy?: string | null | null
>   } | null,
>   failure_reason?: string | null | null
> } | null
> ```

***

### models.list

`teams.models.list`

Gets all models. (GET /v1/teams/\{team\_id}/models)

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.teams.models.list({ team_id: 'team1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `name` | `string \| null` | No | When set, returns only models with this exact name, if any. On a team-scoped route this matches at most one model; on the org-wide route it may match models in multiple teams, since names are unique only within a team. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `models` | `object[] \| null` | No | — |

> [accordion] models full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   deployments_count?: number | null,
>   production_deployment_id?: string | null | null,
>   development_deployment_id?: string | null | null,
>   instance_type_name?: string | null,
>   team_name?: string | null
> }[] | null
> ```

***

### regions.list

`teams.regions.list`

Lists regions available to a team. Lists the regions the team specified in the path can place deployments in.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.teams.regions.list({ team_id: 'team1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `regions` | `object[] \| null` | No | — |

> [accordion] regions full type
>
> ```ts theme={null}
> {
>   slug?: string | null,
>   display_name?: string | null
> }[] | null
> ```

***

### secrets.delete

`teams.secrets.delete`

Deletes a secret by name. Deletes a secret by name in the specified team, or in the caller's organization default team when no team is specified. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.teams.secrets.delete({ team_id: 'team1234', secret_name: 'corsair_example_secret' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `secret_name` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Name of the deleted secret |

***

### secrets.list

`teams.secrets.list`

Gets all secrets for a team (metadata only, no plain text keys).

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.teams.secrets.list({ team_id: 'team1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `secrets` | `object[] \| null` | No | — |

> [accordion] secrets full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   created_at?: string | null,
>   name?: string | null,
>   team_name?: string | null
> }[] | null
> ```

***

### secrets.upsert

`teams.secrets.upsert`

Upserts a secret in a team. Creates a new secret or updates an existing secret if one with the provided name already exists. The name and creation date of the created or updated secret is returned. This secret belongs to the specified team. Replaces the value of an existing secret with the same name.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.teams.secrets.upsert({ team_id: 'team1234', name: 'example', value: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `name` | `string` | Yes | Name of the new or existing secret |
| `value` | `string` | Yes | Value of the secret |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Stable identifier for the secret. Unchanged across rotation. |
| `created_at` | `string \| null` | No | Time the secret was created in ISO 8601 format |
| `name` | `string \| null` | No | Name of the secret |
| `team_name` | `string \| null` | No | Name of the team the secret belongs to |

***

### trainingProjects.upsert

`teams.trainingProjects.upsert`

Upserts a training project in a specific team. Upserts a training project with the specified metadata for a team.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.teams.trainingProjects.upsert({
	team_id: 'team1234',
	training_project: { name: 'example' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | — |
| `training_project` | `object` | Yes | Fields that can be upserted on a training project. |

> [accordion] training\_project full type
>
> ```ts theme={null}
> {
>   name: string,
>   project_accelerator?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project` | `object \| null` | No | — |

> [accordion] training\_project full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   project_accelerator?: string | null | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   team_name?: string | null | null,
>   latest_job?: {
>     bdn?: {
>       mounts?: {
>         source?: string | null,
>         path?: string | null,
>         include?: string[] | null,
>         exclude?: string[] | null
>       }[] | null
>     } | null,
>     id?: string | null,
>     created_at?: string | null,
>     current_status?: string | null,
>     error_message?: string | null | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null,
>     node_count?: number | null,
>     updated_at?: string | null,
>     training_project_id?: string | null,
>     training_project?: {
>       id?: string | null,
>       name?: string | null
>     } | null,
>     name?: string | null | null,
>     checkpoint_sync_status?: string | null | null,
>     priority?: number | null,
>     availability_model?: string | null,
>     user?: {
>       email?: string | null | null
>     } | null | null
>   } | null | null
> } | null
> ```

***

## Training

### getCapacity

`training.getCapacity`

Gets training GPU capacity. Returns on-demand and spot GPU quotas and current usage for the teams you can view, plus organization-wide totals when you have organization-level access.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.getCapacity({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `gpu_capacities` | `object[] \| null` | No | Organization GPU quotas and current usage per GPU type |
| `team_gpu_capacities` | `object[] \| null` | No | Per-team GPU quotas and current usage per GPU type |
| `spot_enabled` | `boolean \| null` | No | Whether the organization can submit spot training jobs. |

> [accordion] gpu\_capacities full type
>
> ```ts theme={null}
> {
>   gpu_type?: string | null,
>   baseline?: number | null,
>   limit?: number | null,
>   on_demand_quota?: number | null,
>   spot_quota?: number | null | null,
>   usage_count?: number | null,
>   dedicated_usage_count?: number | null,
>   spot_usage_count?: number | null
> }[] | null
> ```

> [accordion] team\_gpu\_capacities full type
>
> ```ts theme={null}
> {
>   team_id?: string | null,
>   team_name?: string | null,
>   gpu_type?: string | null,
>   baseline?: number | null,
>   limit?: number | null,
>   usage_count?: number | null,
>   dedicated_usage_count?: number | null,
>   spot_usage_count?: number | null
> }[] | null
> ```

***

### jobs.create

`training.jobs.create`

Creates a training job. Creates a training job with the specified configuration.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.training.jobs.create({
	training_project_id: 'example',
	training_job: {
		image: { base_image: 'example' },
	},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job` | `object` | Yes | Configuration for a training job. |

> [accordion] training\_job full type
>
> ```ts theme={null}
> {
>   bdn?: {
>     mounts?: {
>       source: string,
>       path: string,
>       include?: string[],
>       exclude?: string[]
>     }[]
>   },
>   image: {
>     base_image: string,
>     docker_auth?: {
>       registry: string,
>       auth_method: GCP_SERVICE_ACCOUNT_JSON | AWS_IAM | AWS_OIDC | GCP_OIDC | REGISTRY_SECRET | AWS_ASSUME_ROLE,
>       gcp_service_account_json_docker_auth?: {
>         service_account_json_secret_ref: {
>           name: string
>         }
>       } | null,
>       aws_iam_docker_auth?: {
>         access_key_secret_ref: {
>           name: string
>         },
>         secret_access_key_secret_ref: {
>           name: string
>         }
>       } | null,
>       aws_oidc_docker_auth?: {
>         role_arn: string,
>         region: string
>       } | null,
>       gcp_oidc_docker_auth?: {
>         service_account: string,
>         workload_identity_provider: string
>       } | null,
>       registry_secret_docker_auth?: {
>         secret_ref: {
>           name: string
>         }
>       } | null,
>       aws_assume_role_docker_auth?: {
>         role_arn: string,
>         region: string
>       } | null
>     } | null
>   },
>   compute?: {
>     node_count?: number,
>     cpu_count?: number,
>     memory?: string,
>     accelerator?: {
>       accelerator: string,
>       count: number
>     } | null,
>     availability_model?: standard | spot
>   },
>   runtime?: {
>     start_commands?: string[],
>     environment_variables?: Record<string, string | {
>       name: string
>     }>,
>     artifacts?: {
>       s3_bucket: string,
>       s3_key: string
>     }[],
>     enable_cache?: boolean | null,
>     cache_config?: {
>       enable_legacy_hf_mount?: boolean,
>       enabled?: boolean,
>       require_cache_affinity?: boolean,
>       mount_base_path?: string,
>       persistent_home?: boolean
>     } | null,
>     checkpointing_config?: {
>       enabled?: boolean,
>       checkpoint_path?: string | null,
>       volume_size_gib?: number | null
>     },
>     load_checkpoint_config?: {
>       enabled?: boolean,
>       download_folder?: string,
>       checkpoints?: (
>         {
>           project_name?: string | null,
>           job_id?: string | null,
>           typ?: baseten_latest_checkpoint
>         } | {
>           checkpoint_name: string,
>           project_name?: string | null,
>           job_id?: string | null,
>           typ?: baseten_named_checkpoint
>         } | {
>           run_id: string,
>           checkpoint_name: string,
>           target?: trainer | sampler,
>           typ?: loops_checkpoint
>         }
>       )[]
>     } | null
>   },
>   name?: string | null,
>   truss_user_env?: {
>     truss_client_version?: string | null,
>     python_version?: string | null,
>     pydantic_version?: string | null,
>     mypy_version?: string | null,
>     is_library_deployment?: boolean,
>     is_frontend_deployment?: boolean,
>     git_info?: {
>       latest_commit_sha: string,
>       latest_tag: string | null,
>       commits_since_tag: number | null,
>       has_uncommitted_changes: boolean
>     } | null
>   } | null,
>   interactive_session?: {
>     trigger?: on_startup | on_failure | on_demand,
>     timeout_minutes?: number,
>     session_provider?: vs_code | cursor | ssh,
>     auth_provider?: github | microsoft
>   } | null,
>   weights?: {
>     source: string,
>     mount_location: string,
>     allow_patterns?: string[] | null,
>     ignore_patterns?: string[] | null,
>     auth_secret_name?: string | null,
>     auth?: {
>       auth_method: CUSTOM_SECRET | AWS_OIDC | GCP_OIDC | HUGGING_FACE_OIDC | AWS_ASSUME_ROLE,
>       auth_secret_name?: string | null,
>       aws_oidc_role_arn?: string | null,
>       aws_oidc_region?: string | null,
>       gcp_oidc_service_account?: string | null,
>       gcp_oidc_workload_id_provider?: string | null,
>       aws_assume_role_arn?: string | null,
>       aws_assume_role_region?: string | null
>     } | null
>   }[],
>   enable_baseten_workdir?: boolean,
>   priority?: number | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_job` | `object \| null` | No | — |

> [accordion] training\_job full type
>
> ```ts theme={null}
> {
>   bdn?: {
>     mounts?: {
>       source?: string | null,
>       path?: string | null,
>       include?: string[] | null,
>       exclude?: string[] | null
>     }[] | null
>   } | null,
>   id?: string | null,
>   created_at?: string | null,
>   current_status?: string | null,
>   error_message?: string | null | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   node_count?: number | null,
>   updated_at?: string | null,
>   training_project_id?: string | null,
>   training_project?: {
>     id?: string | null,
>     name?: string | null
>   } | null,
>   name?: string | null | null,
>   checkpoint_sync_status?: string | null | null,
>   priority?: number | null,
>   availability_model?: string | null,
>   user?: {
>     email?: string | null | null
>   } | null | null
> } | null
> ```

***

### jobs.delete

`training.jobs.delete`

Deletes a training job. Deletes a training job. Stops it first if still running. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.training.jobs.delete({ training_project_id: 'example', training_job_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the training job |
| `deleted` | `boolean \| null` | No | Whether the training job was deleted |
| `training_project_id` | `string \| null` | No | Unique identifier of the training project |

***

### jobs.get

`training.jobs.get`

Gets a training job. Gets the details of an existing training job.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.jobs.get({ training_project_id: 'example', training_job_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project` | `object \| null` | No | — |
| `training_job` | `object \| null` | No | — |

> [accordion] training\_project full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   project_accelerator?: string | null | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   team_name?: string | null | null,
>   latest_job?: {
>     bdn?: {
>       mounts?: {
>         source?: string | null,
>         path?: string | null,
>         include?: string[] | null,
>         exclude?: string[] | null
>       }[] | null
>     } | null,
>     id?: string | null,
>     created_at?: string | null,
>     current_status?: string | null,
>     error_message?: string | null | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null,
>     node_count?: number | null,
>     updated_at?: string | null,
>     training_project_id?: string | null,
>     training_project?: {
>       id?: string | null,
>       name?: string | null
>     } | null,
>     name?: string | null | null,
>     checkpoint_sync_status?: string | null | null,
>     priority?: number | null,
>     availability_model?: string | null,
>     user?: {
>       email?: string | null | null
>     } | null | null
>   } | null | null
> } | null
> ```

> [accordion] training\_job full type
>
> ```ts theme={null}
> {
>   bdn?: {
>     mounts?: {
>       source?: string | null,
>       path?: string | null,
>       include?: string[] | null,
>       exclude?: string[] | null
>     }[] | null
>   } | null,
>   id?: string | null,
>   created_at?: string | null,
>   current_status?: string | null,
>   error_message?: string | null | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   node_count?: number | null,
>   updated_at?: string | null,
>   training_project_id?: string | null,
>   training_project?: {
>     id?: string | null,
>     name?: string | null
>   } | null,
>   name?: string | null | null,
>   checkpoint_sync_status?: string | null | null,
>   priority?: number | null,
>   availability_model?: string | null,
>   user?: {
>     email?: string | null | null
>   } | null | null
> } | null
> ```

***

### jobs.getAuthCodes

`training.jobs.getAuthCodes`

Gets auth codes for a training job. Gets authentication codes for all nodes of a training job's interactive sessions.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.jobs.getAuthCodes({ training_project_id: 'example', training_job_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `auth_codes` | `object[] \| null` | No | List of auth codes for each node that has an active interactive session. |

> [accordion] auth\_codes full type
>
> ```ts theme={null}
> {
>   session_id?: string | null,
>   replica_id?: string | null,
>   auth_code?: string | null,
>   auth_url?: string | null,
>   generated_at?: string | null | null,
>   tunnel_name?: string | null | null,
>   expires_at?: string | null | null,
>   working_directory?: string | null | null
> }[] | null
> ```

***

### jobs.getCheckpointFiles

`training.jobs.getCheckpointFiles`

Gets training job checkpoint files. Gets presigned URLs for all checkpoint files for a training job.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.jobs.getCheckpointFiles({ training_project_id: 'example', training_job_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |
| `page_size` | `number` | No | Max files per page (default 1000). |
| `page_token` | `number` | No | Offset into the file list (default 0). |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `presigned_urls` | `object[] \| null` | No | List of presigned URLs for checkpoint files. |
| `next_page_token` | `number \| null \| null` | No | Token to use for fetching the next page of results. None when there are no more results. |
| `total_count` | `number \| null` | No | Total number of checkpoint files available. |

> [accordion] presigned\_urls full type
>
> ```ts theme={null}
> {
>   url?: string | null,
>   relative_file_name?: string | null,
>   node_rank?: number | null,
>   size_bytes?: number | null,
>   last_modified?: string | null
> }[] | null
> ```

***

### jobs.getDownloadUrls

`training.jobs.getDownloadUrls`

Gets presigned URLs for a training job's artifacts. Returns presigned S3 URLs for the artifacts uploaded by a training job.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.jobs.getDownloadUrls({ training_project_id: 'example', training_job_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `artifact_presigned_urls` | `string[] \| null` | No | Presigned URLs for the job's uploaded artifacts. |

***

### jobs.getLogs

`training.jobs.getLogs`

Gets the logs for a training job. Gets the logs for a training job with the provided filters.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.jobs.getLogs({ training_project_id: 'example', training_job_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |
| `start_epoch_millis` | `number \| null` | No | Epoch milliseconds at which to start fetching logs. Defaults to 30 minutes before the end. The window from start to end must not exceed 7 days. |
| `end_epoch_millis` | `number \| null` | No | Epoch milliseconds at which to stop fetching logs. Defaults to the current time. |
| `direction` | `asc \| desc \| null` | No | Sort order for logs |
| `limit` | `number \| null` | No | Limit of logs to fetch in a single request |
| `min_level` | `DEBUG \| INFO \| WARNING \| ERROR \| null` | No | Minimum log severity to include. Omit to return all log lines, including lines that have no level. Any explicit value returns lines at or above that severity and drops lines without a level. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `logs` | `object[] \| null` | No | Logs for a specific entity. |

> [accordion] logs full type
>
> ```ts theme={null}
> {
>   timestamp?: string | null,
>   message?: string | null,
>   replica?: string | null | null,
>   request_id?: string | null | null,
>   level?: string | null | null
> }[] | null
> ```

***

### jobs.getMetrics

`training.jobs.getMetrics`

Gets the metrics for a training job. (GET /v1/training\_projects/\{training\_project\_id}/jobs/\{training\_job\_id}/metrics)

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.jobs.getMetrics({ training_project_id: 'example', training_job_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |
| `end_epoch_millis` | `number \| null` | No | Epoch millis timestamp to end fetching metrics |
| `start_epoch_millis` | `number \| null` | No | Epoch millis timestamp to start fetching metrics. |
| `step_seconds` | `number \| null` | No | Resolution of the returned series, in seconds. When omitted, a step is derived from the time range so large windows return fewer points. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `gpu_memory_usage_bytes` | `object \| null` | No | A map of GPU rank to memory usage for the training job. At the top level of a multinode job this is the leader node; under per\_node\_metrics it is that node. |
| `gpu_utilization` | `object \| null` | No | A map of GPU rank to the share of time the GPU's streaming multiprocessors have work assigned, from 0 to 1. This counts any GPU work, not only tensor core math; see gpu\_tensor\_core\_utilization for that. At the top level of a multinode job this is the leader node; under per\_node\_metrics it is that node. |
| `gpu_temperature_celsius` | `object \| null` | No | A map of GPU rank to GPU temperature in degrees Celsius. At the top level of a multinode job this is the leader node; under per\_node\_metrics it is that node. |
| `gpu_power_usage_watts` | `object \| null` | No | A map of GPU rank to GPU power draw in watts. At the top level of a multinode job this is the leader node; under per\_node\_metrics it is that node. |
| `gpu_tensor_core_utilization` | `object \| null` | No | A map of GPU rank to the share of time the GPU tensor cores are active, from 0 to 1. At the top level of a multinode job this is the leader node; under per\_node\_metrics it is that node. |
| `gpu_memory_bandwidth_utilization` | `object \| null` | No | A map of GPU rank to the share of cycles GPU memory is actively reading or writing, from 0 to 1. At the top level of a multinode job this is the leader node; under per\_node\_metrics it is that node. |
| `cpu_usage` | `object[] \| null` | No | The CPU usage measured in cores. At the top level of a multinode job this is the leader node; under per\_node\_metrics it is that node. |
| `cpu_memory_usage_bytes` | `object[] \| null` | No | The CPU memory usage for the training job. At the top level of a multinode job this is the leader node; under per\_node\_metrics it is that node. |
| `ephemeral_storage` | `object \| null` | No | A metric for a training job. |
| `training_job` | `object \| null` | No | — |
| `cache` | `object \| null` | No | The storage usage for the read-write cache. |
| `per_node_metrics` | `object[] \| null` | No | The metrics for each node in the training job. |

> [accordion] gpu\_memory\_usage\_bytes full type
>
> ```ts theme={null}
> Record<string, {
>   value?: number | null,
>   timestamp?: string | null
> }[]> | null
> ```

> [accordion] gpu\_utilization full type
>
> ```ts theme={null}
> Record<string, {
>   value?: number | null,
>   timestamp?: string | null
> }[]> | null
> ```

> [accordion] gpu\_temperature\_celsius full type
>
> ```ts theme={null}
> Record<string, {
>   value?: number | null,
>   timestamp?: string | null
> }[]> | null
> ```

> [accordion] gpu\_power\_usage\_watts full type
>
> ```ts theme={null}
> Record<string, {
>   value?: number | null,
>   timestamp?: string | null
> }[]> | null
> ```

> [accordion] gpu\_tensor\_core\_utilization full type
>
> ```ts theme={null}
> Record<string, {
>   value?: number | null,
>   timestamp?: string | null
> }[]> | null
> ```

> [accordion] gpu\_memory\_bandwidth\_utilization full type
>
> ```ts theme={null}
> Record<string, {
>   value?: number | null,
>   timestamp?: string | null
> }[]> | null
> ```

> [accordion] cpu\_usage full type
>
> ```ts theme={null}
> {
>   value?: number | null,
>   timestamp?: string | null
> }[] | null
> ```

> [accordion] cpu\_memory\_usage\_bytes full type
>
> ```ts theme={null}
> {
>   value?: number | null,
>   timestamp?: string | null
> }[] | null
> ```

> [accordion] ephemeral\_storage full type
>
> ```ts theme={null}
> {
>   usage_bytes?: {
>     value?: number | null,
>     timestamp?: string | null
>   }[] | null,
>   utilization?: {
>     value?: number | null,
>     timestamp?: string | null
>   }[] | null
> } | null
> ```

> [accordion] training\_job full type
>
> ```ts theme={null}
> {
>   bdn?: {
>     mounts?: {
>       source?: string | null,
>       path?: string | null,
>       include?: string[] | null,
>       exclude?: string[] | null
>     }[] | null
>   } | null,
>   id?: string | null,
>   created_at?: string | null,
>   current_status?: string | null,
>   error_message?: string | null | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   node_count?: number | null,
>   updated_at?: string | null,
>   training_project_id?: string | null,
>   training_project?: {
>     id?: string | null,
>     name?: string | null
>   } | null,
>   name?: string | null | null,
>   checkpoint_sync_status?: string | null | null,
>   priority?: number | null,
>   availability_model?: string | null,
>   user?: {
>     email?: string | null | null
>   } | null | null
> } | null
> ```

> [accordion] cache full type
>
> ```ts theme={null}
> {
>   usage_bytes?: {
>     value?: number | null,
>     timestamp?: string | null
>   }[] | null,
>   utilization?: {
>     value?: number | null,
>     timestamp?: string | null
>   }[] | null
> } | null | null
> ```

> [accordion] per\_node\_metrics full type
>
> ```ts theme={null}
> {
>   node_id?: string | null,
>   metrics?: {
>     gpu_memory_usage_bytes?: Record<string, {
>       value?: number | null,
>       timestamp?: string | null
>     }[]> | null,
>     gpu_utilization?: Record<string, {
>       value?: number | null,
>       timestamp?: string | null
>     }[]> | null,
>     gpu_temperature_celsius?: Record<string, {
>       value?: number | null,
>       timestamp?: string | null
>     }[]> | null,
>     gpu_power_usage_watts?: Record<string, {
>       value?: number | null,
>       timestamp?: string | null
>     }[]> | null,
>     gpu_tensor_core_utilization?: Record<string, {
>       value?: number | null,
>       timestamp?: string | null
>     }[]> | null,
>     gpu_memory_bandwidth_utilization?: Record<string, {
>       value?: number | null,
>       timestamp?: string | null
>     }[]> | null,
>     cpu_usage?: {
>       value?: number | null,
>       timestamp?: string | null
>     }[] | null,
>     cpu_memory_usage_bytes?: {
>       value?: number | null,
>       timestamp?: string | null
>     }[] | null,
>     ephemeral_storage?: {
>       usage_bytes?: {
>         value?: number | null,
>         timestamp?: string | null
>       }[] | null,
>       utilization?: {
>         value?: number | null,
>         timestamp?: string | null
>       }[] | null
>     } | null
>   } | null
> }[] | null
> ```

***

### jobs.getQueueContext

`training.jobs.getQueueContext`

Reconstructs queue context for a training job. Returns the (org, gpu\_type) capacity pool the job was gated by, jobs that were holding GPU capacity in that pool when this job was submitted, and every TrainingJobStatus event in \[submitted\_at, released\_at] for those jobs, useful for understanding why a job sat in PENDING.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.jobs.getQueueContext({ training_job_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_job_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `target_job_id` | `string \| null` | No | Hashid of the target training job |
| `target_job_name` | `string \| null \| null` | No | Target job's name |
| `gpu_type` | `string \| null` | No | GPU type the target requested |
| `requested_gpus` | `number \| null` | No | GPUs the target requested (gpu\_count \* effective\_node\_count) |
| `submitted_at` | `string \| null` | No | When the job row was inserted (= API POST time) |
| `released_at` | `string \| null \| null` | No | When the job's TRAINING\_JOB\_CREATED status was set, i.e. the moment it was released from PENDING. None if still PENDING. |
| `pending_seconds` | `number \| null \| null` | No | released\_at - submitted\_at in seconds. None if still PENDING. |
| `org_capacity` | `object \| null` | No | Org-level cap for (org, gpu\_type). None if no cap is configured. |
| `team_capacity` | `object \| null` | No | Team-level cap for (team, gpu\_type). None if no team cap is configured. |
| `active_at_submit` | `object[] \| null` | No | Jobs in the same (org, gpu\_type) pool that were holding capacity at submitted\_at |
| `pending_ahead_at_submit` | `object[] \| null` | No | PENDING jobs in the same (org, gpu\_type) pool that were ahead of the target in dequeue FIFO order at submitted\_at (priority DESC then created ASC). These also block the target's release. |
| `events` | `object[] \| null` | No | Every status event in \[submitted\_at, events\_window\_end] for the target job, every job in active\_at\_submit, and every job in pending\_ahead\_at\_submit, oldest first. |
| `events_window_end` | `string \| null` | No | released\_at if set, else 'now' (events ongoing) |

> [accordion] org\_capacity full type
>
> ```ts theme={null}
> {
>   gpu_type?: string | null,
>   max_gpus?: number | null,
>   min_gpus?: number | null | null,
>   last_modified?: string | null
> } | null | null
> ```

> [accordion] team\_capacity full type
>
> ```ts theme={null}
> {
>   gpu_type?: string | null,
>   max_gpus?: number | null,
>   min_gpus?: number | null | null,
>   last_modified?: string | null
> } | null | null
> ```

> [accordion] active\_at\_submit full type
>
> ```ts theme={null}
> {
>   training_job_id?: string | null,
>   training_job_name?: string | null | null,
>   instance_type_name?: string | null,
>   total_gpus?: number | null,
>   workload_plane_name?: string | null,
>   status_at_submit?: string | null,
>   status_set_at?: string | null
> }[] | null
> ```

> [accordion] pending\_ahead\_at\_submit full type
>
> ```ts theme={null}
> {
>   training_job_id?: string | null,
>   training_job_name?: string | null | null,
>   instance_type_name?: string | null,
>   requested_gpus?: number | null,
>   priority?: number | null,
>   submitted_at?: string | null
> }[] | null
> ```

> [accordion] events full type
>
> ```ts theme={null}
> {
>   training_job_id?: string | null,
>   training_job_name?: string | null | null,
>   status?: string | null,
>   created?: string | null,
>   event_message?: string | null | null,
>   exit_code?: number | null | null
> }[] | null
> ```

***

### jobs.list

`training.jobs.list`

Lists training jobs. Lists the training project's jobs, newest first.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.jobs.list({ training_project_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `cursor` | `string \| null` | No | Opaque cursor from the pagination.cursor field of a previous response. Omit both cursor and limit to get every job in one response. |
| `limit` | `number \| null` | No | Maximum number of jobs to return, newest first, up to 1000. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project` | `object \| null` | No | — |
| `training_jobs` | `object[] \| null` | No | List of training jobs. |
| `pagination` | `object \| null` | No | — |

> [accordion] training\_project full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   project_accelerator?: string | null | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   team_name?: string | null | null,
>   latest_job?: {
>     bdn?: {
>       mounts?: {
>         source?: string | null,
>         path?: string | null,
>         include?: string[] | null,
>         exclude?: string[] | null
>       }[] | null
>     } | null,
>     id?: string | null,
>     created_at?: string | null,
>     current_status?: string | null,
>     error_message?: string | null | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null,
>     node_count?: number | null,
>     updated_at?: string | null,
>     training_project_id?: string | null,
>     training_project?: {
>       id?: string | null,
>       name?: string | null
>     } | null,
>     name?: string | null | null,
>     checkpoint_sync_status?: string | null | null,
>     priority?: number | null,
>     availability_model?: string | null,
>     user?: {
>       email?: string | null | null
>     } | null | null
>   } | null | null
> } | null
> ```

> [accordion] training\_jobs full type
>
> ```ts theme={null}
> {
>   bdn?: {
>     mounts?: {
>       source?: string | null,
>       path?: string | null,
>       include?: string[] | null,
>       exclude?: string[] | null
>     }[] | null
>   } | null,
>   id?: string | null,
>   created_at?: string | null,
>   current_status?: string | null,
>   error_message?: string | null | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   node_count?: number | null,
>   updated_at?: string | null,
>   training_project_id?: string | null,
>   training_project?: {
>     id?: string | null,
>     name?: string | null
>   } | null,
>   name?: string | null | null,
>   checkpoint_sync_status?: string | null | null,
>   priority?: number | null,
>   availability_model?: string | null,
>   user?: {
>     email?: string | null | null
>   } | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### jobs.listCheckpoints

`training.jobs.listCheckpoints`

Gets training job checkpoints. Gets the checkpoints for a training job.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.jobs.listCheckpoints({ training_project_id: 'example', training_job_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_job` | `object \| null` | No | — |
| `checkpoints` | `object[] \| null` | No | The checkpoints for the training job. |

> [accordion] training\_job full type
>
> ```ts theme={null}
> {
>   bdn?: {
>     mounts?: {
>       source?: string | null,
>       path?: string | null,
>       include?: string[] | null,
>       exclude?: string[] | null
>     }[] | null
>   } | null,
>   id?: string | null,
>   created_at?: string | null,
>   current_status?: string | null,
>   error_message?: string | null | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   node_count?: number | null,
>   updated_at?: string | null,
>   training_project_id?: string | null,
>   training_project?: {
>     id?: string | null,
>     name?: string | null
>   } | null,
>   name?: string | null | null,
>   checkpoint_sync_status?: string | null | null,
>   priority?: number | null,
>   availability_model?: string | null,
>   user?: {
>     email?: string | null | null
>   } | null | null
> } | null
> ```

> [accordion] checkpoints full type
>
> ```ts theme={null}
> {
>   checkpoint_id?: string | null,
>   checkpoint_name?: string | null,
>   created_at?: string | null,
>   checkpoint_type?: string | null,
>   base_model?: string | null | null,
>   lora_adapter_config?: {
>   } | null | null,
>   size_bytes?: number | null,
>   sync_status?: string | null | null,
>   id?: string | null,
>   training_job_id?: string | null,
>   expires_at?: string | null | null
> }[] | null
> ```

***

### jobs.recreate

`training.jobs.recreate`

Recreates a training job. Creates a new training job with the same configuration as an existing training job.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.training.jobs.recreate({ training_project_id: 'example', training_job_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_job` | `object \| null` | No | — |

> [accordion] training\_job full type
>
> ```ts theme={null}
> {
>   bdn?: {
>     mounts?: {
>       source?: string | null,
>       path?: string | null,
>       include?: string[] | null,
>       exclude?: string[] | null
>     }[] | null
>   } | null,
>   id?: string | null,
>   created_at?: string | null,
>   current_status?: string | null,
>   error_message?: string | null | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   node_count?: number | null,
>   updated_at?: string | null,
>   training_project_id?: string | null,
>   training_project?: {
>     id?: string | null,
>     name?: string | null
>   } | null,
>   name?: string | null | null,
>   checkpoint_sync_status?: string | null | null,
>   priority?: number | null,
>   availability_model?: string | null,
>   user?: {
>     email?: string | null | null
>   } | null | null
> } | null
> ```

***

### jobs.search

`training.jobs.search`

Searches training jobs. Searches training jobs for the organization. Send the same filters with every page.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.jobs.search({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `project_id` | `string \| null` | No | Filter the training jobs by project ID. |
| `job_id` | `string \| null` | No | Filter the training jobs by job ID. |
| `statuses` | `string[] \| null` | No | Filter the training jobs by status. |
| `order_by` | `object[]` | No | Order the training jobs by a field. Currently supports created\_at |

> [accordion] order\_by full type
>
> ```ts theme={null}
> {
>   field: string,
>   order: string
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_jobs` | `object[] \| null` | No | List of training jobs. |
| `pagination` | `object \| null` | No | — |

> [accordion] training\_jobs full type
>
> ```ts theme={null}
> {
>   bdn?: {
>     mounts?: {
>       source?: string | null,
>       path?: string | null,
>       include?: string[] | null,
>       exclude?: string[] | null
>     }[] | null
>   } | null,
>   id?: string | null,
>   created_at?: string | null,
>   current_status?: string | null,
>   error_message?: string | null | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   node_count?: number | null,
>   updated_at?: string | null,
>   training_project_id?: string | null,
>   training_project?: {
>     id?: string | null,
>     name?: string | null
>   } | null,
>   name?: string | null | null,
>   checkpoint_sync_status?: string | null | null,
>   priority?: number | null,
>   availability_model?: string | null,
>   user?: {
>     email?: string | null | null
>   } | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### jobs.setCheckpointTtl

`training.jobs.setCheckpointTtl`

Sets a training job checkpoint's TTL. Sets when a training job checkpoint expires, counted from now, or removes its TTL so it never expires. Once a job stops, a TTL can be set only after its checkpoint upload is confirmed as finished, which usually takes a few minutes.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.training.jobs.setCheckpointTtl({
	training_project_id: 'example',
	training_job_id: 'example',
	checkpoint_id: 'example',
	ttl_seconds: 3600,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |
| `checkpoint_id` | `string` | Yes | — |
| `ttl_seconds` | `number \| null` | Yes | Seconds from now until the checkpoint expires and is deleted, from 3600 (1 hour) to 315360000 (10 years). Null removes the TTL, so the checkpoint never expires. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `checkpoint_id` | `string \| null` | No | Deprecated: use `checkpoint_name`, which has the same value. |
| `checkpoint_name` | `string \| null` | No | The checkpoint's name, for example `checkpoint-500`. To refer to the checkpoint in a URL, use its `id`. |
| `created_at` | `string \| null` | No | The timestamp of the checkpoint in ISO 8601 format. |
| `checkpoint_type` | `string \| null` | No | The type of checkpoint. |
| `base_model` | `string \| null \| null` | No | The base model of the checkpoint. |
| `lora_adapter_config` | `object \| null` | No | The adapter config of the checkpoint. |
| `size_bytes` | `number \| null` | No | The size of the checkpoint in bytes. |
| `sync_status` | `string \| null \| null` | No | Sync state of the checkpoint: SYNCING or COMPLETE. |
| `id` | `string \| null` | No | The checkpoint's unique ID, used in checkpoint URLs. |
| `training_job_id` | `string \| null` | No | The ID of the training job. |
| `expires_at` | `string \| null \| null` | No | When the checkpoint expires and is deleted. Null means it never expires. |

> [accordion] lora\_adapter\_config full type
>
> ```ts theme={null}
> {
> } | null | null
> ```

***

### jobs.signSshCertificate

`training.jobs.signSshCertificate`

Signs an SSH certificate for a training job. Signs a short-lived SSH certificate granting access to a specific training job pod. Returns the signed SSH certificate, a JWT token for SSH proxy authentication, the proxy address to connect through, and the certificate expiry time.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.training.jobs.signSshCertificate({ training_project_id: 'example', training_job_id: 'example', public_key: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |
| `public_key` | `string` | Yes | The user's SSH public key (e.g., 'ssh-ed25519 AAAA... user\@host'). |
| `replica_id` | `string \| null` | No | The replica to connect to. Required for training jobs (e.g. '0'). Optional for inference (server picks a running replica if omitted). |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ssh_certificate` | `string \| null` | No | The signed SSH certificate in OpenSSH format. |
| `jwt` | `string \| null` | No | Signed JWT (ES256) for SSH proxy authorization. |
| `proxy_address` | `string \| null` | No | Address of the SSH proxy to connect to (host:port). |
| `ssh_cert_expires_at` | `string \| null` | No | When the certificate expires, in ISO 8601 format. |

***

### jobs.stop

`training.jobs.stop`

Stops a training job. (POST /v1/training\_projects/\{training\_project\_id}/jobs/\{training\_job\_id}/stop)

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.training.jobs.stop({ training_project_id: 'example', training_job_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_job` | `object \| null` | No | — |

> [accordion] training\_job full type
>
> ```ts theme={null}
> {
>   bdn?: {
>     mounts?: {
>       source?: string | null,
>       path?: string | null,
>       include?: string[] | null,
>       exclude?: string[] | null
>     }[] | null
>   } | null,
>   id?: string | null,
>   created_at?: string | null,
>   current_status?: string | null,
>   error_message?: string | null | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   node_count?: number | null,
>   updated_at?: string | null,
>   training_project_id?: string | null,
>   training_project?: {
>     id?: string | null,
>     name?: string | null
>   } | null,
>   name?: string | null | null,
>   checkpoint_sync_status?: string | null | null,
>   priority?: number | null,
>   availability_model?: string | null,
>   user?: {
>     email?: string | null | null
>   } | null | null
> } | null
> ```

***

### jobs.update

`training.jobs.update`

Updates a training job. Updates mutable fields on a PENDING training job: the queue priority (higher priorities are dequeued first) and the availability model (standard or spot capacity). Changes take effect on the next queue evaluation, which is triggered immediately.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.training.jobs.update({ training_project_id: 'example', training_job_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |
| `priority` | `number \| null` | No | New queue priority for a PENDING training job. Higher values are dequeued first. Only jobs in the PENDING state can have their priority changed. |
| `availability_model` | `standard \| spot \| null` | No | New capacity guarantee for a PENDING training job. 'standard' runs on capacity that is not preempted. 'spot' runs on interruptible capacity that may be preempted; you are responsible for checkpointing your own progress. Only jobs in the PENDING state can have their availability model changed. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_job` | `object \| null` | No | — |

> [accordion] training\_job full type
>
> ```ts theme={null}
> {
>   bdn?: {
>     mounts?: {
>       source?: string | null,
>       path?: string | null,
>       include?: string[] | null,
>       exclude?: string[] | null
>     }[] | null
>   } | null,
>   id?: string | null,
>   created_at?: string | null,
>   current_status?: string | null,
>   error_message?: string | null | null,
>   instance_type?: {
>     id?: string | null,
>     name?: string | null,
>     memory_limit_mib?: number | null,
>     millicpu_limit?: number | null,
>     gpu_count?: number | null,
>     gpu_type?: string | null | null,
>     gpu_memory_limit_mib?: number | null | null
>   } | null,
>   node_count?: number | null,
>   updated_at?: string | null,
>   training_project_id?: string | null,
>   training_project?: {
>     id?: string | null,
>     name?: string | null
>   } | null,
>   name?: string | null | null,
>   checkpoint_sync_status?: string | null | null,
>   priority?: number | null,
>   availability_model?: string | null,
>   user?: {
>     email?: string | null | null
>   } | null | null
> } | null
> ```

***

### jobs.updateInteractiveSession

`training.jobs.updateInteractiveSession`

Patches an interactive session. Updates specific fields on a training job's interactive session. Only provided (non-null) fields are updated.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.training.jobs.updateInteractiveSession({ training_project_id: 'example', training_job_id: 'example', session_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |
| `training_job_id` | `string` | Yes | — |
| `session_id` | `string` | Yes | — |
| `timeout_minutes` | `number \| null` | No | For on\_startup sessions, minutes to add to the expiration. For on\_demand/on\_failure sessions, minutes to add to the timeout. Use -1 for infinite timeout (bumps by 10 years). |
| `trigger` | `on_startup \| on_failure \| on_demand \| null` | No | Update when the interactive session is created. Cannot be changed if the session trigger is 'on\_startup'. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `interactive_session` | `object \| null` | No | Representation of a training job interactive session. |
| `message` | `string \| null` | No | Human-readable summary of what was updated. |

> [accordion] interactive\_session full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   trigger?: string | null,
>   timeout_minutes?: number | null,
>   session_provider?: string | null,
>   auth_provider?: string | null,
>   pod_name?: string | null,
>   expires_at?: string | null | null,
>   tunnel_name?: string | null | null,
>   auth_code?: string | null | null,
>   auth_url?: string | null | null,
>   auth_code_generated_at?: string | null | null,
>   authenticated_at?: string | null | null,
>   working_directory?: string | null | null
> } | null
> ```

***

### projects.delete

`training.projects.delete`

Deletes a training project. Deletes a training project and all associated training jobs. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.training.projects.delete({ training_project_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | Unique identifier of the training project |
| `deleted` | `boolean \| null` | No | Whether the training project was deleted |

***

### projects.get

`training.projects.get`

Gets a training project. Gets the details of an existing training project.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.projects.get({ training_project_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project` | `object \| null` | No | — |

> [accordion] training\_project full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   project_accelerator?: string | null | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   team_name?: string | null | null,
>   latest_job?: {
>     bdn?: {
>       mounts?: {
>         source?: string | null,
>         path?: string | null,
>         include?: string[] | null,
>         exclude?: string[] | null
>       }[] | null
>     } | null,
>     id?: string | null,
>     created_at?: string | null,
>     current_status?: string | null,
>     error_message?: string | null | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null,
>     node_count?: number | null,
>     updated_at?: string | null,
>     training_project_id?: string | null,
>     training_project?: {
>       id?: string | null,
>       name?: string | null
>     } | null,
>     name?: string | null | null,
>     checkpoint_sync_status?: string | null | null,
>     priority?: number | null,
>     availability_model?: string | null,
>     user?: {
>       email?: string | null | null
>     } | null | null
>   } | null | null
> } | null
> ```

***

### projects.getCacheSummary

`training.projects.getCacheSummary`

Gets training project cache summary. Gets the cache summary for the most recent training job in the project.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.projects.getCacheSummary({ training_project_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `timestamp` | `string \| null` | No | Timestamp when the cache summary was captured |
| `project_id` | `string \| null` | No | Project ID associated with the cache |
| `file_summaries` | `object[] \| null` | No | List of files in the cache |

> [accordion] file\_summaries full type
>
> ```ts theme={null}
> {
>   path?: string | null,
>   size_bytes?: number | null,
>   modified?: string | null,
>   file_type?: string | null,
>   permissions?: string | null
> }[] | null
> ```

***

### projects.list

`training.projects.list`

Lists training projects. Lists the organization's training projects, newest first.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.training.projects.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string \| null` | No | Return only the project with this exact name. |
| `cursor` | `string \| null` | No | Opaque cursor from the pagination.cursor field of a previous response. Omit both cursor and limit to get every project in one response. |
| `limit` | `number \| null` | No | Maximum number of projects to return, up to 1000. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_projects` | `object[] \| null` | No | List of training projects. |
| `pagination` | `object \| null` | No | — |

> [accordion] training\_projects full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   project_accelerator?: string | null | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   team_name?: string | null | null,
>   latest_job?: {
>     bdn?: {
>       mounts?: {
>         source?: string | null,
>         path?: string | null,
>         include?: string[] | null,
>         exclude?: string[] | null
>       }[] | null
>     } | null,
>     id?: string | null,
>     created_at?: string | null,
>     current_status?: string | null,
>     error_message?: string | null | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null,
>     node_count?: number | null,
>     updated_at?: string | null,
>     training_project_id?: string | null,
>     training_project?: {
>       id?: string | null,
>       name?: string | null
>     } | null,
>     name?: string | null | null,
>     checkpoint_sync_status?: string | null | null,
>     priority?: number | null,
>     availability_model?: string | null,
>     user?: {
>       email?: string | null | null
>     } | null | null
>   } | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### projects.upsert

`training.projects.upsert`

Upserts a training project. Upserts a training project with the specified metadata.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.training.projects.upsert({
	training_project: { name: 'example' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project` | `object` | Yes | Fields that can be upserted on a training project. |

> [accordion] training\_project full type
>
> ```ts theme={null}
> {
>   name: string,
>   project_accelerator?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `training_project` | `object \| null` | No | — |

> [accordion] training\_project full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   project_accelerator?: string | null | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   team_name?: string | null | null,
>   latest_job?: {
>     bdn?: {
>       mounts?: {
>         source?: string | null,
>         path?: string | null,
>         include?: string[] | null,
>         exclude?: string[] | null
>       }[] | null
>     } | null,
>     id?: string | null,
>     created_at?: string | null,
>     current_status?: string | null,
>     error_message?: string | null | null,
>     instance_type?: {
>       id?: string | null,
>       name?: string | null,
>       memory_limit_mib?: number | null,
>       millicpu_limit?: number | null,
>       gpu_count?: number | null,
>       gpu_type?: string | null | null,
>       gpu_memory_limit_mib?: number | null | null
>     } | null,
>     node_count?: number | null,
>     updated_at?: string | null,
>     training_project_id?: string | null,
>     training_project?: {
>       id?: string | null,
>       name?: string | null
>     } | null,
>     name?: string | null | null,
>     checkpoint_sync_status?: string | null | null,
>     priority?: number | null,
>     availability_model?: string | null,
>     user?: {
>       email?: string | null | null
>     } | null | null
>   } | null | null
> } | null
> ```

***

### setCapacity

`training.setCapacity`

Sets a team's training GPU quota. Sets a team's GPU quota for a given type. It counts the team's on-demand jobs, plus its spot jobs when the organization has no separate on-demand quota, and on-demand jobs can borrow past it from the organization's shared pool when one exists.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.training.setCapacity({ team_id: 'team1234', gpu_type: 'example', max_gpus: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_id` | `string` | Yes | Team identifier |
| `gpu_type` | `string` | Yes | GPU type identifier (e.g. H100, A100-40GB) |
| `max_gpus` | `number` | Yes | The team's GPU quota for this type. It counts the team's on-demand jobs, plus its spot jobs when the organization has no separate on-demand quota. On-demand jobs can run past it by borrowing from the organization's shared pool, when one exists. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `team_gpu_capacity` | `object \| null` | No | Per-team GPU capacity and current usage for one GPU type. |

> [accordion] team\_gpu\_capacity full type
>
> ```ts theme={null}
> {
>   team_id?: string | null,
>   team_name?: string | null,
>   gpu_type?: string | null,
>   baseline?: number | null,
>   limit?: number | null,
>   usage_count?: number | null,
>   dedicated_usage_count?: number | null,
>   spot_usage_count?: number | null
> } | null
> ```

***

## Users

### get

`users.get`

Gets a user by ID. Returns info about a user in the caller's workspace.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.users.get({ user_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_id` | `string \| null` | No | Unique identifier for the user |
| `email` | `string \| null \| null` | No | Email address of the user |
| `name` | `string \| null \| null` | No | Display name of the user |
| `workspace_name` | `string \| null \| null` | No | Name of the user's workspace |

***

### getAccess

`users.getAccess`

Gets a user's roles and the permissions they grant. Needs access.member.read for the organization.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.users.getAccess({ user_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subject_type` | `string \| null` | No | Who holds a role. |
| `subject_id` | `string \| null` | No | ID of the user or service account |
| `subject_name` | `string \| null` | No | Name of the user or service account |
| `assignments` | `object[] \| null` | No | Every role held: assigned to the user or service account, or to a directory group it is in, or held through organization or team membership |
| `permissions` | `object[] \| null` | No | Every permission held, and where. Null until fine-grained authorization decides your organization's requests. |

> [accordion] assignments full type
>
> ```ts theme={null}
> {
>   id?: string | null | null,
>   granted_via?: string | null,
>   role_id?: string | null,
>   role_name?: string | null,
>   subject_type?: string | null,
>   subject_id?: string | null,
>   subject_name?: string | null,
>   team_id?: string | null | null,
>   team_name?: string | null | null,
>   resource_sets?: {
>     all_of?: {
>       type?: string | null,
>       identifier?: string | null
>     }[] | null
>   }[] | null,
>   created_by?: string | null | null,
>   created_at?: string | null | null
> }[] | null
> ```

> [accordion] permissions full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   display_name?: string | null,
>   category?: string | null,
>   grants?: {
>     team_id?: string | null | null,
>     team_name?: string | null | null,
>     resource_set?: {
>       type?: string | null,
>       identifier?: string | null
>     }[] | null
>   }[] | null
> }[] | null | null
> ```

***

### getMe

`users.getMe`

Gets the authenticated user. Returns info about the user making the request.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.users.getMe({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_id` | `string \| null` | No | Unique identifier for the user |
| `email` | `string \| null \| null` | No | Email address of the user |
| `name` | `string \| null \| null` | No | Display name of the user |
| `workspace_name` | `string \| null \| null` | No | Name of the user's workspace |

***

### getMyAccess

`users.getMyAccess`

Gets your roles and the permissions they grant. Lists every role you hold: assigned to you or a directory group you're in, or held through organization and team membership. Users and service accounts can call it. Once fine-grained authorization decides your organization's requests, it needs access.self.read.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.users.getMyAccess({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subject_type` | `string \| null` | No | Who holds a role. |
| `subject_id` | `string \| null` | No | ID of the user or service account |
| `subject_name` | `string \| null` | No | Name of the user or service account |
| `assignments` | `object[] \| null` | No | Every role held: assigned to the user or service account, or to a directory group it is in, or held through organization or team membership |
| `permissions` | `object[] \| null` | No | Every permission held, and where. Null until fine-grained authorization decides your organization's requests. |

> [accordion] assignments full type
>
> ```ts theme={null}
> {
>   id?: string | null | null,
>   granted_via?: string | null,
>   role_id?: string | null,
>   role_name?: string | null,
>   subject_type?: string | null,
>   subject_id?: string | null,
>   subject_name?: string | null,
>   team_id?: string | null | null,
>   team_name?: string | null | null,
>   resource_sets?: {
>     all_of?: {
>       type?: string | null,
>       identifier?: string | null
>     }[] | null
>   }[] | null,
>   created_by?: string | null | null,
>   created_at?: string | null | null
> }[] | null
> ```

> [accordion] permissions full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   display_name?: string | null,
>   category?: string | null,
>   grants?: {
>     team_id?: string | null | null,
>     team_name?: string | null | null,
>     resource_set?: {
>       type?: string | null,
>       identifier?: string | null
>     }[] | null
>   }[] | null
> }[] | null | null
> ```

***

### list

`users.list`

Lists users in the workspace. Returns the workspace's members. Only actual joined members are returned; service accounts, invited users, and pending join requests are excluded.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.users.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `email` | `string \| null` | No | When set, returns only users with this exact email, if any. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   user_id?: string | null,
>   email?: string | null | null,
>   name?: string | null | null,
>   workspace_name?: string | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

## Volumes

### createAccessToken

`volumes.createAccessToken`

Creates a volume access token. Exchanges your API key for a short-lived token that authenticates against Baseten volume storage. A volume token is needed only to push and pull volume data; other volume operations use your API key directly.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.volumes.createAccessToken({
	scopes: ['PULL'],
	namespaces: ['example'],
	volumes: ['example'],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosting` | `BASETEN_CLOUD \| SINGLE_TENANT \| SELF_HOSTED \| null` | No | Where the volumes are stored. Defaults to your organization's hosting when it has one, and is required when it has more than one. |
| `scopes` | `(PULL \| INSPECT \| PUSH \| TAG)[]` | Yes | Capabilities the token grants, at least one. Requesting PUSH or TAG requires organization-level model management permission. |
| `namespaces` | `string[]` | Yes | Volume namespaces the token is limited to, lowercase ASCII, at least one. Pass only the namespaces the operation needs. |
| `volumes` | `string[]` | Yes | Volume names the token is limited to, lowercase ASCII, exact names only, at least one. The limit applies to every requested scope in every requested namespace. |
| `correlation_id` | `string \| null` | No | Optional client-chosen identifier, at most 128 printable ASCII characters. Echoed into server logs to link the issued token to a client operation. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `token` | `string \| null` | No | Volume access token. Pass as a bearer token to the volume APIs. |
| `expires_at` | `string \| null` | No | Token expiry in ISO 8601 format. Tokens cannot be renewed; exchange again for a fresh token. |
| `scopes` | `string[] \| null` | No | Effective capabilities granted. |
| `namespaces` | `string[] \| null` | No | Effective namespaces granted, in canonical lowercase form. |
| `volumes` | `string[] \| null` | No | Effective volume names granted, in canonical lowercase form. |
| `hosting` | `string \| null` | No | Where volumes are stored. The same name under two hostings is two different volumes. - `BASETEN_CLOUD`: Baseten's shared fleet. - `SINGLE_TENANT`: your organization's single-tenant workload planes. - `SELF_HOSTED`: workload planes in your own cloud account. |
| `bdn_endpoint` | `string \| null \| null` | No | Base URL of the volume API this token authenticates against. Null when the environment does not expose a public volume API yet. |

***

### delete

`volumes.delete`

Deletes a volume. Deletes every live version of the volume, after which the volume stops appearing in listings. The data is not erased: each version stays restorable until its recovery deadline passes, and the versions sub-resource still reports them when you pass include\_tombstoned. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.volumes.delete({ volume_namespace: 'example', volume_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_namespace` | `string` | Yes | — |
| `volume_name` | `string` | Yes | — |
| `hosting` | `BASETEN_CLOUD \| SINGLE_TENANT \| SELF_HOSTED \| null` | No | Where the volumes are stored. Defaults to your organization's hosting when it has one, and is required when it has more than one. |
| `expected_sequence` | `number \| null` | No | Revision the volume is expected to be at. When set, the delete fails with a conflict if the volume has changed since, so it cannot act on a volume someone else has pushed to. Take the value from a volume's sequence, or from volume\_sequence. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `namespace` | `string \| null` | No | Namespace the volume belongs to, in lowercase. |
| `name` | `string \| null` | No | Name of the volume, in lowercase. |
| `versions_deleted` | `number \| null` | No | Number of versions this request deleted. Zero when the volume had no live versions left, which is not an error. |
| `volume_sequence` | `number \| null` | No | Revision of the volume after the delete. |

***

### get

`volumes.get`

Gets a volume. Returns a volume with its tags, head version, version counts, and any scheduled expiry. Versions live on the versions sub-resource so they can be paged separately. A volume whose versions have all been deleted or have expired is still returned, with zero live versions.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.volumes.get({ volume_namespace: 'example', volume_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_namespace` | `string` | Yes | — |
| `volume_name` | `string` | Yes | — |
| `hosting` | `BASETEN_CLOUD \| SINGLE_TENANT \| SELF_HOSTED \| null` | No | Where the volumes are stored. Defaults to your organization's hosting when it has one, and is required when it has more than one. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `namespace` | `string \| null` | No | Namespace the volume belongs to, in lowercase. |
| `name` | `string \| null` | No | Name of the volume, in lowercase. |
| `version_ref` | `string \| null` | No | Full address of the volume, as `bdn:<namespace>/<volume>`. Paste this into the `bdn.mounts` section of a config.yaml. |
| `sequence` | `number \| null` | No | Revision counter for the volume, incremented on every commit, tag change, delete, and restore. A tag or version that expires leaves without changing it; the next write then increments it once. Use it to detect that a volume was written to. |
| `updated_at` | `string \| null` | No | When the volume was last written to, in ISO 8601 format. An expiry does not update it. |
| `expires_at` | `string \| null \| null` | No | When the whole volume expires, in ISO 8601 format. At that instant every live version is deleted, every tag drops, and the volume leaves the volume listing; each version then stays restorable until its recovery deadline passes. Null for a volume that never expires. |
| `head` | `object \| null` | No | Version that the reserved `head` tag points at, which a reference with no tag or digest resolves to. Never an expiring version. Null when the volume has no head, or when your API key cannot read it. |
| `tags` | `object[] \| null` | No | Tags on the volume that your API key can read. A tag with `expires_at` leaves this list at that instant. |
| `tag_count` | `number \| null` | No | Total number of tags on the volume, which can exceed the length of `tags` when your API key cannot read all of them. Counts only tags that have not expired. |
| `versions_alive` | `number \| null` | No | Number of versions that have not been deleted or expired. |
| `versions_tombstoned` | `number \| null` | No | Number of versions that have been deleted or expired and are still within their recovery window. |
| `versions_untagged` | `number \| null` | No | Number of live versions that no tag points at. |
| `versions_expiring` | `number \| null` | No | Number of live versions with an expiry still ahead of them. A version that has already expired counts in `versions_tombstoned` instead. |
| `versions_earliest_expires_at` | `string \| null \| null` | No | Earliest expiry among the live versions, in ISO 8601 format. Null when no live version is scheduled to expire. |

> [accordion] head full type
>
> ```ts theme={null}
> {
>   digest?: string | null,
>   total_size_bytes?: number | null,
>   created_at?: string | null
> } | null | null
> ```

> [accordion] tags full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   digest?: string | null,
>   expires_at?: string | null | null
> }[] | null
> ```

***

### list

`volumes.list`

Gets the volumes in a namespace. Returns one row per volume in the namespace, each with its tags, head version, version counts, and any scheduled expiry. Pass namespace to choose the namespace, which is required because the volume service has no cross-namespace inventory.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.volumes.list({ namespace: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosting` | `BASETEN_CLOUD \| SINGLE_TENANT \| SELF_HOSTED \| null` | No | Where the volumes are stored. Defaults to your organization's hosting when it has one, and is required when it has more than one. |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of volumes to return. |
| `namespace` | `string` | Yes | Namespace to list volumes in. Required, because the volume service has no cross-namespace inventory. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   namespace?: string | null,
>   name?: string | null,
>   version_ref?: string | null,
>   sequence?: number | null,
>   updated_at?: string | null,
>   expires_at?: string | null | null,
>   head?: {
>     digest?: string | null,
>     total_size_bytes?: number | null,
>     created_at?: string | null
>   } | null | null,
>   tags?: {
>     name?: string | null,
>     digest?: string | null,
>     expires_at?: string | null | null
>   }[] | null,
>   tag_count?: number | null,
>   versions_alive?: number | null,
>   versions_tombstoned?: number | null,
>   versions_untagged?: number | null,
>   versions_expiring?: number | null,
>   versions_earliest_expires_at?: string | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### listNamespaces

`volumes.listNamespaces`

Gets the volume namespaces in your workspace. Returns the namespaces that hold volumes your API key can read, in lowercase. Namespaces are not created directly: a namespace comes into existence when the first volume is pushed into it.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.volumes.listNamespaces({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosting` | `BASETEN_CLOUD \| SINGLE_TENANT \| SELF_HOSTED \| null` | No | Where the volumes are stored. Defaults to your organization's hosting when it has one, and is required when it has more than one. |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of namespaces to return. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `string[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### syncs.cancel

`volumes.syncs.cancel`

Cancels a volume sync. Requests cancellation of a pending or running sync. Repeated cancellation and cancellation of terminal syncs return the existing state. Once cancellation is accepted, a later completion callback cannot replace the CANCELED state.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.volumes.syncs.cancel({ volume_sync_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_sync_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sync_id` | `string \| null` | No | Identifier of this sync operation. |
| `status` | `string \| null` | No | — |
| `source` | `object \| null` | No | Remote source being synced. |
| `destination` | `object \| null` | No | BDN destination for a volume sync. |
| `volume_version_id` | `string \| null \| null` | No | Produced artifact identifier; null until the sync is ready. |
| `version_ref` | `string \| null \| null` | No | Immutable BDN reference; null until the sync is ready. |
| `content_digest` | `string \| null \| null` | No | BLAKE3 digest of the synced content; null until available. |
| `total_size_bytes` | `number \| null \| null` | No | Total size of the synced content in bytes; null until available. |
| `created_at` | `string \| null` | No | Time at which the sync was created. |
| `completed_at` | `string \| null \| null` | No | Time at which the sync reached a terminal state. |
| `error` | `object \| null` | No | Redacted failure details; null unless the sync failed. |

> [accordion] source full type
>
> ```ts theme={null}
> {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null,
>   hf_oidc?: {
>     resource?: string | null
>   } | null | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null,
>   aws_assume_role?: {
>     role_arn?: string | null,
>     region?: string | null
>   } | null | null,
>   aws_oidc?: {
>     role_arn?: string | null,
>     region?: string | null
>   } | null | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null,
>   gcp_oidc?: {
>     service_account?: string | null,
>     workload_identity_provider?: string | null
>   } | null | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   type?: string | null
> } | null
> ```

> [accordion] destination full type
>
> ```ts theme={null}
> {
>   ref?: string | null
> } | null
> ```

> [accordion] error full type
>
> ```ts theme={null}
> {
>   code?: string | null,
>   message?: string | null
> } | null | null
> ```

***

### syncs.get

`volumes.syncs.get`

Gets a volume sync. (GET /v1/volumes/syncs/\{volume\_sync\_id})

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.volumes.syncs.get({ volume_sync_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_sync_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sync_id` | `string \| null` | No | Identifier of this sync operation. |
| `status` | `string \| null` | No | — |
| `source` | `object \| null` | No | Remote source being synced. |
| `destination` | `object \| null` | No | BDN destination for a volume sync. |
| `volume_version_id` | `string \| null \| null` | No | Produced artifact identifier; null until the sync is ready. |
| `version_ref` | `string \| null \| null` | No | Immutable BDN reference; null until the sync is ready. |
| `content_digest` | `string \| null \| null` | No | BLAKE3 digest of the synced content; null until available. |
| `total_size_bytes` | `number \| null \| null` | No | Total size of the synced content in bytes; null until available. |
| `created_at` | `string \| null` | No | Time at which the sync was created. |
| `completed_at` | `string \| null \| null` | No | Time at which the sync reached a terminal state. |
| `error` | `object \| null` | No | Redacted failure details; null unless the sync failed. |

> [accordion] source full type
>
> ```ts theme={null}
> {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null,
>   hf_oidc?: {
>     resource?: string | null
>   } | null | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null,
>   aws_assume_role?: {
>     role_arn?: string | null,
>     region?: string | null
>   } | null | null,
>   aws_oidc?: {
>     role_arn?: string | null,
>     region?: string | null
>   } | null | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null,
>   gcp_oidc?: {
>     service_account?: string | null,
>     workload_identity_provider?: string | null
>   } | null | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   type?: string | null
> } | null
> ```

> [accordion] destination full type
>
> ```ts theme={null}
> {
>   ref?: string | null
> } | null
> ```

> [accordion] error full type
>
> ```ts theme={null}
> {
>   code?: string | null,
>   message?: string | null
> } | null | null
> ```

***

### syncs.list

`volumes.syncs.list`

Lists volume syncs. Lists volume syncs in the active workspace, newest first. Results may be narrowed by an exact destination ref.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.volumes.syncs.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `cursor` | `string \| null` | No | Opaque cursor returned by a previous page. Omit to fetch the first page. |
| `limit` | `number` | No | Maximum number of items to return. |
| `ref` | `string \| null` | No | Exact destination reference to match. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[] \| null` | No | Items in this page. |
| `pagination` | `object \| null` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   sync_id?: string | null,
>   status?: string | null,
>   source?: {
>     uri?: string | null,
>     include?: string[] | null,
>     exclude?: string[] | null,
>     auth_secret_name?: string | null | null,
>     type?: string | null,
>     hf_oidc?: {
>       resource?: string | null
>     } | null | null
>   } | {
>     uri?: string | null,
>     include?: string[] | null,
>     exclude?: string[] | null,
>     auth_secret_name?: string | null | null,
>     type?: string | null,
>     aws_assume_role?: {
>       role_arn?: string | null,
>       region?: string | null
>     } | null | null,
>     aws_oidc?: {
>       role_arn?: string | null,
>       region?: string | null
>     } | null | null
>   } | {
>     uri?: string | null,
>     include?: string[] | null,
>     exclude?: string[] | null,
>     auth_secret_name?: string | null | null,
>     type?: string | null,
>     gcp_oidc?: {
>       service_account?: string | null,
>       workload_identity_provider?: string | null
>     } | null | null
>   } | {
>     uri?: string | null,
>     include?: string[] | null,
>     exclude?: string[] | null,
>     auth_secret_name?: string | null | null,
>     type?: string | null
>   } | {
>     uri?: string | null,
>     include?: string[] | null,
>     exclude?: string[] | null,
>     auth_secret_name?: string | null | null,
>     type?: string | null
>   } | {
>     uri?: string | null,
>     include?: string[] | null,
>     exclude?: string[] | null,
>     auth_secret_name?: string | null | null,
>     type?: string | null
>   } | {
>     uri?: string | null,
>     include?: string[] | null,
>     exclude?: string[] | null,
>     type?: string | null
>   } | null,
>   destination?: {
>     ref?: string | null
>   } | null,
>   volume_version_id?: string | null | null,
>   version_ref?: string | null | null,
>   content_digest?: string | null | null,
>   total_size_bytes?: number | null | null,
>   created_at?: string | null,
>   completed_at?: string | null | null,
>   error?: {
>     code?: string | null,
>     message?: string | null
>   } | null | null
> }[] | null
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   cursor?: string | null | null
> } | null
> ```

***

### syncs.start

`volumes.syncs.start`

Starts a volume sync. Starts one durable asynchronous transfer from a remote source into a BDN volume.

**Risk:** `destructive`

```ts theme={null}
await corsair.baseten.api.volumes.syncs.start({
	source: { uri: 'https://example.com/callback', type: 'HUGGING_FACE' },
	destination: { ref: 'example' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosting` | `BASETEN_CLOUD \| SINGLE_TENANT \| SELF_HOSTED \| null` | No | Where the volumes are stored. Defaults to your organization's hosting when it has one, and is required when it has more than one. |
| `source` | `object` | Yes | Remote source to sync from. |
| `destination` | `object` | Yes | BDN destination for a volume sync. |

> [accordion] source full type
>
> ```ts theme={null}
> {
>   uri: string,
>   include?: string[],
>   exclude?: string[],
>   auth_secret_name?: string | null,
>   type: HUGGING_FACE,
>   hf_oidc?: {
>     resource: string
>   } | null
> } | {
>   uri: string,
>   include?: string[],
>   exclude?: string[],
>   auth_secret_name?: string | null,
>   type: S3,
>   aws_assume_role?: {
>     role_arn: string,
>     region: string
>   } | null,
>   aws_oidc?: {
>     role_arn: string,
>     region: string
>   } | null
> } | {
>   uri: string,
>   include?: string[],
>   exclude?: string[],
>   auth_secret_name?: string | null,
>   type: GCS,
>   gcp_oidc?: {
>     service_account: string,
>     workload_identity_provider: string
>   } | null
> } | {
>   uri: string,
>   include?: string[],
>   exclude?: string[],
>   auth_secret_name?: string | null,
>   type: AZURE
> } | {
>   uri: string,
>   include?: string[],
>   exclude?: string[],
>   auth_secret_name?: string | null,
>   type: R2
> } | {
>   uri: string,
>   include?: string[],
>   exclude?: string[],
>   auth_secret_name?: string | null,
>   type: COREWEAVE
> } | {
>   uri: string,
>   include?: string[],
>   exclude?: string[],
>   type: BASETEN_TRAINING
> }
> ```

> [accordion] destination full type
>
> ```ts theme={null}
> {
>   ref: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sync_id` | `string \| null` | No | Identifier of this sync operation. |
| `status` | `string \| null` | No | — |
| `source` | `object \| null` | No | Remote source being synced. |
| `destination` | `object \| null` | No | BDN destination for a volume sync. |
| `volume_version_id` | `string \| null \| null` | No | Produced artifact identifier; null until the sync is ready. |
| `version_ref` | `string \| null \| null` | No | Immutable BDN reference; null until the sync is ready. |
| `content_digest` | `string \| null \| null` | No | BLAKE3 digest of the synced content; null until available. |
| `total_size_bytes` | `number \| null \| null` | No | Total size of the synced content in bytes; null until available. |
| `created_at` | `string \| null` | No | Time at which the sync was created. |
| `completed_at` | `string \| null \| null` | No | Time at which the sync reached a terminal state. |
| `error` | `object \| null` | No | Redacted failure details; null unless the sync failed. |

> [accordion] source full type
>
> ```ts theme={null}
> {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null,
>   hf_oidc?: {
>     resource?: string | null
>   } | null | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null,
>   aws_assume_role?: {
>     role_arn?: string | null,
>     region?: string | null
>   } | null | null,
>   aws_oidc?: {
>     role_arn?: string | null,
>     region?: string | null
>   } | null | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null,
>   gcp_oidc?: {
>     service_account?: string | null,
>     workload_identity_provider?: string | null
>   } | null | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   auth_secret_name?: string | null | null,
>   type?: string | null
> } | {
>   uri?: string | null,
>   include?: string[] | null,
>   exclude?: string[] | null,
>   type?: string | null
> } | null
> ```

> [accordion] destination full type
>
> ```ts theme={null}
> {
>   ref?: string | null
> } | null
> ```

> [accordion] error full type
>
> ```ts theme={null}
> {
>   code?: string | null,
>   message?: string | null
> } | null | null
> ```

***

### tags.delete

`volumes.tags.delete`

Deletes a volume tag. The version remains available by digest and any other tags. If the tag is absent, the request succeeds with deleted set to false. Deleting head makes references without a tag or digest stop resolving until head is set again. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.volumes.tags.delete({ volume_namespace: 'example', volume_name: 'example', volume_tag: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_namespace` | `string` | Yes | — |
| `volume_name` | `string` | Yes | — |
| `volume_tag` | `string` | Yes | — |
| `hosting` | `BASETEN_CLOUD \| SINGLE_TENANT \| SELF_HOSTED \| null` | No | Where the volumes are stored. Defaults to your organization's hosting when it has one, and is required when it has more than one. |
| `expected_sequence` | `number \| null` | No | Revision the volume is expected to be at. When set, the delete fails with a conflict if the volume has changed since, so it cannot delete a tag someone else has just set on another version. Take the value from volume\_sequence. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `namespace` | `string \| null` | No | Namespace the volume belongs to, in lowercase. |
| `volume` | `string \| null` | No | Name of the volume, in lowercase. |
| `tag` | `string \| null` | No | Tag name from the request, with its original capitalization. |
| `deleted` | `boolean \| null` | No | Whether the tag existed and was deleted. False when the volume had no tag by that name, which is not an error. |
| `volume_sequence` | `number \| null` | No | Revision of the volume after the delete. |

***

### tags.set

`volumes.tags.set`

Sets a volume tag. Setting an existing tag overwrites it. The previous version remains available by digest. Pass expires\_at to set the tag's expiration time. Omit expires\_at to clear any expiration time on the tag. Version or volume expiration still deletes the tag.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.volumes.tags.set({
	volume_namespace: 'example',
	volume_name: 'example',
	tag: 'example',
	version: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_namespace` | `string` | Yes | — |
| `volume_name` | `string` | Yes | — |
| `hosting` | `BASETEN_CLOUD \| SINGLE_TENANT \| SELF_HOSTED \| null` | No | Where the volumes are stored. Defaults to your organization's hosting when it has one, and is required when it has more than one. |
| `tag` | `string` | Yes | Name of the tag to set. Tags are case-sensitive. Setting a tag that already exists overwrites it, and the version it pointed at before stays reachable by digest. |
| `version` | `string` | Yes | Version to set the tag on. Address it with `:<tag>` for a tag, `@<digest>` for a full content digest or a prefix of at least 12 hexadecimal characters, or `head` for the version a reference with no tag or digest resolves to. |
| `expires_at` | `string \| null` | No | Time at which the tag expires, in ISO 8601 format, with a UTC offset. It must be in the future and at most ten years ahead. Omit it for a tag with no expiration time of its own. Omitting it also clears the expiration time of an existing tag. Version or volume expiration still deletes the tag. Do not specify it when setting `head`. |
| `expected_sequence` | `number \| null` | No | Revision the volume is expected to be at. When set, the request fails with a conflict if the volume has changed since. Take the value from volume\_sequence. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `namespace` | `string \| null` | No | Namespace the volume belongs to, in lowercase. |
| `volume` | `string \| null` | No | Name of the volume, in lowercase. |
| `tag` | `string \| null` | No | Name of the tag that was set, with its original capitalization. |
| `digest` | `string \| null` | No | Content digest of the version the tag points at, as `b3:<hex>`. |
| `version_ref` | `string \| null` | No | Full address of the tagged version, as `bdn:<namespace>/<volume>@<digest>`. Paste it into a config.yaml to pin this version, even if the tag is later set on another version. |
| `volume_sequence` | `number \| null` | No | Revision of the volume after the tag was set. |
| `expires_at` | `string \| null \| null` | No | Tag expiration time in ISO 8601 format. Null when the tag has no expiration time of its own. |

***

### update

`volumes.update`

Updates a volume. Updates a volume's settings, such as its expiration time. Only the settings in the request change.

**Risk:** `write`

```ts theme={null}
await corsair.baseten.api.volumes.update({ volume_namespace: 'example', volume_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_namespace` | `string` | Yes | — |
| `volume_name` | `string` | Yes | — |
| `hosting` | `BASETEN_CLOUD \| SINGLE_TENANT \| SELF_HOSTED \| null` | No | Where the volumes are stored. Defaults to your organization's hosting when it has one, and is required when it has more than one. |
| `expires_at` | `string \| null` | No | Time at which the volume expires, in ISO 8601 format, with a UTC offset. It must be in the future and at most ten years ahead. Set it to null to clear the expiration time. A body that sets no field is rejected. When the volume expires, all live versions are deleted, all tags are removed, and the volume disappears from listings. Clearing the expiration time afterward does not restore deleted versions. Each deleted version can be restored until its delete\_after time. Setting or clearing the expiration time requires the same permission as deleting the volume. |
| `expected_sequence` | `number \| null` | No | Revision the volume is expected to be at. When set, the update fails with a conflict if the volume has changed since. Take the value from a volume's sequence, or from volume\_sequence. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `namespace` | `string \| null` | No | Namespace the volume belongs to, in lowercase. |
| `volume` | `string \| null` | No | Name of the volume, in lowercase. |
| `expires_at` | `string \| null \| null` | No | Volume expiration time in ISO 8601 format. Null when no expiration time is set. |
| `volume_sequence` | `number \| null` | No | Revision of the volume after the update. |

***

### versions.delete

`volumes.versions.delete`

Deletes one version of a volume. Deletes the version the address names, along with every tag pointing at it. Addressing the version by tag deletes the version the tag points at, not the tag. The data is not erased: the version stays restorable until the recovery deadline in the response passes. Cannot be undone.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.volumes.versions.delete({ volume_namespace: 'example', volume_name: 'example', volume_version: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_namespace` | `string` | Yes | — |
| `volume_name` | `string` | Yes | — |
| `volume_version` | `string` | Yes | — |
| `hosting` | `BASETEN_CLOUD \| SINGLE_TENANT \| SELF_HOSTED \| null` | No | Where the volumes are stored. Defaults to your organization's hosting when it has one, and is required when it has more than one. |
| `expected_sequence` | `number \| null` | No | Revision the volume is expected to be at. When set, the delete fails with a conflict if the volume has changed since, so a read followed by a delete cannot act on a version a tag has since been moved off. Take the value from volume\_sequence. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `namespace` | `string \| null` | No | Namespace the volume belongs to, in lowercase. |
| `volume` | `string \| null` | No | Name of the volume, in lowercase. |
| `version_ref` | `string \| null` | No | Full address of the deleted version, as `bdn:<namespace>/<volume>@<digest>`. |
| `digest` | `string \| null` | No | Content digest of the deleted version, as `b3:<hex>`. |
| `lifecycle` | `string \| null` | No | Lifecycle state of the version after the delete. |
| `delete_after` | `string \| null` | No | When the version stops being restorable, in ISO 8601 format. Until then it can be returned to service. |
| `volume_sequence` | `number \| null` | No | Revision of the volume after the delete. |

***

### versions.get

`volumes.versions.get`

Gets one version of a volume. Returns a single version of the volume. Address it with :\<tag> for a tag, @\<digest> for a full content digest or a prefix of at least 12 hexadecimal characters, or head for the version a reference with no tag or digest resolves to.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.volumes.versions.get({ volume_namespace: 'example', volume_name: 'example', volume_version: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_namespace` | `string` | Yes | — |
| `volume_name` | `string` | Yes | — |
| `volume_version` | `string` | Yes | — |
| `hosting` | `BASETEN_CLOUD \| SINGLE_TENANT \| SELF_HOSTED \| null` | No | Where the volumes are stored. Defaults to your organization's hosting when it has one, and is required when it has more than one. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `namespace` | `string \| null` | No | Namespace the volume belongs to, in lowercase. |
| `volume` | `string \| null` | No | Name of the volume, in lowercase. |
| `version_ref` | `string \| null` | No | Full address of this version, as `bdn:<namespace>/<volume>@<digest>`. Paste this into the `bdn.mounts` section of a config.yaml to pin to it. |
| `digest` | `string \| null` | No | Content digest of the version, as `b3:<hex>`. |
| `sequence` | `number \| null \| null` | No | Revision the version was committed at. Null for versions committed before the volume service recorded it. |
| `lifecycle` | `string \| null` | No | Lifecycle state of the version: ALIVE, or TOMBSTONED once it has been deleted or has expired. |
| `is_head` | `boolean \| null` | No | Whether the reserved `head` tag points at this version. |
| `tags` | `string[] \| null` | No | Tags pointing at this version that your API key can read. |
| `total_size_bytes` | `number \| null \| null` | No | Total size of the version's files in bytes. Null when not recorded. |
| `created_at` | `string \| null` | No | When the version was committed, in ISO 8601 format. |
| `expires_at` | `string \| null \| null` | No | When the version expires, in ISO 8601 format. At that instant it becomes TOMBSTONED with `tombstoned_at` set to this value, and every tag pointing at it drops. Null for a version that never expires, and null once the lifecycle is TOMBSTONED. |
| `tombstoned_at` | `string \| null \| null` | No | When the version was deleted or expired, in ISO 8601 format. Null unless the lifecycle is TOMBSTONED. |
| `delete_after` | `string \| null \| null` | No | When the version stops being restorable, in ISO 8601 format. Null unless the lifecycle is TOMBSTONED. |
| `entry_count` | `number \| null \| null` | No | Number of files in the version. Null when not recorded. |
| `volume_sequence` | `number \| null` | No | Revision of the volume as a whole when this version was read. Pass it as expected\_sequence on a later delete to make that delete conditional on the volume not having changed since. |

***

### versions.list

`volumes.versions.list`

Gets the versions of a volume. Returns every live version of the volume, newest first, each with its digest, size, lifecycle, the tags pointing at it, and any scheduled expiry. Pass include\_tombstoned to list deleted and expired versions alongside them.

**Risk:** `read`

```ts theme={null}
await corsair.baseten.api.volumes.versions.list({ volume_namespace: 'example', volume_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_namespace` | `string` | Yes | — |
| `volume_name` | `string` | Yes | — |
| `hosting` | `BASETEN_CLOUD \| SINGLE_TENANT \| SELF_HOSTED \| null` | No | Where the volumes are stored. Defaults to your organization's hosting when it has one, and is required when it has more than one. |
| `include_tombstoned` | `boolean` | No | Whether to include deleted and expired versions. Such a version carries a TOMBSTONED lifecycle and stays restorable until its recovery deadline passes. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `versions` | `object[] \| null` | No | Versions of the volume, newest first. |
| `volume_sequence` | `number \| null` | No | Revision of the volume as a whole when the versions were read. Pass it as expected\_sequence on a later delete to make that delete conditional on the volume not having changed since. Distinct from the per-version sequence, which is the revision a version was committed at. |

> [accordion] versions full type
>
> ```ts theme={null}
> {
>   namespace?: string | null,
>   volume?: string | null,
>   version_ref?: string | null,
>   digest?: string | null,
>   sequence?: number | null | null,
>   lifecycle?: string | null,
>   is_head?: boolean | null,
>   tags?: string[] | null,
>   total_size_bytes?: number | null | null,
>   created_at?: string | null,
>   expires_at?: string | null | null,
>   tombstoned_at?: string | null | null,
>   delete_after?: string | null | null
> }[] | null
> ```

***

### versions.restore

`volumes.versions.restore`

Restores a deleted or expired version of a volume. Returns a deleted or expired version to service, provided its recovery deadline has not passed. The tags the version carried are not restored with it, so re-tag it if anything depended on those, and a restored version never expires until something sets a new expiry.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.baseten.api.volumes.versions.restore({ volume_namespace: 'example', volume_name: 'example', volume_version: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `volume_namespace` | `string` | Yes | — |
| `volume_name` | `string` | Yes | — |
| `volume_version` | `string` | Yes | — |
| `hosting` | `BASETEN_CLOUD \| SINGLE_TENANT \| SELF_HOSTED \| null` | No | Where the volumes are stored. Defaults to your organization's hosting when it has one, and is required when it has more than one. |
| `expected_sequence` | `number \| null` | No | Revision the volume is expected to be at. When set, the restore fails with a conflict if the volume has changed since. Take the value from volume\_sequence. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `namespace` | `string \| null` | No | Namespace the volume belongs to, in lowercase. |
| `volume` | `string \| null` | No | Name of the volume, in lowercase. |
| `version_ref` | `string \| null` | No | Full address of the restored version, as `bdn:<namespace>/<volume>@<digest>`. |
| `digest` | `string \| null` | No | Content digest of the restored version, as `b3:<hex>`. |
| `lifecycle` | `string \| null` | No | Lifecycle state of the version after the restore. |
| `volume_sequence` | `number \| null` | No | Revision of the volume after the restore. |

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.