Skip to content

Provider routing #85

@ProjectInfinity

Description

@ProjectInfinity

I noticed that after migrating over from the openai library to openrouter sdk I cannot seem to give it a provider routing anymore.

The README lists a provider key (which I assume is where my provider information would go such as limiting a myself to only one provider). This is the example code:

https://github.com/OpenRouterTeam/typescript-sdk?tab=readme-ov-file#sdk-usage

import { OpenRouter } from "@openrouter/sdk";

const openRouter = new OpenRouter();

const result = await openRouter.chat.send({
  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)
}

However upon trying this I was met with typescript errors that the provider field does not exist. Upon looking at ChatGenerationParams this does indeed seem to be the case.
https://github.com/OpenRouterTeam/typescript-sdk/blob/main/src/models/chatgenerationparams.ts#L73

Is this a documentation issue, implementation issue or am I doing something wrong?

Appreciate any pointers.
Thanks.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions