Delete an AI provider
DELETE/v1/projects/:project_id/ai-providers/:ai_provider_id
Deletes an AI provider configuration.
Live references — the provider project's agents, model routes whose targets name this provider, and providers whose model_aliases forward to it (meta.ai_provider_ids) — always block deletion with 409 AI_PROVIDER_HAS_DEPENDENTS; force does not override them, so delete or repoint those resources first. Soft dependents — price overrides, usage/generation records and shares another project has accepted — also block with 409 unless force=true, which deletes the provider's price overrides, revokes its shares and unlinks its usage history, preserving those rows: each usage event keeps the provider's id as its ai_provider_id. A grantee project's agents pinned to the provider fall back to that project's default route. The 409 body's error.meta reports the counts, a sample of offending IDs, and a forcible flag that is true when a force=true retry would succeed.
Request
Responses
- 204
- 400
- 401
- 403
- 404
- 409
- 429
- 500
- 502
- 4XX
AI provider deleted successfully
The request was malformed or failed validation.
Unauthorized
Forbidden
AI provider not found
The AI provider still has dependents. Live references always block; soft dependents block unless force=true. See error.meta for counts, offending IDs, and the forcible flag.
QUOTA_EXCEEDED — a requests quota on the calling API key or its project is spent for the window; Retry-After says when it reopens
Response Headers
Seconds until the quota window admits a request again
Unexpected server error — INTERNAL_ERROR, with the raw message never forwarded
The deployment's admission service is asked about this write and did not answer — ADMISSION_UNAVAILABLE; the write did not happen
The deployment's admission service refused this write — answered under the service's own 4xx status, with its code (matching ^[A-Za-z_][A-Za-z0-9_]{0,63}$, not necessarily an ERROR_CODES key), message and meta; the write did not happen. A status this operation also declares on its own is documented there