Back to Onyx

generated by https://github.com/hashicorp/terraform-plugin-docs

terraform-provider-onyx/docs/resources/llm_provider.md

4.6.0-cloud.03.8 KB
Original Source

onyx_llm_provider (Resource)

An Onyx LLM provider (OpenAI, Anthropic, Azure, Bedrock, ...) with its enabled models. model_configurations is the full list of record: models omitted from it are removed server-side on apply, and removing the model that is currently the deployment default fails validation — repoint the default first. api_key and custom_config are masked by the API on read, so out-of-band changes to them cannot be detected as drift.

Example Usage

terraform
resource "onyx_llm_provider" "openai" {
  name          = "openai-prod"
  provider_type = "openai"
  api_key       = var.openai_api_key

  # The complete set of enabled models: anything omitted here is
  # removed from the provider on apply.
  model_configurations = [
    { name = "gpt-5" },
    {
      name                = "gpt-5-mini"
      custom_display_name = "GPT-5 Mini (cheap tier)"
    },
    {
      name       = "gpt-5-nano"
      is_visible = false
    },
  ]
}
<!-- schema generated by tfplugindocs -->

Schema

Required

  • model_configurations (Attributes Set) The complete set of models enabled on this provider. Applies replace the server-side list with exactly this set. (see below for nested schema)
  • provider_type (String) LiteLLM provider key, e.g. openai, anthropic, azure, bedrock, vertex_ai, ollama. Must be lowercase.

Optional

  • api_base (String) Custom API base URL (e.g. for Azure or self-hosted gateways).
  • api_key (String, Sensitive) Provider API key. The Onyx API masks this on read, so Terraform cannot detect out-of-band changes; the configured value is authoritative.
  • api_version (String) API version (Azure).
  • custom_config (Map of String, Sensitive) Provider-specific config key/values (e.g. Vertex service-account JSON, Bedrock credentials). Masked on read like api_key.
  • deployment_name (String) Deployment name (Azure).
  • force_delete (Boolean) Allow destroying this provider even while it holds the deployment default model. Defaults to false, where such a destroy fails.
  • groups (Set of Number) User group ids the provider is restricted to (EE).
  • is_auto_mode (Boolean) Onyx Auto mode: the model list is managed by Onyx. When enabled, the server owns model_configurations: Terraform stops drift-checking the list, and updates re-assert the server's current models instead of the configured ones, so registry-managed models are never removed.
  • is_public (Boolean) Whether the provider is available to all users.
  • name (String) Display name for the provider configuration.
  • personas (Set of Number) Persona ids the provider is restricted to.

Read-Only

  • id (String) Numeric provider id.

<a id="nestedatt--model_configurations"></a>

Nested Schema for model_configurations

Required:

  • name (String) Model name as known to the provider, e.g. gpt-5-mini.

Optional:

  • custom_display_name (String) Admin-specified display-name override.
  • display_name (String) Source-API display name (dynamic providers such as OpenRouter/Ollama).
  • is_visible (Boolean) Whether the model is selectable in the UI.
  • max_input_tokens (Number) Override for the model's max input tokens; unset uses the model's known default.
  • supports_image_input (Boolean) Override for image-input support; unset lets Onyx infer it.
  • supports_reasoning (Boolean) Override for reasoning-model classification; unset lets Onyx infer it.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

shell
#!/bin/sh
# Import by numeric provider id. api_key/custom_config are masked by the
# API and stay null until set in configuration.
terraform import onyx_llm_provider.openai 3