---
title: "POST /ai/providers/test"
method: POST
path: "/ai/providers/test"
tags: ["AI Gateway Admin"]
---

# POST /ai/providers/test

`POST /ai/providers/test`

## Request

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

## Request body

- TestProviderKeyRequest
  - `api_key` string, password: The raw API key to test (may be empty for a self-hosted provider)
  - `base_url` string, nullable: Optional custom base URL (required for "openai_compatible")
  - `default_model` string, nullable: Model to send the test completion to. Required for "openai_compatible"; defaults to a small vendor model otherwise.
  - `provider` string, required: Provider ID: "openai", "anthropic", "xai", "gemini", "openrouter", "openai_compatible"
  - `trust_private_address` boolean: Test as if the base URL's exact private address were trusted on the key. Requires `settings:write`.

## Response `200`

Test result

- TestProviderKeyResponse
  - `error` string, nullable: Error message if the test failed
  - `latency_ms` integer, required: Response time in milliseconds
  - `provider` string, required
  - `success` boolean, required

## Other responses

- `400`: Validation error
- `401`: Unauthorized
- `403`: Insufficient permissions

## Changes

- **2026-11-09** `12896146b193`: 3 breaking
  - removed the required property `extensions` from the response with the `400` status
  - removed the required property `extensions` from the response with the `401` status
  - removed the required property `extensions` from the response with the `403` status
- **2026-10-23** `7d41b820a372`: 1 breaking
  - the `api_key` request property format changed from no format to `password`
- **2026-10-23** `24af93ff5379`: 1 info
  - the `api_key` request property format was generalized from `password` to no format
- **2026-10-22** `842d42ed4659`: 1 breaking
  - the `api_key` request property format changed from no format to `password`
- **2026-10-22** `1a12a50b75ee`: 1 info
  - the `api_key` request property format was generalized from `password` to no format

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/ai/providers/test/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
