# dokploy_ai (Data Source)

Looks up an AI provider configuration that already exists in Dokploy (Settings > AI):

```terraform
data "dokploy_ai" "main" {
  name = "openai"
}
```

~> **The data source does not expose the API key.** The attribute `api_key` exists on the `dokploy_ai` resource, but not here, by design. A consumer needs only the id.

~> Dokploy does not enforce name uniqueness. If two AI provider configurations share a name, this data source fails instead of a guess. Look the record up by `id` in that case.

## Example Usage

```terraform
data "dokploy_ai" "example" {
  id = "your-ai-id"
}

data "dokploy_ai" "main" {
  name = "openai"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `id` (String) AI provider configuration id. Set it for a lookup by id, or leave it unset and set `name`.
- `name` (String) Display name as shown in Dokploy. Set exactly one of `id` or `name`.

### Read-Only

- `api_url` (String) Base URL of the OpenAI-compatible endpoint.
- `created_at` (String) Creation timestamp from the server.
- `is_enabled` (Boolean) Whether Dokploy uses the configuration.
- `model` (String) Model that Dokploy requests.
- `organization_id` (String) Id of the organization that owns the configuration.