Skip to main content

OpenAI

Type: conversation.openai

Status: alpha

Reference: https://docs.dapr.io/reference/components-reference/supported-conversation/openai/

Example

apiVersion: cra.diagrid.io/v1beta1
kind: Component
metadata:
name: <name>
spec:
type: conversation.openai
version: v1
metadata:
# API key for OpenAI.
- name: key
value: |
**********
# The type of API to use for the OpenAI service. This is required when using Azure OpenAI. (Optional)
#- name: apiType
# value: "gpt-4.1-nano"
# The API version to use for the Azure OpenAI service. This is required when using Azure OpenAI. (Optional)
#- name: apiVersion
# value: "2025-01-01-preview"
# A time-to-live value for a prompt cache to expire. Uses Golang durations (Optional)
#- name: cacheTTL
# value: "10m"
# Custom API endpoint URL for OpenAI API-compatible services. If not specified, the default OpenAI API endpoint will be used. (Optional)
#- name: endpoint
# value: "https://api.openai.com/v1"
# The OpenAI LLM to use. Configurable via OPENAI_MODEL environment variable. (Optional)
#- name: model
# value: "gpt-5-nano"

Authentication profiles

Available authentication profiles:

  • API Key

API Key

Authenticate using an API key

key (string)

Required - API key for OpenAI.

Example value:

**********

Metadata

apiType (string)

The type of API to use for the OpenAI service. This is required when using Azure OpenAI.

Default value: gpt-4.1-nano

Example value: azure

apiVersion (string)

The API version to use for the Azure OpenAI service. This is required when using Azure OpenAI.

Example value: 2025-01-01-preview

cacheTTL (string)

A time-to-live value for a prompt cache to expire. Uses Golang durations

Example value: 10m

endpoint (string)

Custom API endpoint URL for OpenAI API-compatible services. If not specified, the default OpenAI API endpoint will be used.

Example value: https://api.openai.com/v1

model (string)

The OpenAI LLM to use. Configurable via OPENAI_MODEL environment variable.

Default value: gpt-5-nano

Example value: gpt-5-nano