OpenAI

Detailed information on the OpenAI conversation component

Component format

A Dapr conversation.yaml component file has the following structure:

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: openai
spec:
  type: conversation.openai
  metadata:
  - name: key
    value: mykey
  - name: model
    value: gpt-4-turbo
  - name: endpoint
    value: 'https://api.openai.com/v1'
  - name: cacheTTL
    value: 10m
  # - name: apiType # Optional
  #   value: `azure`
  # - name: apiVersion # Optional
  #   value: '2025-01-01-preview'

Spec metadata fields

FieldRequiredDetailsExample
keyYAPI key for OpenAI.mykey
modelNThe OpenAI LLM to use. Defaults to gpt-4-turbo.gpt-4-turbo
endpointNCustom API endpoint URL for OpenAI API-compatible services. If not specified, the default OpenAI API endpoint is used. Required when apiType is set to azure.https://api.openai.com/v1, https://example.openai.azure.com/
cacheTTLNA time-to-live value for a prompt cache to expire. Uses Golang duration format.10m
apiTypeNSpecifies the API provider type. Required when using a provider that does not follow the default OpenAI API endpoint conventions.azure
apiVersionNThe API version to use. Required when the apiType is set to azure.2025-04-01-preview