Skip to content

Commit a1bcb45

Browse files
committed
Add openrouter conversation component
Signed-off-by: Joni Collinge <jonathancollinge@live.com>
1 parent 0040065 commit a1bcb45

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

  • daprdocs
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
type: docs
3+
title: "OpenRouter"
4+
linkTitle: "OpenRouter"
5+
description: Detailed information on the OpenRouter conversation component
6+
---
7+
8+
## Component format
9+
10+
A Dapr `conversation.yaml` component file has the following structure:
11+
12+
```yaml
13+
apiVersion: dapr.io/v1alpha1
14+
kind: Component
15+
metadata:
16+
name: openrouter
17+
spec:
18+
type: conversation.openrouter
19+
metadata:
20+
- name: key
21+
value: "mykey"
22+
- name: model
23+
value: openai/gpt-4o-mini
24+
- name: cacheTTL
25+
value: 10m
26+
```
27+
28+
{{% alert title="Warning" color="warning" %}}
29+
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 %}}).
30+
{{% /alert %}}
31+
32+
## Spec metadata fields
33+
34+
| Field | Required | Details | Example |
35+
|--------------------|:--------:|---------|---------|
36+
| `key` | Y | API key for OpenRouter. Obtain one at [openrouter.ai/keys](https://openrouter.ai/keys). | `"sk-or-v1-..."` |
37+
| `model` | N | Model identifier in `provider/model-name` format. Any model supported by OpenRouter is valid (e.g. `openai/gpt-4o`, `anthropic/claude-3-5-sonnet`, `meta-llama/llama-3.3-70b-instruct`). Defaults to `openai/gpt-4o-mini`. Can also be configured via the `OPENROUTER_MODEL` environment variable. | `anthropic/claude-3-5-sonnet` |
38+
| `endpoint` | N | Override the OpenRouter API base URL. Useful when routing through a proxy. Defaults to `https://openrouter.ai/api/v1`. | `https://openrouter.ai/api/v1` |
39+
| `cacheTTL` | N | Time-to-live for the in-memory response cache. When set, identical requests are served from cache until they expire. Uses Go duration format. | `10m` |
40+
| `siteURL` | N | Your application URL. Forwarded as the `HTTP-Referer` header on every request. Optional but recommended so OpenRouter can attribute usage and include your app in public rankings. | `https://myapp.example.com` |
41+
| `siteTitle` | N | Your application name. Forwarded as the `X-Title` header on every request. Optional but recommended for OpenRouter attribution. | `My Dapr App` |
42+
43+
## Related links
44+
45+
- [Conversation API overview]({{% ref conversation-overview.md %}})
46+
- [OpenRouter documentation](https://openrouter.ai/docs)
47+
- [OpenRouter models](https://openrouter.ai/models)

daprdocs/data/components/conversation/generic.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
state: Alpha
3434
version: v1
3535
since: "1.16"
36+
- component: OpenRouter
37+
link: openrouter
38+
state: Alpha
39+
version: v1
40+
since: "1.18"
3641
- component: Local echo
3742
link: local-echo
3843
state: Stable

0 commit comments

Comments
 (0)