Skip to content

README example uses incorrect input shape #413

@mirudapon

Description

@mirudapon

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

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)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions