Agents

Save (or replace) a provider's credential. The credential is encrypted with `EncryptionService` and stored inside `agent_sandbox.providers[provider_id].credentials_encrypted`.

The plaintext shape depends on the flavor's credential_format:

  • ApiKey / OauthToken: the key/token string.
  • ConfigFile: the full file body (e.g. OpenCode's auth.json).
post/settings/ai-providers/{provider_id}/credential

Request

  • Base URL: /api (relative, and the document was published on a file host, not at the API’s origin)
  • URL: /api/settings/ai-providers/{provider_id}/credential
  • Auth: HTTP bearer

Path parameters

provider_idstring required

AI provider ID

Request body

auth_typestring required

Auth flavor id (must match one of the provider's catalog entries).

credentialstring required

Plaintext credential body (API key, OAuth token, or full config file contents). Encrypted with EncryptionService before being persisted inside the agent_sandbox.providers JSON map.

verification_modelstring nullable

OpenCode model to test, in provider/model form. Omit to use the built-in minimal probe model. A successfully verified explicit model becomes this provider's workspace default.

Response

auth_typestring required
credential_verification_statusstring required
provider_idstring required
savedboolean required
verification_hintstring nullable

Changes

No recorded changes to this operation across all 50 revisions of this API.