dokploy_ai (Resource)
An AI provider configuration (Settings > AI): an OpenAI-compatible endpoint that Dokploy’s AI features call, for example to suggest a compose file or to analyze a deployment log.
~> Dokploy stores and returns api_key in cleartext. The attribute is sensitive, so Terraform does not print it, but anyone with API access to the server can read it. The api_key_wo companion keeps it out of the Terraform state.
~> Dokploy does not test the endpoint on create or update. A wrong URL, key, or model applies successfully and fails on the first AI request.
Example Usage
# An OpenAI-compatible endpoint for Dokploy's AI features (Settings > AI).
resource "dokploy_ai" "openai" {
name = "openai"
api_url = "https://api.openai.com/v1"
model = "gpt-4o-mini"
# Write-only: Terraform 1.11 or later. Change the version to send a new key.
api_key_wo = var.openai_api_key
api_key_wo_version = 1
}
# A self-hosted model, kept but switched off.
resource "dokploy_ai" "local" {
name = "ollama"
api_url = "http://ollama.internal:11434/v1"
model = "llama3"
api_key = "ollama"
is_enabled = false
}Schema
Required
api_url(String) Base URL of the OpenAI-compatible API, for examplehttps://api.openai.com/v1.model(String) Model name that Dokploy sends in each request, for examplegpt-4o-mini.name(String) Display name. Dokploy does not enforce a unique name.
Optional
NOTE: Write-only arguments are supported in Terraform 1.11 and later.
api_key(String, Sensitive) API key for the provider. Set this attribute orapi_key_wo.api_key_wo(String, Sensitive, Write-only) Write-only form ofapi_key. Terraform keeps it out of the plan and the state. It needs Terraform 1.11 or later. Set exactly one ofapi_keyandapi_key_wo. A new value reaches the server only whenapi_key_wo_versionchanges.api_key_wo_version(Number) Version ofapi_key_wo. Change it to send the currentapi_key_wovalue to the server. It needsapi_key_wo.is_enabled(Boolean) Whether Dokploy uses this configuration. Defaults totrue.verify_connection(Boolean) Test the connection withai.testConnectionbefore the provider creates or updates the record. If the test fails, the apply fails with the server message, and the provider writes nothing. The default is no check:nullandfalseboth skip the test. Dokploy stores no value for this attribute, soterraform importleaves itnull. The test sends a request to the endpoint with the key and the model, and it retries three times, so a failed test can take several seconds.
Read-Only
created_at(String) Creation timestamp from the server.id(String) AI configuration id.organization_id(String) Id of the organization that owns the configuration.
Import
Import is supported using the following syntax:
In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:
import {
to = dokploy_ai.openai
id = "uNiDiVmkdS0McHxXPUjCt"
}The terraform import command can be used, for example:
terraform import dokploy_ai.openai uNiDiVmkdS0McHxXPUjCt