Skip to content

Commit 5305cdb

Browse files
committed
docs: update models and non-beta batches
1 parent b1799f7 commit 5305cdb

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const anthropic = new Anthropic();
100100
async function main() {
101101
const stream = anthropic.messages
102102
.stream({
103-
model: 'claude-3-5-sonnet-latest',
103+
model: 'claude-sonnet-4-20250514',
104104
max_tokens: 1024,
105105
messages: [
106106
{
@@ -126,7 +126,7 @@ Alternatively, you can use `client.messages.create({ ..., stream: true })` which
126126

127127
## Message Batches
128128

129-
This SDK provides beta support for the [Message Batches API](https://docs.anthropic.com/en/docs/build-with-claude/message-batches) under the `client.beta.messages.batches` namespace.
129+
This SDK provides beta support for the [Message Batches API](https://docs.anthropic.com/en/docs/build-with-claude/message-batches) under the `client.messages.batches` namespace.
130130

131131
### Creating a batch
132132

@@ -138,15 +138,15 @@ await anthropic.beta.messages.batches.create({
138138
{
139139
custom_id: 'my-first-request',
140140
params: {
141-
model: 'claude-3-5-sonnet-latest',
141+
model: 'claude-sonnet-4-20250514',
142142
max_tokens: 1024,
143143
messages: [{ role: 'user', content: 'Hello, world' }],
144144
},
145145
},
146146
{
147147
custom_id: 'my-second-request',
148148
params: {
149-
model: 'claude-3-5-sonnet-latest',
149+
model: 'claude-sonnet-4-20250514',
150150
max_tokens: 1024,
151151
messages: [{ role: 'user', content: 'Hi again, friend' }],
152152
},
@@ -269,7 +269,7 @@ All object responses in the SDK provide a `_request_id` property which is added
269269
const message = await client.messages.create({
270270
max_tokens: 1024,
271271
messages: [{ role: 'user', content: 'Hello, Claude' }],
272-
model: 'claude-3-5-sonnet-latest',
272+
model: 'claude-sonnet-4-20250514',
273273
});
274274
console.log(message._request_id); // req_018EeWyXxfu5pfWkrYcMdjWG
275275
```
@@ -355,7 +355,7 @@ You can use the `for await … of` syntax to iterate through items across all pa
355355
async function fetchAllBetaMessageBatches(params) {
356356
const allBetaMessageBatches = [];
357357
// Automatically fetches more pages as needed.
358-
for await (const betaMessageBatch of client.beta.messages.batches.list({ limit: 20 })) {
358+
for await (const betaMessageBatch of client.messages.batches.list({ limit: 20 })) {
359359
allBetaMessageBatches.push(betaMessageBatch);
360360
}
361361
return allBetaMessageBatches;
@@ -365,7 +365,7 @@ async function fetchAllBetaMessageBatches(params) {
365365
Alternatively, you can request a single page at a time:
366366

367367
```ts
368-
let page = await client.beta.messages.batches.list({ limit: 20 });
368+
let page = await client.messages.batches.list({ limit: 20 });
369369
for (const betaMessageBatch of page.data) {
370370
console.log(betaMessageBatch);
371371
}

examples/batch-results.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async function main() {
1010

1111
console.log(`fetching results for ${batch_id}`);
1212

13-
const results = await anthropic.beta.messages.batches.results(batch_id);
13+
const results = await anthropic.messages.batches.results(batch_id);
1414

1515
for await (const result of results) {
1616
console.log(result);

0 commit comments

Comments
 (0)