Skip to main content

Class: AIGatewayInferenceClient

Defined in: src/ai-gateway/inference-client.ts:130

Prisma gateway runtime inference, independent of management OAuth and SCM plane URLs.

Example​

const inference = new AIGatewayInferenceClient(); // PANW_AI_GW_INFERENCE_ENDPOINT / API_KEY
const result = await inference.createChatCompletion({
model: '@provider/model', messages: [{ role: 'user', content: 'Hello' }],
});
console.log(result.choices[0].message.content);

Extends​

  • AIGatewayRuntimeResourcesClient

Constructors​

Constructor​

new AIGatewayInferenceClient(options?): AIGatewayInferenceClient;

Defined in: src/ai-gateway/inference-client.ts:140

Parameters​

ParameterType
optionsAIGatewayInferenceClientOptions

Returns​

AIGatewayInferenceClient

Overrides​

AIGatewayRuntimeResourcesClient.constructor

Methods​

connectRealtime()​

connectRealtime(opts, options): Promise<GatewayRealtimeConnection>;

Defined in: src/ai-gateway/inference-client.ts:242

Experimental

Open a bounded realtime WebSocket on the explicitly configured gateway. HTTP 101 proves an upgrade, not provider session readiness. Provider errors remain events. The prescribed-model live probe upgrades, then returns invalid_model.

Parameters​

ParameterType
optsobjectOutputType
optionsGatewayRealtimeOptions

Returns​

Promise<GatewayRealtimeConnection>

Example​

const connection = await inference.connectRealtime({ model: '@provider/model' }, {
webSocketFactory: (url, options) => new WebSocket(url, options),
});
try { for await (const event of connection) console.log(event.type); }
finally { await connection.cancel(); }

createCompletion()​

Call Signature​

createCompletion(body, options?): Promise<GatewayStream<GatewayInferenceCreateCompletionResponse>>;

Defined in: src/ai-gateway/inference-client.ts:278

Experimental

Create a legacy text completion; stream=true returns a cancellable iterator. The deployed route exists, but the prescribed model returns HTTP 404. Outside stability guarantees until live-verified; the SDK never substitutes a model.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateCompletionRequest & { stream: true; }
options?GatewayInferenceRequestOptions
Returns​

Promise<GatewayStream<GatewayInferenceCreateCompletionResponse>>

Example​
`await inference.createCompletion({ model: '@provider/compatible-model', prompt: 'Hello', max_tokens: 16 });`

Call Signature​

createCompletion(body, options?): Promise<GatewayInferenceCreateCompletionResponse>;

Defined in: src/ai-gateway/inference-client.ts:282

Experimental

Create a legacy text completion; stream=true returns a cancellable iterator. The deployed route exists, but the prescribed model returns HTTP 404. Outside stability guarantees until live-verified; the SDK never substitutes a model.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateCompletionRequest & { stream?: false | null; }
options?GatewayInferenceRequestOptions
Returns​

Promise<GatewayInferenceCreateCompletionResponse>

Example​
`await inference.createCompletion({ model: '@provider/compatible-model', prompt: 'Hello', max_tokens: 16 });`

Call Signature​

createCompletion(body, options?): Promise<
| GatewayInferenceCreateCompletionResponse
| GatewayStream<GatewayInferenceCreateCompletionResponse>>;

Defined in: src/ai-gateway/inference-client.ts:286

Experimental

Create a legacy text completion; stream=true returns a cancellable iterator. The deployed route exists, but the prescribed model returns HTTP 404. Outside stability guarantees until live-verified; the SDK never substitutes a model.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateCompletionRequest
options?GatewayInferenceRequestOptions
Returns​

Promise< | GatewayInferenceCreateCompletionResponse | GatewayStream<GatewayInferenceCreateCompletionResponse>>

Example​
`await inference.createCompletion({ model: '@provider/compatible-model', prompt: 'Hello', max_tokens: 16 });`

createPromptCompletion()​

Call Signature​

createPromptCompletion(
promptId,
body,
options?): Promise<GatewayStream<GatewayInferenceCreatePromptCompletionStreamResponse>>;

Defined in: src/ai-gateway/inference-client.ts:331

Experimental

Execute a saved prompt with variables and optional root-level parameter overrides. Route and handler dispatch confirmed in the deployed gateway; no owned template has been live-certified. Outside stability guarantees until live-verified. JSON may be a native chat/text completion or the upstream status/headers/body wrapper. Streaming emits native chat or legacy completion events, terminated by [DONE].

Parameters​
ParameterType
promptIdstring
bodyGatewayInferenceInputCreatePromptCompletionRequest & { stream: true; }
options?GatewayInferenceRequestOptions
Returns​

Promise<GatewayStream<GatewayInferenceCreatePromptCompletionStreamResponse>>

Example​
`await inference.createPromptCompletion('owned-prompt', { variables: { user_input: 'Hello' }, model: '@provider/model', max_completion_tokens: 16 });`

Call Signature​

createPromptCompletion(
promptId,
body,
options?): Promise<GatewayInferenceCreatePromptCompletionResponse>;

Defined in: src/ai-gateway/inference-client.ts:336

Experimental

Execute a saved prompt with variables and optional root-level parameter overrides. Route and handler dispatch confirmed in the deployed gateway; no owned template has been live-certified. Outside stability guarantees until live-verified. JSON may be a native chat/text completion or the upstream status/headers/body wrapper. Streaming emits native chat or legacy completion events, terminated by [DONE].

Parameters​
ParameterType
promptIdstring
bodyGatewayInferenceInputCreatePromptCompletionRequest & { stream?: false | null; }
options?GatewayInferenceRequestOptions
Returns​

Promise<GatewayInferenceCreatePromptCompletionResponse>

Example​
`await inference.createPromptCompletion('owned-prompt', { variables: { user_input: 'Hello' }, model: '@provider/model', max_completion_tokens: 16 });`

Call Signature​

createPromptCompletion(
promptId,
body,
options?): Promise<
| GatewayInferenceCreatePromptCompletionResponse
| GatewayStream<GatewayInferenceCreatePromptCompletionStreamResponse>>;

Defined in: src/ai-gateway/inference-client.ts:341

Experimental

Execute a saved prompt with variables and optional root-level parameter overrides. Route and handler dispatch confirmed in the deployed gateway; no owned template has been live-certified. Outside stability guarantees until live-verified. JSON may be a native chat/text completion or the upstream status/headers/body wrapper. Streaming emits native chat or legacy completion events, terminated by [DONE].

Parameters​
ParameterType
promptIdstring
bodyGatewayInferenceInputCreatePromptCompletionRequest
options?GatewayInferenceRequestOptions
Returns​

Promise< | GatewayInferenceCreatePromptCompletionResponse | GatewayStream<GatewayInferenceCreatePromptCompletionStreamResponse>>

Example​
`await inference.createPromptCompletion('owned-prompt', { variables: { user_input: 'Hello' }, model: '@provider/model', max_completion_tokens: 16 });`

createPromptRender()​

createPromptRender(
promptId,
body,
options?): Promise<GatewayInferencePromptRenderResponse>;

Defined in: src/ai-gateway/inference-client.ts:386

Experimental

Render a saved prompt without making a completion request. The deployed route is registered; successful rendering of an owned template remains unverified. Outside stability guarantees until live-verified.

Parameters​

ParameterType
promptIdstring
bodyGatewayInferenceInputCreatePromptRenderRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferencePromptRenderResponse>

Example​

`await inference.createPromptRender('owned-prompt', { variables: { user_input: 'Hello' } });`

createChatCompletion()​

Call Signature​

createChatCompletion(body, options?): Promise<GatewayStream<GatewayInferenceCreateChatCompletionStreamResponse>>;

Defined in: src/ai-gateway/inference-client.ts:404

Create a chat completion. stream=true returns a cancellable async iterator.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateChatCompletionRequest & { stream: true; }
options?GatewayInferenceRequestOptions
Returns​

Promise<GatewayStream<GatewayInferenceCreateChatCompletionStreamResponse>>

Example​
`const result = await inference.createChatCompletion({ model: '@provider/model', messages: [{ role: 'user', content: 'Hello' }] });`

Call Signature​

createChatCompletion(body, options?): Promise<GatewayInferenceCreateChatCompletionResponse>;

Defined in: src/ai-gateway/inference-client.ts:408

Create a chat completion. stream=true returns a cancellable async iterator.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateChatCompletionRequest & { stream?: false | null; }
options?GatewayInferenceRequestOptions
Returns​

Promise<GatewayInferenceCreateChatCompletionResponse>

Example​
`const result = await inference.createChatCompletion({ model: '@provider/model', messages: [{ role: 'user', content: 'Hello' }] });`

Call Signature​

createChatCompletion(body, options?): Promise<
| GatewayInferenceCreateChatCompletionResponse
| GatewayStream<GatewayInferenceCreateChatCompletionStreamResponse>>;

Defined in: src/ai-gateway/inference-client.ts:412

Create a chat completion. stream=true returns a cancellable async iterator.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateChatCompletionRequest
options?GatewayInferenceRequestOptions
Returns​

Promise< | GatewayInferenceCreateChatCompletionResponse | GatewayStream<GatewayInferenceCreateChatCompletionStreamResponse>>

Example​
`const result = await inference.createChatCompletion({ model: '@provider/model', messages: [{ role: 'user', content: 'Hello' }] });`

createEmbedding()​

createEmbedding(body, options?): Promise<GatewayInferenceCreateEmbeddingResponse>;

Defined in: src/ai-gateway/inference-client.ts:444

Create embeddings without converting base64 output to a different wire representation.

Parameters​

ParameterType
bodyGatewayInferenceInputCreateEmbeddingRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceCreateEmbeddingResponse>

Example​

`const result = await inference.createEmbedding({ model: '@provider/embedding', input: 'Hello', encoding_format: 'float' });`

createResponse()​

Call Signature​

createResponse(body, options?): Promise<GatewayStream<GatewayInferenceResponseStreamEvent>>;

Defined in: src/ai-gateway/inference-client.ts:461

Create a Responses API result, or a cancellable stream of typed lifecycle events.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateResponse & { stream: true; }
options?GatewayInferenceRequestOptions
Returns​

Promise<GatewayStream<GatewayInferenceResponseStreamEvent>>

Example​
`const result = await inference.createResponse({ model: '@provider/model', input: 'Hello', store: false });`

Call Signature​

createResponse(body, options?): Promise<GatewayInferenceResponse>;

Defined in: src/ai-gateway/inference-client.ts:465

Create a Responses API result, or a cancellable stream of typed lifecycle events.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateResponse & { stream?: false | null; }
options?GatewayInferenceRequestOptions
Returns​

Promise<GatewayInferenceResponse>

Example​
`const result = await inference.createResponse({ model: '@provider/model', input: 'Hello', store: false });`

Call Signature​

createResponse(body, options?): Promise<
| GatewayInferenceResponse
| GatewayStream<GatewayInferenceResponseStreamEvent>>;

Defined in: src/ai-gateway/inference-client.ts:469

Create a Responses API result, or a cancellable stream of typed lifecycle events.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateResponse
options?GatewayInferenceRequestOptions
Returns​

Promise< | GatewayInferenceResponse | GatewayStream<GatewayInferenceResponseStreamEvent>>

Example​
`const result = await inference.createResponse({ model: '@provider/model', input: 'Hello', store: false });`

createImage()​

createImage(body, options?): Promise<GatewayInferenceImagesResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:155

Experimental

POST /images/generations. Provider routing uses options.headers['x-portkey-provider']. Offline JSON contract only. The prescribed-model generation probe returned HTTP 400; no alternate model used. Outside stability guarantees until live-verified.

Parameters​

ParameterType
bodyGatewayInferenceInputCreateImageRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceImagesResponse>

Example​

`await inference.createImage(body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createImage

createImageEdit()​

createImageEdit(body, options?): Promise<GatewayInferenceImagesResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:173

Experimental

POST /images/edits. Provider routing uses options.headers['x-portkey-provider']. Offline multipart contract only. The prescribed-model edit probe returned HTTP 400; successful live editing is unverified. Outside stability guarantees until live-verified.

Parameters​

ParameterType
bodyGatewayInferenceInputCreateImageEditRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceImagesResponse>

Example​

`await inference.createImageEdit(body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createImageEdit

createImageVariation()​

createImageVariation(body, options?): Promise<GatewayInferenceImagesResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:192

Experimental

POST /images/variations. Provider routing uses options.headers['x-portkey-provider']. Offline multipart contract only. The prescribed-model variation probe returned HTTP 404; successful live variation is unverified. Outside stability guarantees until live-verified.

Parameters​

ParameterType
bodyGatewayInferenceInputCreateImageVariationRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceImagesResponse>

Example​

`await inference.createImageVariation(body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createImageVariation

createRerank()​

createRerank(body, options?): Promise<GatewayInferenceCreateRerankResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:211

Experimental

POST /rerank. Provider routing uses options.headers['x-portkey-provider']. Offline JSON contract only. The prescribed-provider rerank probe returned HTTP 500; no different provider was configured. Outside stability guarantees until live-verified.

Parameters​

ParameterType
bodyGatewayInferenceInputCreateRerankRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceCreateRerankResponse>

Example​

`await inference.createRerank(body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createRerank

createOcr()​

createOcr(body, options?): Promise<GatewayInferenceCreateOcrResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:229

Experimental

POST /ocr. Provider routing uses options.headers['x-portkey-provider']. Offline JSON contract only. The prescribed-provider OCR probe returned HTTP 500; no different provider was configured. Outside stability guarantees until live-verified.

Parameters​

ParameterType
bodyGatewayInferenceInputCreateOcrRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceCreateOcrResponse>

Example​

`await inference.createOcr(body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createOcr

createSpeech()​

createSpeech(body, options?): Promise<Uint8Array<ArrayBufferLike>>;

Defined in: src/ai-gateway/runtime-resources-client.ts:247

Experimental

POST /audio/speech. Provider routing uses options.headers['x-portkey-provider']. Offline binary-response contract only. The prescribed-model speech probe returned HTTP 404; no audio model was substituted. Outside stability guarantees until live-verified.

Parameters​

ParameterType
bodyGatewayInferenceInputCreateSpeechRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<Uint8Array<ArrayBufferLike>>

Example​

`await inference.createSpeech(body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createSpeech

createTranscription()​

Call Signature​

createTranscription(body, options?): Promise<GatewayInferenceCreateTranscriptionResponseJson>;

Defined in: src/ai-gateway/runtime-resources-client.ts:265

Experimental

POST /audio/transcriptions. Provider routing uses options.headers['x-portkey-provider']. Offline multipart/format-specific response contracts only. The prescribed-model transcription probe returned HTTP 400 with model incompatibility. Outside stability guarantees until live-verified.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateTranscriptionRequest & { response_format?: "json"; }
options?GatewayInferenceRequestOptions
Returns​

Promise<GatewayInferenceCreateTranscriptionResponseJson>

Example​
`await inference.createTranscription(body);`
Inherited from​
AIGatewayRuntimeResourcesClient.createTranscription

Call Signature​

createTranscription(body, options?): Promise<GatewayInferenceCreateTranscriptionResponseVerboseJson>;

Defined in: src/ai-gateway/runtime-resources-client.ts:269

Experimental

POST /audio/transcriptions. Provider routing uses options.headers['x-portkey-provider']. Offline multipart/format-specific response contracts only. The prescribed-model transcription probe returned HTTP 400 with model incompatibility. Outside stability guarantees until live-verified.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateTranscriptionRequest & { response_format: "verbose_json"; }
options?GatewayInferenceRequestOptions
Returns​

Promise<GatewayInferenceCreateTranscriptionResponseVerboseJson>

Example​
`await inference.createTranscription(body);`
Inherited from​
AIGatewayRuntimeResourcesClient.createTranscription

Call Signature​

createTranscription(body, options?): Promise<string>;

Defined in: src/ai-gateway/runtime-resources-client.ts:273

Experimental

POST /audio/transcriptions. Provider routing uses options.headers['x-portkey-provider']. Offline multipart/format-specific response contracts only. The prescribed-model transcription probe returned HTTP 400 with model incompatibility. Outside stability guarantees until live-verified.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateTranscriptionRequest & { response_format: "text" | "srt" | "vtt"; }
options?GatewayInferenceRequestOptions
Returns​

Promise<string>

Example​
`await inference.createTranscription(body);`
Inherited from​
AIGatewayRuntimeResourcesClient.createTranscription

Call Signature​

createTranscription(body, options?): Promise<
| string
| GatewayInferenceCreateTranscriptionResponseJson
| GatewayInferenceCreateTranscriptionResponseVerboseJson>;

Defined in: src/ai-gateway/runtime-resources-client.ts:279

Experimental

POST /audio/transcriptions. Provider routing uses options.headers['x-portkey-provider']. Offline multipart/format-specific response contracts only. The prescribed-model transcription probe returned HTTP 400 with model incompatibility. Outside stability guarantees until live-verified.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateTranscriptionRequest
options?GatewayInferenceRequestOptions
Returns​

Promise< | string | GatewayInferenceCreateTranscriptionResponseJson | GatewayInferenceCreateTranscriptionResponseVerboseJson>

Example​
`await inference.createTranscription(body);`
Inherited from​
AIGatewayRuntimeResourcesClient.createTranscription

createTranslation()​

Call Signature​

createTranslation(body, options?): Promise<GatewayInferenceCreateTranslationResponseJson>;

Defined in: src/ai-gateway/runtime-resources-client.ts:320

Experimental

POST /audio/translations. Provider routing uses options.headers['x-portkey-provider']. Offline multipart/format-specific response contracts only. The prescribed-model translation probe returned HTTP 400 with model incompatibility. Outside stability guarantees until live-verified.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateTranslationRequest & { response_format?: "json"; }
options?GatewayInferenceRequestOptions
Returns​

Promise<GatewayInferenceCreateTranslationResponseJson>

Example​
`await inference.createTranslation(body);`
Inherited from​
AIGatewayRuntimeResourcesClient.createTranslation

Call Signature​

createTranslation(body, options?): Promise<GatewayInferenceCreateTranslationResponseVerboseJson>;

Defined in: src/ai-gateway/runtime-resources-client.ts:324

Experimental

POST /audio/translations. Provider routing uses options.headers['x-portkey-provider']. Offline multipart/format-specific response contracts only. The prescribed-model translation probe returned HTTP 400 with model incompatibility. Outside stability guarantees until live-verified.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateTranslationRequest & { response_format: "verbose_json"; }
options?GatewayInferenceRequestOptions
Returns​

Promise<GatewayInferenceCreateTranslationResponseVerboseJson>

Example​
`await inference.createTranslation(body);`
Inherited from​
AIGatewayRuntimeResourcesClient.createTranslation

Call Signature​

createTranslation(body, options?): Promise<string>;

Defined in: src/ai-gateway/runtime-resources-client.ts:328

Experimental

POST /audio/translations. Provider routing uses options.headers['x-portkey-provider']. Offline multipart/format-specific response contracts only. The prescribed-model translation probe returned HTTP 400 with model incompatibility. Outside stability guarantees until live-verified.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateTranslationRequest & { response_format: "text" | "srt" | "vtt"; }
options?GatewayInferenceRequestOptions
Returns​

Promise<string>

Example​
`await inference.createTranslation(body);`
Inherited from​
AIGatewayRuntimeResourcesClient.createTranslation

Call Signature​

createTranslation(body, options?): Promise<
| string
| GatewayInferenceCreateTranslationResponseJson
| GatewayInferenceCreateTranslationResponseVerboseJson>;

Defined in: src/ai-gateway/runtime-resources-client.ts:334

Experimental

POST /audio/translations. Provider routing uses options.headers['x-portkey-provider']. Offline multipart/format-specific response contracts only. The prescribed-model translation probe returned HTTP 400 with model incompatibility. Outside stability guarantees until live-verified.

Parameters​
ParameterType
bodyGatewayInferenceInputCreateTranslationRequest
options?GatewayInferenceRequestOptions
Returns​

Promise< | string | GatewayInferenceCreateTranslationResponseJson | GatewayInferenceCreateTranslationResponseVerboseJson>

Example​
`await inference.createTranslation(body);`
Inherited from​
AIGatewayRuntimeResourcesClient.createTranslation

listFiles()​

listFiles(opts?, options?): Promise<GatewayInferenceListFilesResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:374

GET /files. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
optsGatewayInferenceInputListFilesQuery
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceListFilesResponse>

Example​

`await inference.listFiles({});`

Inherited from​

AIGatewayRuntimeResourcesClient.listFiles

createFile()​

createFile(body, options?): Promise<GatewayInferenceOpenAIFile>;

Defined in: src/ai-gateway/runtime-resources-client.ts:390

POST /files. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
bodyGatewayInferenceInputCreateFileRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceOpenAIFile>

Example​

`await inference.createFile(body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createFile

deleteFile()​

deleteFile(file_id, options?): Promise<GatewayInferenceDeleteFileResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:408

DELETE /files/{file_id}. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
file_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceDeleteFileResponse>

Example​

`await inference.deleteFile('resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.deleteFile

retrieveFile()​

retrieveFile(file_id, options?): Promise<GatewayInferenceOpenAIFile>;

Defined in: src/ai-gateway/runtime-resources-client.ts:423

GET /files/{file_id}. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
file_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceOpenAIFile>

Example​

`await inference.retrieveFile('resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.retrieveFile

downloadFile()​

downloadFile(file_id, options?): Promise<Uint8Array<ArrayBufferLike>>;

Defined in: src/ai-gateway/runtime-resources-client.ts:438

GET /files/{file_id}/content. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
file_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<Uint8Array<ArrayBufferLike>>

Example​

`await inference.downloadFile('resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.downloadFile

createFineTuningJob()​

createFineTuningJob(body, options?): Promise<GatewayInferenceFineTuningJob>;

Defined in: src/ai-gateway/runtime-resources-client.ts:454

Experimental

POST /fine_tuning/jobs. Provider routing uses options.headers['x-portkey-provider']. No training job was started. The designated inference model does not support fine-tuning; offline contract only. Outside stability guarantees until live-verified.

Parameters​

ParameterType
bodyGatewayInferenceInputCreateFineTuningJobRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceFineTuningJob>

Example​

`await inference.createFineTuningJob(body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createFineTuningJob

listPaginatedFineTuningJobs()​

listPaginatedFineTuningJobs(opts?, options?): Promise<GatewayInferenceListPaginatedFineTuningJobsResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:471

GET /fine_tuning/jobs. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
optsGatewayInferenceInputListPaginatedFineTuningJobsQuery
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceListPaginatedFineTuningJobsResponse>

Example​

`await inference.listPaginatedFineTuningJobs({});`

Inherited from​

AIGatewayRuntimeResourcesClient.listPaginatedFineTuningJobs

retrieveFineTuningJob()​

retrieveFineTuningJob(fine_tuning_job_id, options?): Promise<GatewayInferenceFineTuningJob>;

Defined in: src/ai-gateway/runtime-resources-client.ts:488

Experimental

GET /fine_tuning/jobs/{fine_tuning_job_id}. Provider routing uses options.headers['x-portkey-provider']. No owned training job was available; offline contract only. Outside stability guarantees until live-verified.

Parameters​

ParameterType
fine_tuning_job_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceFineTuningJob>

Example​

`await inference.retrieveFineTuningJob('resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.retrieveFineTuningJob

listFineTuningEvents()​

listFineTuningEvents(
fine_tuning_job_id,
opts?,
options?): Promise<GatewayInferenceListFineTuningJobEventsResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:504

Experimental

GET /fine_tuning/jobs/{fine_tuning_job_id}/events. Provider routing uses options.headers['x-portkey-provider']. No owned training job was available; offline contract only. Outside stability guarantees until live-verified.

Parameters​

ParameterType
fine_tuning_job_idstring
optsGatewayInferenceInputListFineTuningEventsQuery
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceListFineTuningJobEventsResponse>

Example​

`await inference.listFineTuningEvents('resource-id', {});`

Inherited from​

AIGatewayRuntimeResourcesClient.listFineTuningEvents

cancelFineTuningJob()​

cancelFineTuningJob(fine_tuning_job_id, options?): Promise<GatewayInferenceFineTuningJob>;

Defined in: src/ai-gateway/runtime-resources-client.ts:522

Experimental

POST /fine_tuning/jobs/{fine_tuning_job_id}/cancel. Provider routing uses options.headers['x-portkey-provider']. No owned training job was available; existing jobs were not changed. Offline contract only. Outside stability guarantees until live-verified.

Parameters​

ParameterType
fine_tuning_job_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceFineTuningJob>

Example​

`await inference.cancelFineTuningJob('resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.cancelFineTuningJob

listFineTuningJobCheckpoints()​

listFineTuningJobCheckpoints(
fine_tuning_job_id,
opts?,
options?): Promise<GatewayInferenceListFineTuningJobCheckpointsResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:538

Experimental

GET /fine_tuning/jobs/{fine_tuning_job_id}/checkpoints. Provider routing uses options.headers['x-portkey-provider']. No owned training job checkpoints were available; offline contract only. Outside stability guarantees until live-verified.

Parameters​

ParameterType
fine_tuning_job_idstring
optsGatewayInferenceInputListFineTuningJobCheckpointsQuery
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceListFineTuningJobCheckpointsResponse>

Example​

`await inference.listFineTuningJobCheckpoints('resource-id', {});`

Inherited from​

AIGatewayRuntimeResourcesClient.listFineTuningJobCheckpoints

listModels()​

listModels(opts?, options?): Promise<GatewayInferenceListModelsResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:555

GET /models. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
optsGatewayInferenceInputListModelsQuery
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceListModelsResponse>

Example​

`await inference.listModels({});`

Inherited from​

AIGatewayRuntimeResourcesClient.listModels

retrieveModel()​

retrieveModel(model, options?): Promise<GatewayInferenceModel>;

Defined in: src/ai-gateway/runtime-resources-client.ts:571

GET /models/{model}. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
modelstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceModel>

Example​

`await inference.retrieveModel('resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.retrieveModel

deleteModel()​

deleteModel(model, options?): Promise<GatewayInferenceDeleteModelResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:587

Experimental

DELETE /models/{model}. Provider routing uses options.headers['x-portkey-provider']. No owned fine-tuned model was provisioned for deletion; offline contract only. Outside stability guarantees until live-verified.

Parameters​

ParameterType
modelstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceDeleteModelResponse>

Example​

`await inference.deleteModel('resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.deleteModel

createModeration()​

createModeration(body, options?): Promise<GatewayInferenceCreateModerationResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:603

Experimental

POST /moderations. Provider routing uses options.headers['x-portkey-provider']. Offline JSON contract only. The prescribed-model moderation probe returned HTTP 400; no specialized model was substituted. Outside stability guarantees until live-verified.

Parameters​

ParameterType
bodyGatewayInferenceInputCreateModerationRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceCreateModerationResponse>

Example​

`await inference.createModeration(body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createModeration

getResponse()​

getResponse(
response_id,
opts?,
options?): Promise<GatewayInferenceResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:620

GET /responses/{response_id}. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
response_idstring
optsGatewayInferenceInputGetResponseQuery
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceResponse>

Example​

`await inference.getResponse('resource-id', {});`

Inherited from​

AIGatewayRuntimeResourcesClient.getResponse

deleteResponse()​

deleteResponse(response_id, options?): Promise<void>;

Defined in: src/ai-gateway/runtime-resources-client.ts:637

DELETE /responses/{response_id}. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
response_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<void>

Example​

`await inference.deleteResponse('resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.deleteResponse

listInputItems()​

listInputItems(
response_id,
opts?,
options?): Promise<GatewayInferenceResponseItemList>;

Defined in: src/ai-gateway/runtime-resources-client.ts:651

GET /responses/{response_id}/input_items. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
response_idstring
optsGatewayInferenceInputListInputItemsQuery
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceResponseItemList>

Example​

`await inference.listInputItems('resource-id', {});`

Inherited from​

AIGatewayRuntimeResourcesClient.listInputItems

listVectorStores()​

listVectorStores(opts?, options?): Promise<GatewayInferenceListVectorStoresResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:668

GET /vector_stores. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
optsGatewayInferenceInputListVectorStoresQuery
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceListVectorStoresResponse>

Example​

`await inference.listVectorStores({});`

Inherited from​

AIGatewayRuntimeResourcesClient.listVectorStores

createVectorStore()​

createVectorStore(body, options?): Promise<GatewayInferenceVectorStoreObject>;

Defined in: src/ai-gateway/runtime-resources-client.ts:684

POST /vector_stores. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
bodyGatewayInferenceInputCreateVectorStoreRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceVectorStoreObject>

Example​

`await inference.createVectorStore(body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createVectorStore

getVectorStore()​

getVectorStore(vector_store_id, options?): Promise<GatewayInferenceVectorStoreObject>;

Defined in: src/ai-gateway/runtime-resources-client.ts:701

GET /vector_stores/{vector_store_id}. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
vector_store_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceVectorStoreObject>

Example​

`await inference.getVectorStore('resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.getVectorStore

modifyVectorStore()​

modifyVectorStore(
vector_store_id,
body,
options?): Promise<GatewayInferenceVectorStoreObject>;

Defined in: src/ai-gateway/runtime-resources-client.ts:716

POST /vector_stores/{vector_store_id}. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
vector_store_idstring
bodyGatewayInferenceInputUpdateVectorStoreRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceVectorStoreObject>

Example​

`await inference.modifyVectorStore('resource-id', body);`

Inherited from​

AIGatewayRuntimeResourcesClient.modifyVectorStore

deleteVectorStore()​

deleteVectorStore(vector_store_id, options?): Promise<GatewayInferenceDeleteVectorStoreResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:734

DELETE /vector_stores/{vector_store_id}. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
vector_store_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceDeleteVectorStoreResponse>

Example​

`await inference.deleteVectorStore('resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.deleteVectorStore

listVectorStoreFiles()​

listVectorStoreFiles(
vector_store_id,
opts?,
options?): Promise<GatewayInferenceListVectorStoreFilesResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:749

GET /vector_stores/{vector_store_id}/files. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
vector_store_idstring
optsGatewayInferenceInputListVectorStoreFilesQuery
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceListVectorStoreFilesResponse>

Example​

`await inference.listVectorStoreFiles('resource-id', {});`

Inherited from​

AIGatewayRuntimeResourcesClient.listVectorStoreFiles

createVectorStoreFile()​

createVectorStoreFile(
vector_store_id,
body,
options?): Promise<GatewayInferenceVectorStoreFileObject>;

Defined in: src/ai-gateway/runtime-resources-client.ts:766

POST /vector_stores/{vector_store_id}/files. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
vector_store_idstring
bodyGatewayInferenceInputCreateVectorStoreFileRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceVectorStoreFileObject>

Example​

`await inference.createVectorStoreFile('resource-id', body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createVectorStoreFile

getVectorStoreFile()​

getVectorStoreFile(
vector_store_id,
file_id,
options?): Promise<GatewayInferenceVectorStoreFileObject>;

Defined in: src/ai-gateway/runtime-resources-client.ts:784

GET /vector_stores/{vector_store_id}/files/{file_id}. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
vector_store_idstring
file_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceVectorStoreFileObject>

Example​

`await inference.getVectorStoreFile('resource-id', 'resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.getVectorStoreFile

deleteVectorStoreFile()​

deleteVectorStoreFile(
vector_store_id,
file_id,
options?): Promise<GatewayInferenceDeleteVectorStoreFileResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:800

DELETE /vector_stores/{vector_store_id}/files/{file_id}. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
vector_store_idstring
file_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceDeleteVectorStoreFileResponse>

Example​

`await inference.deleteVectorStoreFile('resource-id', 'resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.deleteVectorStoreFile

createVectorStoreFileBatch()​

createVectorStoreFileBatch(
vector_store_id,
body,
options?): Promise<GatewayInferenceVectorStoreFileBatchObject>;

Defined in: src/ai-gateway/runtime-resources-client.ts:816

POST /vector_stores/{vector_store_id}/file_batches. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
vector_store_idstring
bodyGatewayInferenceInputCreateVectorStoreFileBatchRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceVectorStoreFileBatchObject>

Example​

`await inference.createVectorStoreFileBatch('resource-id', body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createVectorStoreFileBatch

getVectorStoreFileBatch()​

getVectorStoreFileBatch(
vector_store_id,
batch_id,
options?): Promise<GatewayInferenceVectorStoreFileBatchObject>;

Defined in: src/ai-gateway/runtime-resources-client.ts:834

GET /vector_stores/{vector_store_id}/file_batches/{batch_id}. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
vector_store_idstring
batch_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceVectorStoreFileBatchObject>

Example​

`await inference.getVectorStoreFileBatch('resource-id', 'resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.getVectorStoreFileBatch

cancelVectorStoreFileBatch()​

cancelVectorStoreFileBatch(
vector_store_id,
batch_id,
options?): Promise<GatewayInferenceVectorStoreFileBatchObject>;

Defined in: src/ai-gateway/runtime-resources-client.ts:851

Experimental

POST /vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel. Provider routing uses options.headers['x-portkey-provider']. The owned file-batch cancellation endpoint returned HTTP 500; successful cancellation remains unverified. Create, completed retrieval and file listing passed. Outside stability guarantees until live-verified.

Parameters​

ParameterType
vector_store_idstring
batch_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceVectorStoreFileBatchObject>

Example​

`await inference.cancelVectorStoreFileBatch('resource-id', 'resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.cancelVectorStoreFileBatch

listFilesInVectorStoreBatch()​

listFilesInVectorStoreBatch(
vector_store_id,
batch_id,
opts?,
options?): Promise<GatewayInferenceListVectorStoreFilesResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:867

GET /vector_stores/{vector_store_id}/file_batches/{batch_id}/files. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
vector_store_idstring
batch_idstring
optsGatewayInferenceInputListFilesInVectorStoreBatchQuery
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceListVectorStoreFilesResponse>

Example​

`await inference.listFilesInVectorStoreBatch('resource-id', 'resource-id', {});`

Inherited from​

AIGatewayRuntimeResourcesClient.listFilesInVectorStoreBatch

createBatch()​

createBatch(body, options?): Promise<GatewayInferenceBatch>;

Defined in: src/ai-gateway/runtime-resources-client.ts:885

POST /batches. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
bodyGatewayInferenceInputCreateBatchRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceBatch>

Example​

`await inference.createBatch(body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createBatch

listBatches()​

listBatches(opts?, options?): Promise<GatewayInferenceListBatchesResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:902

GET /batches. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
optsGatewayInferenceInputListBatchesQuery
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceListBatchesResponse>

Example​

`await inference.listBatches({});`

Inherited from​

AIGatewayRuntimeResourcesClient.listBatches

getBatchOutput()​

getBatchOutput(batch_id, options?): Promise<Uint8Array<ArrayBufferLike>>;

Defined in: src/ai-gateway/runtime-resources-client.ts:918

GET /batches/{batch_id}/output. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
batch_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<Uint8Array<ArrayBufferLike>>

Example​

`await inference.getBatchOutput('resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.getBatchOutput

retrieveBatch()​

retrieveBatch(batch_id, options?): Promise<GatewayInferenceBatch>;

Defined in: src/ai-gateway/runtime-resources-client.ts:933

GET /batches/{batch_id}. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
batch_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceBatch>

Example​

`await inference.retrieveBatch('resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.retrieveBatch

cancelBatch()​

cancelBatch(batch_id, options?): Promise<GatewayInferenceBatch>;

Defined in: src/ai-gateway/runtime-resources-client.ts:948

POST /batches/{batch_id}/cancel. Provider routing uses options.headers['x-portkey-provider'].

Parameters​

ParameterType
batch_idstring
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceBatch>

Example​

`await inference.cancelBatch('resource-id');`

Inherited from​

AIGatewayRuntimeResourcesClient.cancelBatch

createFeedback()​

createFeedback(body, options?): Promise<GatewayInferenceFeedbackResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:963

POST /feedback. Verified on the explicit Prisma runtime endpoint with a runtime key, not SCM OAuth. No deletion API is declared; synthetic audit records may persist.

Parameters​

ParameterType
bodyGatewayInferenceInputFeedbackRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceFeedbackResponse>

Example​

`await inference.createFeedback(body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createFeedback

updateFeedback()​

updateFeedback(
id,
body,
options?): Promise<GatewayInferenceFeedbackResponse>;

Defined in: src/ai-gateway/runtime-resources-client.ts:982

Experimental

PUT /feedback/{id}. Explicit Prisma runtime endpoint/key only, not SCM OAuth. Successful response shapes are upstream contracts, not live-certified in this tenant. Uses the declared PUT operation, not the inconsistent POST curl sample. No automatic retry by default. Confirmed runtime handler; owned-record PUT returns HTTP 500 because feedback lookup requires uninitialized ClickHouse in control-plane storage mode. Typed contracts are experimental, not a successful live update. Outside stability guarantees until live-verified.

Parameters​

ParameterType
idstring
bodyGatewayInferenceInputFeedbackUpdateRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceFeedbackResponse>

Example​

`await inference.updateFeedback('550e8400-e29b-41d4-a716-446655440000', body);`

Inherited from​

AIGatewayRuntimeResourcesClient.updateFeedback

createLogs()​

createLogs(body, options?): Promise<string>;

Defined in: src/ai-gateway/runtime-resources-client.ts:1001

POST /logs. Verified on the explicit Prisma runtime endpoint with a runtime key, not SCM OAuth. No deletion API is declared; synthetic audit records may persist.

Parameters​

ParameterType
bodyGatewayInferenceInputCreateLogsRequest
optionsGatewayInferenceRequestOptions

Returns​

Promise<string>

Example​

`await inference.createLogs(body);`

Inherited from​

AIGatewayRuntimeResourcesClient.createLogs

getLog()​

getLog(
logId,
opts?,
options?): Promise<GatewayInferenceLogObject>;

Defined in: src/ai-gateway/runtime-resources-client.ts:1020

Experimental

GET /logs/{logId}. Explicit Prisma runtime endpoint/key only, not SCM OAuth. Successful response shapes are upstream contracts, not live-certified in this tenant. v2 storage paths require an ISO timestamp with a timezone; omit type for ordinary logs. Log bodies may contain sensitive data and are always omitted from SDK debug output. Confirmed runtime handler; owned-log reads return HTTP 500 because the deployed handler has no control-plane storage branch. Typed contracts and v2 timestamp validation are experimental, not successful live retrieval. Outside stability guarantees until live-verified.

Parameters​

ParameterType
logIdstring
optsGatewayInferenceInputGetLogQuery
optionsGatewayInferenceRequestOptions

Returns​

Promise<GatewayInferenceLogObject>

Example​

`await inference.getLog('resource-id', {});`

Inherited from​

AIGatewayRuntimeResourcesClient.getLog