Skip to content

Commit b8089d4

Browse files
committed
document OpenRouter and baseUrl model string splitting
1 parent d6940af commit b8089d4

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

docs/docs/concepts/composition.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ Useful for multi-tenant apps where each user has their own key.
6161

6262
```typescript
6363
const result = await model({
64-
model: "openai/gpt-4o",
65-
baseUrl: "https://my-proxy.example.com/v1",
64+
model: "openai/anthropic/claude-sonnet-4-20250514",
65+
apiKey: "sk-or-...",
66+
baseUrl: "https://openrouter.ai/api/v1",
6667
})("explain quantum physics");
6768
```
6869

69-
Point to a proxy, gateway, or OpenAI-compatible API.
70+
The model string is split on the first `/` - `openai` tells threaded to use the OpenAI-compatible provider, and the rest (`anthropic/claude-sonnet-4-20250514`) is passed as the `model` field in the request body. This works with any OpenAI-compatible API like OpenRouter, Azure, or a local proxy.
7071

7172
### With System Message
7273

0 commit comments

Comments
 (0)