Skip to content

OpenRouterTeam/openrouter-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenRouter Examples

Use the examples folder in this repo to integrate different SDKs with OpenRouter.

OpenRouter is an API that can be used with most AI SDKs, and has a very similar format to OpenAI's own API.

Below, you can find different SDKs adapted to use OpenRouter.

npm openai

Use this example to run the npm openai package using OpenRouter.

LangChain.js

Use this example to run LangChain.js scripts using OpenRouter.

Changing models

Change the model you want to use by configuring modelName in index.ts. You can use models from OpenAI, Anthropic, Google, and more. See the OpenRouter docs for all the options.

OAuth

You can let users use OpenRouter OAuth to authenticate and pay for models instead of using your own key. This example doesn't include that code yet (PRs welcome), but you can find an example in Python + Streamlit here.

Releases

No releases published

Packages

No packages published