Skip to content

Type error from the documentation using OpenRouter SDK #203

@Alban2701

Description

@Alban2701

Hi.

I just wanted to test the code below from here : https://openrouter.ai/docs/sdks/typescript/overview

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

dotenv.config();

const api_key = process.env.API_KEY;

const client = new OpenRouter({
	apiKey: api_key,
});

const response = await client.chat.send({
	model: "minimax/minimax-m2",
	messages: [{ role: "user", content: "Explain quantum computing" }],
});

I have this error appearing on my IDE :
No overload matches this call.
Overload 1 of 3, '(request: SendChatCompletionRequestRequest & { chatGenerationParams: { stream?: false | undefined; }; }, options?: RequestOptions | undefined): Promise<...>', gave the following error.
Object literal may only specify known properties, and 'model' does not exist in type 'SendChatCompletionRequestRequest & { chatGenerationParams: { stream?: false | undefined; }; }'.
Overload 2 of 3, '(request: SendChatCompletionRequestRequest & { chatGenerationParams: { stream: true; }; }, options?: RequestOptions | undefined): Promise<...>', gave the following error.
Object literal may only specify known properties, and 'model' does not exist in type 'SendChatCompletionRequestRequest & { chatGenerationParams: { stream: true; }; }'.
Overload 3 of 3, '(request: SendChatCompletionRequestRequest, options?: RequestOptions | undefined): Promise', gave the following error.
Object literal may only specify known properties, and 'model' does not exist in type 'SendChatCompletionRequestRequest'.

For the moment I'll use OpenRouter.callModel() but I don't exactly know the difference

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions