This module is a guide to the OpenRouter API.
We recommend using Cursor to write code.
You will need an OpenRouter API Key.
Get one here.
Copy the .env.example
file to .env
.
cp .env.example .env
In .env
, fill in the API key.
OPENROUTER_API_KEY=your-openrouter-api-key
npm i
The example code is in the examples
folder.
Your code is in the me
folder.
Install tsx
to run the examples.
npm i -g tsx
Example: Run the standard-chat
file.
Copy the relative path of the file.
For the example code, run the following command:
tsx examples/openai-compatible-chat.ts
For your code, run the following command:
tsx me/openai-compatible-chat.ts