AI Gateway Admin
post/ai/providers

Request

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

Request body

api_keystring

Provider API key. Optional only for self-hosted providers that run without authentication.

base_urlstring nullable

Required for "openai_compatible", e.g. "http://10.0.0.5:8000/v1".

default_modelstring nullable

Model id to pin for this provider (e.g. "gpt-4o-mini"). Required for "openai_compatible": it must be one of the models the server lists (see POST /ai/providers/discover), and is used to verify the key.

display_namestring required
providerstring required

"openai", "anthropic", "xai", "gemini", "openrouter", or "openai_compatible" for a self-hosted OpenAI-compatible server.

trust_private_addressboolean

Trust the exact private ip:port of base_url for this key only, without adding it to the instance-wide trusted private networks. Requires the settings:write permission; the base URL must use an IP address. Cloud metadata and link-local addresses can never be trusted.

Response

Provider key created

api_key_maskedstring required

Masked API key (only last 4 chars visible)

base_urlstring nullable
created_atstring required
default_modelstring nullable

Model id this provider serves (NULL → per-provider default).

display_namestring required
idinteger required
is_activeboolean required
providerstring required
trusted_private_addressstring nullable

Exact private ip:port this key may reach without that address being in the instance-wide trusted private networks. None when not set.

trusted_private_address_set_atstring nullable

When the per-key trust was set (ISO 8601).

trusted_private_address_set_byinteger nullable

User who set the per-key trust.

updated_atstring required

Changes

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      the request property became optional

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • breaking

      the request property became required

    • warning

      removed the request property

    • warning

      removed the request property

    • warning

      removed the optional property from the response with the status

    • warning

      removed the optional property from the response with the status

    • warning

      removed the optional property from the response with the status

    • warning

      removed the optional property from the response with the status