Class: AIGatewayWorkspacesClient
Defined in: src/ai-gateway/workspaces-client.ts:70
Client for AI Gateway workspaces.
The only sub-client spanning both planes: reads default to the data plane but can be routed to the admin plane, and every write is admin-only. Each of the other eleven sub-clients is wired to exactly one plane.
Constructors
Constructor
new AIGatewayWorkspacesClient(opts): AIGatewayWorkspacesClient;
Defined in: src/ai-gateway/workspaces-client.ts:76
Parameters
| Parameter | Type |
|---|---|
opts | AIGatewayWorkspacesClientOptions |
Returns
AIGatewayWorkspacesClient
Methods
list()
list(options?): Promise<objectOutputType<{
object: ZodString;
total: ZodNumber;
has_more: ZodOptional<ZodBoolean>;
data: ZodArray<ZodObject<{
id: ZodString;
slug: ZodString;
name: ZodString;
icon: ZodNullable<ZodString>;
description: ZodNullable<ZodString>;
created_at: ZodString;
last_updated_at: ZodString;
is_default: ZodNumber;
status: ZodString;
scope_name: ZodString;
object: ZodString;
}, "passthrough", ZodTypeAny, objectOutputType<{
id: ZodString;
slug: ZodString;
name: ZodString;
icon: ZodNullable<ZodString>;
description: ZodNullable<ZodString>;
created_at: ZodString;
last_updated_at: ZodString;
is_default: ZodNumber;
status: ZodString;
scope_name: ZodString;
object: ZodString;
}, ZodTypeAny, "passthrough">, objectInputType<{
id: ZodString;
slug: ZodString;
name: ZodString;
icon: ZodNullable<ZodString>;
description: ZodNullable<ZodString>;
created_at: ZodString;
last_updated_at: ZodString;
is_default: ZodNumber;
status: ZodString;
scope_name: ZodString;
object: ZodString;
}, ZodTypeAny, "passthrough">>, "many">;
}, ZodTypeAny, "passthrough">>;
Defined in: src/ai-gateway/workspaces-client.ts:112
List workspaces.
Two defaults worth knowing, because each one hides rows:
- Active only. Without
status, archived workspaces are omitted. Pass{ status: 'archived' }to see them — that is where AIGatewayWorkspacesClient.delete leaves a workspace. - Your scope only. The data plane returns just the workspaces your service account holds a
workspace-scope grant on. Pass
{ plane: 'admin' }to enumerate the whole tenant.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | AIGatewayWorkspaceListOptions | Optional status filter and plane selection. |
Returns
Promise<objectOutputType<{
object: ZodString;
total: ZodNumber;
has_more: ZodOptional<ZodBoolean>;
data: ZodArray<ZodObject<{
id: ZodString;
slug: ZodString;
name: ZodString;
icon: ZodNullable<ZodString>;
description: ZodNullable<ZodString>;
created_at: ZodString;
last_updated_at: ZodString;
is_default: ZodNumber;
status: ZodString;
scope_name: ZodString;
object: ZodString;
}, "passthrough", ZodTypeAny, objectOutputType<{
id: ZodString;
slug: ZodString;
name: ZodString;
icon: ZodNullable<ZodString>;
description: ZodNullable<ZodString>;
created_at: ZodString;
last_updated_at: ZodString;
is_default: ZodNumber;
status: ZodString;
scope_name: ZodString;
object: ZodString;
}, ZodTypeAny, "passthrough">, objectInputType<{
id: ZodString;
slug: ZodString;
name: ZodString;
icon: ZodNullable<ZodString>;
description: ZodNullable<ZodString>;
created_at: ZodString;
last_updated_at: ZodString;
is_default: ZodNumber;
status: ZodString;
scope_name: ZodString;
object: ZodString;
}, ZodTypeAny, "passthrough">>, "many">;
}, ZodTypeAny, "passthrough">>
Workspaces, each with the scope_name that grants data-plane access to it.
Example
import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
const gw = new AIGatewayClient();
const mine = await gw.workspaces.list();
// mine.data[0] => { slug: 'ws-main-a-349e0e', scope_name: 'main_airs_workspace_1852583913', ... }
const everything = await gw.workspaces.list({ plane: 'admin' });
const archived = await gw.workspaces.list({ plane: 'admin', status: 'archived' });
get()
get(workspaceRef, options?): Promise<objectOutputType<{
id: ZodString;
name: ZodString;
description: ZodNullable<ZodString>;
created_at: ZodString;
last_updated_at: ZodString;
is_default: ZodNumber;
slug: ZodString;
icon: ZodNullable<ZodString>;
defaults: ZodNullable<ZodRecord<ZodString, ZodUnknown>>;
usage_limits: ZodNullable<ZodUnion<[ZodArray<ZodObject<{
credit_limit: ZodOptional<ZodNumber>;
type: ZodOptional<ZodString>;
alert_threshold: ZodOptional<ZodNumber>;
periodic_reset: ZodOptional<ZodNullable<...>>;
periodic_reset_days: ZodOptional<ZodNullable<...>>;
next_usage_reset_at: ZodOptional<ZodNullable<...>>;
}, "passthrough", ZodTypeAny, objectOutputType<{
credit_limit: ZodOptional<...>;
type: ZodOptional<...>;
alert_threshold: ZodOptional<...>;
periodic_reset: ZodOptional<...>;
periodic_reset_days: ZodOptional<...>;
next_usage_reset_at: ZodOptional<...>;
}, ZodTypeAny, "passthrough">, objectInputType<{
credit_limit: ZodOptional<...>;
type: ZodOptional<...>;
alert_threshold: ZodOptional<...>;
periodic_reset: ZodOptional<...>;
periodic_reset_days: ZodOptional<...>;
next_usage_reset_at: ZodOptional<...>;
}, ZodTypeAny, "passthrough">>, "many">, ZodRecord<ZodString, ZodUnknown>]>>;
rate_limits: ZodNullable<ZodUnion<[ZodArray<ZodObject<{
type: ZodOptional<ZodString>;
unit: ZodOptional<ZodString>;
value: ZodOptional<ZodNumber>;
}, "passthrough", ZodTypeAny, objectOutputType<{
type: ZodOptional<...>;
unit: ZodOptional<...>;
value: ZodOptional<...>;
}, ZodTypeAny, "passthrough">, objectInputType<{
type: ZodOptional<...>;
unit: ZodOptional<...>;
value: ZodOptional<...>;
}, ZodTypeAny, "passthrough">>, "many">, ZodRecord<ZodString, ZodUnknown>]>>;
security_settings: ZodOptional<ZodRecord<ZodString, ZodBoolean>>;
data_plane_security_settings: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
settings: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
status: ZodOptional<ZodNullable<ZodString>>;
}, ZodTypeAny, "passthrough">>;
Defined in: src/ai-gateway/workspaces-client.ts:149
Fetch one workspace, including its security and rate-limit settings.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspaceRef | string | Workspace UUID or slug; the API accepts both. |
options | AIGatewayWorkspaceGetOptions | Plane selection. A workspace outside your workspace scope answers 403 AB03 on the data plane, not 404; re-read it with { plane: 'admin' }. Archived workspaces are not retrievable here. Once AIGatewayWorkspacesClient.delete has archived a workspace, this returns 404 AB08 for both its UUID and its slug, on either plane (verified live 2026-08-01) — even though the row is still listed by list({ status: 'archived' }). Treat a 404 after a delete as expected, and use the list filter to inspect archived workspaces. |
Returns
Promise<objectOutputType<{
id: ZodString;
name: ZodString;
description: ZodNullable<ZodString>;
created_at: ZodString;
last_updated_at: ZodString;
is_default: ZodNumber;
slug: ZodString;
icon: ZodNullable<ZodString>;
defaults: ZodNullable<ZodRecord<ZodString, ZodUnknown>>;
usage_limits: ZodNullable<ZodUnion<[ZodArray<ZodObject<{
credit_limit: ZodOptional<ZodNumber>;
type: ZodOptional<ZodString>;
alert_threshold: ZodOptional<ZodNumber>;
periodic_reset: ZodOptional<ZodNullable<...>>;
periodic_reset_days: ZodOptional<ZodNullable<...>>;
next_usage_reset_at: ZodOptional<ZodNullable<...>>;
}, "passthrough", ZodTypeAny, objectOutputType<{
credit_limit: ZodOptional<...>;
type: ZodOptional<...>;
alert_threshold: ZodOptional<...>;
periodic_reset: ZodOptional<...>;
periodic_reset_days: ZodOptional<...>;
next_usage_reset_at: ZodOptional<...>;
}, ZodTypeAny, "passthrough">, objectInputType<{
credit_limit: ZodOptional<...>;
type: ZodOptional<...>;
alert_threshold: ZodOptional<...>;
periodic_reset: ZodOptional<...>;
periodic_reset_days: ZodOptional<...>;
next_usage_reset_at: ZodOptional<...>;
}, ZodTypeAny, "passthrough">>, "many">, ZodRecord<ZodString, ZodUnknown>]>>;
rate_limits: ZodNullable<ZodUnion<[ZodArray<ZodObject<{
type: ZodOptional<ZodString>;
unit: ZodOptional<ZodString>;
value: ZodOptional<ZodNumber>;
}, "passthrough", ZodTypeAny, objectOutputType<{
type: ZodOptional<...>;
unit: ZodOptional<...>;
value: ZodOptional<...>;
}, ZodTypeAny, "passthrough">, objectInputType<{
type: ZodOptional<...>;
unit: ZodOptional<...>;
value: ZodOptional<...>;
}, ZodTypeAny, "passthrough">>, "many">, ZodRecord<ZodString, ZodUnknown>]>>;
security_settings: ZodOptional<ZodRecord<ZodString, ZodBoolean>>;
data_plane_security_settings: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
settings: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
status: ZodOptional<ZodNullable<ZodString>>;
}, ZodTypeAny, "passthrough">>
Workspace detail; list rows do not carry the settings blocks.
Example
import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
const gw = new AIGatewayClient();
const ws = await gw.workspaces.get('16f7e90d-382a-4e78-b577-1b01eb5f8297');
// ws.security_settings?.membersViewLogs => true
// Slugs work too, and the admin plane reaches workspaces you aren't scoped to:
const other = await gw.workspaces.get('ws-produc-985697', { plane: 'admin' });
create()
create(body): Promise<objectOutputType<{
id: ZodString;
name: ZodString;
slug: ZodString;
description: ZodNullable<ZodString>;
created_at: ZodString;
last_updated_at: ZodString;
scope_name: ZodString;
object: ZodString;
defaults: ZodOptional<ZodNullable<ZodRecord<ZodString, ZodUnknown>>>;
users: ZodOptional<ZodArray<ZodUnknown, "many">>;
}, ZodTypeAny, "passthrough">>;
Defined in: src/ai-gateway/workspaces-client.ts:186
Create a workspace. Admin plane — needs a tenant-root admin role.
Parameters
| Parameter | Type | Description |
|---|---|---|
body | GatewayWorkspaceCreateRequest | name and scope_name are both required; the API rejects a body missing either. |
Returns
Promise<objectOutputType<{
id: ZodString;
name: ZodString;
slug: ZodString;
description: ZodNullable<ZodString>;
created_at: ZodString;
last_updated_at: ZodString;
scope_name: ZodString;
object: ZodString;
defaults: ZodOptional<ZodNullable<ZodRecord<ZodString, ZodUnknown>>>;
users: ZodOptional<ZodArray<ZodUnknown, "many">>;
}, ZodTypeAny, "passthrough">>
The created workspace. Unlike configs/guardrails/providers/deployments,
which return short receipts, this returns most of the record — but not status,
is_default, icon, usage_limits, rate_limits, or the settings blocks. Call
AIGatewayWorkspacesClient.get when you need those.
Example
import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
const gw = new AIGatewayClient();
const created = await gw.workspaces.create({
name: 'Production',
scope_name: 'ws_production_bx7qw0', // the SCM scope, not derived from name
description: 'All production applications',
defaults: { metadata: { env: 'production' } },
rate_limits: [{ type: 'requests', unit: 'rpm', value: 100 }],
});
update()
update(workspaceRef, body): Promise<objectOutputType<{
}, ZodTypeAny, "passthrough">>;
Defined in: src/ai-gateway/workspaces-client.ts:223
Update a workspace. Admin plane. Partial patch — send only the fields that change.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspaceRef | string | Workspace UUID or slug. |
body | GatewayWorkspaceUpdateRequest | At least one field. An empty patch is rejected locally, mirroring the API's own "No update fields provided" rejection, so a typo'd caller fails without a round trip. |
Returns
Promise<objectOutputType<{
}, ZodTypeAny, "passthrough">>
An empty object — the API acknowledges the write without echoing the record (verified live 2026-08-01). The change does persist; re-read with AIGatewayWorkspacesClient.get to see it.
Example
import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
const gw = new AIGatewayClient();
await gw.workspaces.update('ws-produc-985697', {
description: 'Production workloads, us-east',
});
delete()
delete(workspaceRef): Promise<void>;
Defined in: src/ai-gateway/workspaces-client.ts:270
Delete a workspace. Admin plane.
This is a soft delete: the workspace is archived, not destroyed. It vanishes from a default
AIGatewayWorkspacesClient.list but stays visible via list({ status: 'archived' }).
Note that list is the only way to see it afterwards —
AIGatewayWorkspacesClient.get answers 404 AB08 for an archived workspace.
Same semantics as deployments.delete(), and the opposite of configs/guardrails/providers,
which hard delete. There is no hard delete for workspaces.
Takes no query parameters — unlike integrations.delete() and deployments.delete(), which
both require organisation_id.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspaceRef | string | Workspace UUID or slug. |
Returns
Promise<void>
Example
import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
const gw = new AIGatewayClient();
await gw.workspaces.delete('ws-produc-985697');
// Still there, archived:
const gone = await gw.workspaces.list({ plane: 'admin', status: 'archived' });