Skip to content

Commit 07599dd

Browse files
samdenty8enSmithBen Smithlgrammel
authored
fix (docs): fix OpenRouter code examples (#5876) (#5893)
Co-authored-by: Ben Smith <8enSmith@users.noreply.github.com> Co-authored-by: Ben Smith <write.to.ben.smith@gmail.com> Co-authored-by: Lars Grammel <lars.grammel@gmail.com>
1 parent cf8280e commit 07599dd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

content/providers/03-community-providers/12-openrouter.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ You can obtain your OpenRouter API key from the [OpenRouter Dashboard](https://o
4848

4949
## Language Models
5050

51-
OpenRouter supports both chat and completion models. Use `openrouter.chatModel()` for chat models and `openrouter.completionModel()` for completion models:
51+
OpenRouter supports both chat and completion models. Use `openrouter.chat()` for chat models and `openrouter.completion()` for completion models:
5252

5353
```typescript
5454
// Chat models (recommended)
55-
const chatModel = openrouter.chatModel('anthropic/claude-3.5-sonnet');
55+
const chatModel = openrouter.chat('anthropic/claude-3.5-sonnet');
5656

5757
// Completion models
58-
const completionModel = openrouter.completionModel(
58+
const completionModel = openrouter.completion(
5959
'meta-llama/llama-3.1-405b-instruct',
6060
);
6161
```
@@ -77,7 +77,7 @@ const openrouter = createOpenRouter({
7777
});
7878

7979
const { text } = await generateText({
80-
model: openrouter.chatModel('anthropic/claude-3.5-sonnet'),
80+
model: openrouter.chat('anthropic/claude-3.5-sonnet'),
8181
prompt: 'What is OpenRouter?',
8282
});
8383

@@ -95,7 +95,7 @@ const openrouter = createOpenRouter({
9595
});
9696

9797
const result = streamText({
98-
model: openrouter.chatModel('meta-llama/llama-3.1-405b-instruct'),
98+
model: openrouter.chat('meta-llama/llama-3.1-405b-instruct'),
9999
prompt: 'Write a short story about AI.',
100100
});
101101

0 commit comments

Comments
 (0)