Skip to content

Releases: eofreternal/openrouter-client

v1.9.0

Choose a tag to compare

@eofreternal eofreternal released this 05 May 22:04

You can also customize the URL that it makes requests to. It defaults to https://openrouter.ai/api/v1 but you can customize it like this:

import { OpenRouter } from "openrouter-client";
// Add `undefined` because JavaScript doesn't have kwargs
// Class constructor() signature is: constructor(apiKey: string, globalConfig?: Types.Config, apiBase?: string)
const OpenRouterClient = new OpenRouter("API key here", undefined, "insert API URL here. Don't leave a trailing slash");
// valid: `https://openrouter.ai/api/v1`
// invalid: `https://openrouter.ai/api/v1/`
//                                       ^ notice the trailing slash. that's what makes it invalid

let nl = await OpenRouterClient.chat([{
    role: "user",
    content: [
        { type: "text", text: "Hello World" },
    ],
}], {
    model: "deepseek/deepseek-r1-0528-qwen3-8b",
});

console.dir(nl);

This works for streaming too. It's literally the same Class constructor signature

v1.8.0

Choose a tag to compare

@eofreternal eofreternal released this 06 Jan 14:13

Added "usage": { "include": true } support to the config

v1.7.0

Choose a tag to compare

@eofreternal eofreternal released this 29 Dec 01:01

I caught the wrapper up to speed with the current state of OpenRouter's APIs for the most part

Added functionality

  • Audio uploads
  • Image gen
  • Proper plugin support
  • Fetch usage data for current API key
  • add getGenerationStats and getKeyUsage to OpenRouterStream

Bug fixes

  • I forgot to let people upload PDFs when I added PDF support lol
  • I forgot to make getGenerationStats send the auth token when I made that function
  • OpenRouter changed their API so finish_reason had proper typings in the docs now + added native_finish_reason

Misc

  • Types are easier to use now because they're more individually exportable

TODO

  • Let users use "usage": { "include": true }

Full Changelog: v1.6.0...v1.7.0

v1.6.0

Choose a tag to compare

@eofreternal eofreternal released this 17 Aug 18:20

feat: added logit bias
feat: added top_a
feat: added predicted output (openai only)

v1.2.0

Choose a tag to compare

@eofreternal eofreternal released this 25 Dec 15:51

feat: added json_schema support for response formats

1.1.0

Choose a tag to compare

@eofreternal eofreternal released this 15 Dec 04:11

Added streaming support
Refactored code by moving types into a separate file