Description
The README example for SDK Usage appears to use an incorrect request shape.
According to the SDK types, SendChatCompletionRequestRequest expects an object containing a chatRequest property, but the README passes the request body directly.
This causes a runtime validation error similar to:
SDKValidationError: Input validation failed:
[
{
"expected": "object",
"code": "invalid_type",
"path": ["chatRequest"],
"message": "Invalid input: expected object, received undefined"
}
]
Relevant Sources
chat.ts
|
export class Chat extends ClientSDK { |
sendchatcompletionrequest.ts
|
chatRequest: models.ChatRequest; |
Current README Example
import { OpenRouter } from "@openrouter/sdk";
const openRouter = new OpenRouter();
const result = await openRouter.chat.send({
chatRequest: {
messages: [
{
role: "user",
content: "Hello, how are you?",
},
],
model: "openai/gpt-5",
provider: {
zdr: true,
sort: "price",
},
stream: true
}
});
for await (const chunk of result) {
console.log(chunk.choices[0].delta.content)
}
Description
The README example for SDK Usage appears to use an incorrect request shape.
According to the SDK types,
SendChatCompletionRequestRequestexpects an object containing achatRequestproperty, but the README passes the request body directly.This causes a runtime validation error similar to:
SDKValidationError: Input validation failed: [ { "expected": "object", "code": "invalid_type", "path": ["chatRequest"], "message": "Invalid input: expected object, received undefined" } ]Relevant Sources
chat.tstypescript-sdk/src/sdk/chat.ts
Line 13 in 5945f89
sendchatcompletionrequest.tstypescript-sdk/src/models/operations/sendchatcompletionrequest.ts
Line 60 in 5945f89
Current README Example