Skip to main content

Anthropic conversation

Type: conversation.anthropic

Status: alpha

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

Example​

apiVersion: cra.diagrid.io/v1beta1
kind: Component
metadata:
name: <name>
spec:
type: conversation.anthropic
version: v1
metadata:
# API key for Anthropic, or for the Microsoft Foundry resource when apiType is 'foundry'.
- name: key
value: |
**********
# The type of API to use. Set to 'foundry' to call Anthropic Claude models hosted on Microsoft Foundry; otherwise the public Anthropic API is used. (Optional)
#- name: apiType
# value: "anthropic"
# A time-to-live value for a prompt cache to expire. Uses Golang durations (Optional)
#- name: cacheTTL
# value: "10m"
# Custom base URL for the Anthropic API. Required when apiType is 'foundry'; for Foundry use the form 'https://{resource}.services.ai.azure.com/anthropic/v1'. If not specified for the default apiType, the public Anthropic API is used. (Optional)
#- name: endpoint
# value: "https://my-resource.services.ai.azure.com/anthropic/v1"
# HTTP headers to send on every request to the model endpoint, as a JSON object of header names to string values. Use it for headers that a gateway or proxy in front of the provider requires, for example a tenant ID or a gateway key. A header in this field replaces the header of the same name that the component sets. This includes the x-api-key header that the component builds from key. Without workload identity federation, key is still required, so set key to any non-empty value if the gateway does its own authentication. Host, Content-Length and hop-by-hop headers are not allowed. When this field is set, the component does not follow redirects to a different origin. With workload identity federation, the component also sends these headers to the token endpoint, because the token endpoint is on the same origin as the model endpoint. On requests to the model endpoint, the access token sets the Authorization header, and the component removes the api-key and x-api-key headers. (Optional)
#- name: headers
# value: "{"X-Tenant-ID": "tenant-a", "X-Gateway-Key": "**********"}"
# Default maximum number of tokens the model may generate per request. A request-level maxTokens value greater than zero overrides this default. When unset, no cap is sent and the provider's own default applies. (Optional)
#- name: maxTokens
# value: "2048"
# The Anthropic LLM to use. When apiType is 'foundry', this is the Foundry deployment name (defaults to the Claude model ID, e.g. 'claude-sonnet-4-6'). Configurable via ANTHROPIC_MODEL environment variable. (Optional)
#- name: model
# value: "claude-sonnet-4-6"

Authentication profiles​

Available authentication profiles:

  • API Key

  • Workload identity federation (SPIFFE)

API Key​

Authenticate using an API key

key (string)​

Required - API key for Anthropic, or for the Microsoft Foundry resource when apiType is 'foundry'.

Example value:

**********

Workload identity federation (SPIFFE)​

Authenticate without an API key. The Dapr runtime mints a JWT SVID for the app's SPIFFE ID, which is exchanged for a short-lived Anthropic access token. Requires mTLS and Sentry JWT issuing, with Sentry registered as a federation issuer in the Claude Console. Not supported when apiType is 'foundry'.

federationRuleId (string)​

Required - ID of the Anthropic federation rule that maps the app's SPIFFE ID to a service account.

Example value: fdrl_01abc

organizationId (string)​

Required - UUID of the Anthropic organization.

Example value: 00000000-0000-0000-0000-000000000000

serviceAccountId (string)​

Required - ID of the Anthropic service account the access token acts as.

Example value: svac_01abc

audience (string)​

Audience of the JWT SVID. Must match the audience of the federation rule.

Default value: https://api.anthropic.com

Example value: https://api.anthropic.com

workspaceId (string)​

ID of the workspace to scope the access token to. Required when the federation rule is enabled for more than one workspace.

Example value: wrkspc_01abc

Metadata​

apiType (string)​

The type of API to use. Set to 'foundry' to call Anthropic Claude models hosted on Microsoft Foundry; otherwise the public Anthropic API is used.

Default value: anthropic

Example value: foundry

Allowed values:

  • anthropic

  • foundry

cacheTTL (string)​

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

Example value: 10m

endpoint (string)​

Custom base URL for the Anthropic API. Required when apiType is 'foundry'; for Foundry use the form 'https://{resource}.services.ai.azure.com/anthropic/v1'. If not specified for the default apiType, the public Anthropic API is used.

Example value: https://my-resource.services.ai.azure.com/anthropic/v1

headers (string)​

HTTP headers to send on every request to the model endpoint, as a JSON object of header names to string values. Use it for headers that a gateway or proxy in front of the provider requires, for example a tenant ID or a gateway key. A header in this field replaces the header of the same name that the component sets. This includes the x-api-key header that the component builds from key. Without workload identity federation, key is still required, so set key to any non-empty value if the gateway does its own authentication. Host, Content-Length and hop-by-hop headers are not allowed. When this field is set, the component does not follow redirects to a different origin. With workload identity federation, the component also sends these headers to the token endpoint, because the token endpoint is on the same origin as the model endpoint. On requests to the model endpoint, the access token sets the Authorization header, and the component removes the api-key and x-api-key headers.

Example value: {"X-Tenant-ID": "tenant-a", "X-Gateway-Key": "**********"}

maxTokens (number)​

Default maximum number of tokens the model may generate per request. A request-level maxTokens value greater than zero overrides this default. When unset, no cap is sent and the provider's own default applies.

Example value: 2048

model (string)​

The Anthropic LLM to use. When apiType is 'foundry', this is the Foundry deployment name (defaults to the Claude model ID, e.g. 'claude-sonnet-4-6'). Configurable via ANTHROPIC_MODEL environment variable.

Default value: claude-sonnet-4-6

Example value: claude-sonnet-4-6