ReferenceTypeScript SDK

Providers

client.providers manages tenant-level LLM credential records. API keys are write-only: responses expose only keyFragment, never the secret or Vault identifier.

Overview

Provider types are openai, anthropic, openrouter, google, and custom. A custom Provider requires baseUrl. Provider type and key cannot be updated; create a replacement to change them.

Methods

create()

create(body: CreateProviderBody): Promise<ProviderResponse>POST /v1/providers. Requires name, providerType, apiKey, and baseUrl; pass null to select the provider type's default URL. A custom Provider requires a non-empty URL.

list()

list(): Promise<ProvidersResponse>GET /v1/providers. Unpaginated tenant configuration.

get()

get(id: string): Promise<ProviderResponse>GET /v1/providers/:id.

update()

update(id: string, body: UpdateProviderBody): Promise<ProviderResponse>PATCH /v1/providers/:id. At least one of name or baseUrl; null clears the base URL.

delete()

delete(id: string): Promise<void>DELETE /v1/providers/:id.

test()

test(body: TestProviderBody): Promise<ProviderTestResponse>POST /v1/providers/test. Tests supplied providerType, apiKey, model, and optional baseUrl without saving them.

testStored()

testStored(id: string, body: { model: string }): Promise<ProviderTestResponse>POST /v1/providers/:id/test. Uses the saved secret and configuration.

Types

ProviderResponse contains id, name, type, nullable base URL, key fragment, and timestamps. Tests return { ok: true, latencyMs } or { ok: false, error: { code, message } }; a failed credential test is a successful HTTP response. See objects and schemas.

Errors

Validation and naming conflicts are API errors. A test's expected Provider failure is represented by ok: false; transport or malformed requests still throw. See errors.

Example

import { BlazingAgents } from "@blazing-agents/sdk";
const client = new BlazingAgents({ apiKey: process.env.BLAZING_AGENTS_API_KEY! });

const test = await client.providers.test({
  providerType: "openai",
  apiKey: process.env.OPENAI_API_KEY!,
  model: "gpt-5-mini",
});
if (!test.ok) throw new Error(test.error.message);

const provider = await client.providers.create({
  name: "Production OpenAI",
  providerType: "openai",
  baseUrl: null,
  apiKey: process.env.OPENAI_API_KEY!,
});
console.log((await client.providers.list()).providers.length);
await client.providers.get(provider.id);
await client.providers.update(provider.id, { name: "Primary OpenAI" });
await client.providers.testStored(provider.id, { model: "gpt-5-mini" });
await client.providers.delete(provider.id);

On this page