--- type: docs title: "OpenAI" linkTitle: "OpenAI" description: Detailed information on the OpenAI conversation component --- ## Component format A Dapr `conversation.yaml` component file has the following structure: ```yaml 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' ``` {{% alert title="Warning" color="warning" %}} The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets, as described [here]({{% ref component-secrets.md %}}). {{% /alert %}} ## Spec metadata fields | Field | Required | Details | Example | |--------------------|:--------:|---------|---------| | `key` | Y | API key for OpenAI. | `mykey` | | `model` | N | The OpenAI LLM to use. Defaults to `gpt-4-turbo`. | `gpt-4-turbo` | | `endpoint` | N | Custom 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/` | | `cacheTTL` | N | A time-to-live value for a prompt cache to expire. Uses Golang duration format. | `10m` | | `apiType` | N | Specifies the API provider type. Required when using a provider that does not follow the default OpenAI API endpoint conventions. | `azure` | | `apiVersion`| N | The API version to use. Required when the `apiType` is set to `azure`. | `2025-04-01-preview` | ## Related links - [Conversation API overview]({{% ref conversation-overview.md %}}) - [Azure OpenAI in Azure AI Foundry Models API lifecycle](https://learn.microsoft.com/azure/ai-foundry/openai/api-version-lifecycle)