Skip to main content
persona.providers — /api/v1/developer/providers. A Provider is an OpenAI-compatible endpoint + API key that Agents in your Project can reference. Control-plane only: there is no ExternalUser ownership concept for Providers.

Ownership & scoping

  • Providers are Domain-scoped, never per-user. On a runtime-plane client (externalUserId set), list() returns an empty array and get()/update()/delete()/testConnection()/ getModels() return a 404 PersonaApiError — not because the Provider doesn’t exist, but because that credential can never be its owner (existence-hiding, same as everywhere else).
  • list() has no pagination envelope and no page/limit/search params — Providers have no discovery concept, so it returns a plain Provider[].

Methods

create(input, idempotencyKey?)

Creates a new Provider. label, baseURL, apiKey, and defaultModel are required.
  • apiKey is write-only — it never appears on the returned Provider or any later response.
  • isDefault (optional, default false): at most one Provider per Domain may be the default. The default Provider is used as the fallback when an Agent has no providerId.
  • The optional trailing idempotencyKey is sent as the Idempotency-Key header — see Idempotency.

list()

Plain array, no pagination envelope — unlike every other resource’s list(). Same result whether or not the client asserts an external user.

get(providerId)

Fetches one Provider by its id (note: Providers use id, not _id). Throws PersonaApiError (404) if it doesn’t exist or isn’t owned by this credential’s Domain.

update(providerId, input)

Partially updates a Provider — only the fields you pass are changed.
  • apiKey is optional here: omitting it leaves the existing key untouched; passing a new one replaces the stored key entirely.

delete(providerId)

Deletes a Provider. Rejects with PersonaApiError if any Agent still references it — call getUsage() first to check. Returns void.

testConnection(providerId)

Makes a live call to the Provider’s endpoint to verify baseURL/apiKey work.
  • Returns { success: boolean, message: string }.
  • success: false means the call reached the endpoint but it rejected the credentials/URL — that’s a result, not a thrown error. A genuinely unreachable endpoint (DNS failure, etc.) throws instead.

getModels(providerId)

Lists the models this Provider’s endpoint reports as available — e.g. for populating a model picker in your own UI. Returns ProviderModel[] where ProviderModel is { id: string }.

getUsage(providerId)

Returns ResourceUsage — the Agents referencing this Provider. agentCount is the real total; agents is a preview capped at 20 entries. Check this before delete() to avoid a blocked-delete error.

bulkDelete(ids)

Best-effort batch delete — partial failures (e.g. a Provider still referenced by an Agent) don’t throw or abort the rest of the batch.
  • Up to 100 ids per call — a request over that limit is rejected with a 400 before anything is deleted.
  • Returns { deleted: string[], failed: { id, reason }[] }.

Complete example