Skip to main content

Class: AIGatewayApiKeysClient

Defined in: src/ai-gateway/api-keys-client.ts:37

Client for AI Gateway API-key operations (data plane).

Service and user keys are separate sub-collections; there is no combined api-keys endpoint (it is OPA-denied).

Constructors

Constructor

new AIGatewayApiKeysClient(opts): AIGatewayApiKeysClient;

Defined in: src/ai-gateway/api-keys-client.ts:42

Parameters

ParameterType
optsAIGatewaySubClientOptions

Returns

AIGatewayApiKeysClient

Methods

listService()

listService(opts): Promise<objectOutputType<{
object: ZodString;
total: ZodNumber;
has_more: ZodOptional<ZodBoolean>;
data: ZodArray<ZodObject<{
id: ZodString;
name: ZodOptional<ZodString>;
object: ZodOptional<ZodString>;
}, "passthrough", ZodTypeAny, objectOutputType<{
id: ZodString;
name: ZodOptional<ZodString>;
object: ZodOptional<ZodString>;
}, ZodTypeAny, "passthrough">, objectInputType<{
id: ZodString;
name: ZodOptional<ZodString>;
object: ZodOptional<ZodString>;
}, ZodTypeAny, "passthrough">>, "many">;
}, ZodTypeAny, "passthrough">>;

Defined in: src/ai-gateway/api-keys-client.ts:96

List service API keys in a workspace.

Parameters

ParameterTypeDescription
optsAIGatewayWorkspaceScopedListOptionsMust include the workspace UUID.

Returns

Promise<objectOutputType<{ object: ZodString; total: ZodNumber; has_more: ZodOptional<ZodBoolean>; data: ZodArray<ZodObject<{ id: ZodString; name: ZodOptional<ZodString>; object: ZodOptional<ZodString>; }, "passthrough", ZodTypeAny, objectOutputType<{ id: ZodString; name: ZodOptional<ZodString>; object: ZodOptional<ZodString>; }, ZodTypeAny, "passthrough">, objectInputType<{ id: ZodString; name: ZodOptional<ZodString>; object: ZodOptional<ZodString>; }, ZodTypeAny, "passthrough">>, "many">; }, ZodTypeAny, "passthrough">>

Service keys; the secret itself is only ever returned at creation.

Example

import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
const gw = new AIGatewayClient();

const keys = await gw.apiKeys.listService({ workspaceId: '16f7e90d-382a-4e78-b577-1b01eb5f8297' });
// keys.total => 1

listUser()

listUser(opts): Promise<objectOutputType<{
object: ZodString;
total: ZodNumber;
has_more: ZodOptional<ZodBoolean>;
data: ZodArray<ZodObject<{
id: ZodString;
name: ZodOptional<ZodString>;
object: ZodOptional<ZodString>;
}, "passthrough", ZodTypeAny, objectOutputType<{
id: ZodString;
name: ZodOptional<ZodString>;
object: ZodOptional<ZodString>;
}, ZodTypeAny, "passthrough">, objectInputType<{
id: ZodString;
name: ZodOptional<ZodString>;
object: ZodOptional<ZodString>;
}, ZodTypeAny, "passthrough">>, "many">;
}, ZodTypeAny, "passthrough">>;

Defined in: src/ai-gateway/api-keys-client.ts:113

List user API keys in a workspace.

Parameters

ParameterTypeDescription
optsAIGatewayWorkspaceScopedListOptionsMust include the workspace UUID.

Returns

Promise<objectOutputType<{ object: ZodString; total: ZodNumber; has_more: ZodOptional<ZodBoolean>; data: ZodArray<ZodObject<{ id: ZodString; name: ZodOptional<ZodString>; object: ZodOptional<ZodString>; }, "passthrough", ZodTypeAny, objectOutputType<{ id: ZodString; name: ZodOptional<ZodString>; object: ZodOptional<ZodString>; }, ZodTypeAny, "passthrough">, objectInputType<{ id: ZodString; name: ZodOptional<ZodString>; object: ZodOptional<ZodString>; }, ZodTypeAny, "passthrough">>, "many">; }, ZodTypeAny, "passthrough">>

User-scoped keys.

Example

import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
const gw = new AIGatewayClient();

const keys = await gw.apiKeys.listUser({ workspaceId: '16f7e90d-382a-4e78-b577-1b01eb5f8297' });
// keys.total => 0

createService()

createService(body): Promise<objectOutputType<{
}, ZodTypeAny, "passthrough">>;

Defined in: src/ai-gateway/api-keys-client.ts:135

Create a service API key.

Parameters

ParameterTypeDescription
bodyGatewayApiKeyCreateRequestName, scopes, TSG, workspace UUID, and type.

Returns

Promise<objectOutputType<{ }, ZodTypeAny, "passthrough">>

The raw create response — the only place the key secret appears. Capture it.

Example

import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
const gw = new AIGatewayClient();

await gw.apiKeys.createService({
name: 'ci-runner',
scopes: ['completions.write', 'logs.write'],
organisation_id: '1852583913',
workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
type: 'workspace',
});

createUser()

createUser(body): Promise<objectOutputType<{
}, ZodTypeAny, "passthrough">>;

Defined in: src/ai-gateway/api-keys-client.ts:158

Create a user API key.

Parameters

ParameterTypeDescription
bodyGatewayApiKeyCreateRequestAs createService, plus user_id.

Returns

Promise<objectOutputType<{ }, ZodTypeAny, "passthrough">>

The raw create response — the only place the key secret appears. Capture it.

Example

import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
const gw = new AIGatewayClient();

await gw.apiKeys.createUser({
name: 'calvin-laptop',
scopes: ['completions.write'],
organisation_id: '1852583913',
workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
type: 'workspace',
user_id: 'fad91538-65a9-41f7-8b9c-6e4c0e8b9c5f',
});

updateService()

updateService(keyId, body): Promise<objectOutputType<{
}, ZodTypeAny, "passthrough">>;

Defined in: src/ai-gateway/api-keys-client.ts:181

Update a service API key.

Parameters

ParameterTypeDescription
keyIdstringKey UUID.
bodyGatewayApiKeyCreateRequestReplacement fields.

Returns

Promise<objectOutputType<{ }, ZodTypeAny, "passthrough">>

The raw update response. Shape unverified against a live tenant — see the PRD.

Example

import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
const gw = new AIGatewayClient();

await gw.apiKeys.updateService('11111111-1111-4111-8111-111111111111', {
name: 'ci-runner',
scopes: ['completions.write'],
organisation_id: '1852583913',
workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
type: 'workspace',
});

updateUser()

updateUser(keyId, body): Promise<objectOutputType<{
}, ZodTypeAny, "passthrough">>;

Defined in: src/ai-gateway/api-keys-client.ts:209

Update a user API key.

Parameters

ParameterTypeDescription
keyIdstringKey UUID.
bodyGatewayApiKeyCreateRequestReplacement fields.

Returns

Promise<objectOutputType<{ }, ZodTypeAny, "passthrough">>

The raw update response. Shape unverified against a live tenant — see the PRD.

Example

import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
const gw = new AIGatewayClient();

await gw.apiKeys.updateUser('11111111-1111-4111-8111-111111111111', {
name: 'calvin-laptop',
scopes: ['completions.write'],
organisation_id: '1852583913',
workspace_id: '16f7e90d-382a-4e78-b577-1b01eb5f8297',
type: 'workspace',
user_id: 'fad91538-65a9-41f7-8b9c-6e4c0e8b9c5f',
});