OpenRouter Examples: what the Makefile actually runs
Examples of integrating the OpenRouter API
At a glance
- What is it?
- OpenRouterTeam/openrouter-examples gathers OpenRouter API samples in shell and in three TypeScript toolchains, but the quick start advertises a make target that does not exist and prompt caching is the only feature with code behind it. This is what a reader gets after cloning main.
- Who is it for?
- Use openrouter-examples as a pattern catalogue rather than a finished tutorial. Read the three prompt caching directories to see one feature expressed through fetch, AI SDK v5 and Effect, then check each call against https://openrouter.ai/docs, because the repository shows no request bodies, headers or error handling of its own.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Activity is slowing. The repository last received commits 6 months ago.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 8, 2026, and from our analysis. They are not legal advice.
Editorial analysis
`make curl` is not a target the Makefile declares
The quick start block sends a first-time reader straight to a command by name:
export OPENROUTER_API_KEY="your-key-here"
# Run specific ecosystems
make curl # Run curl examples
make typescript # Run TypeScript monorepo examplesThe root Makefile declares a different, shorter set of names:
.PHONY: help examples typescript install cleanFive phony targets, and curl is not among them. Make reports no rule to make target and stops, so the one command that would reach `curl/prompt-caching.sh` without leaving the repository root fails on a fresh clone. The gap shows up again inside `make help`, whose echo lines advertise examples, typescript, install and clean and never mention the shell scripts. The file calls itself root orchestration in its first comment, yet it orchestrates one half of the collection and quietly drops the other.
`make examples` runs the TypeScript side and stops there
Only two targets in the file carry real work:
examples: typescript
typescript:
@echo "=== Running TypeScript examples ==="
@cd typescript && bun examples`examples: typescript` is a prerequisite line, not a second script. Make builds the typescript recipe, which changes into typescript/ and calls bun examples, then returns. No recipe walks curl/, and nothing loops over the workspaces, so the all examples label attached to `make examples` promises more than the file delivers. The shell side stays on disk untouched.
The same command also resolves differently at the two levels the documentation names. The root recipe calls bun examples from inside typescript/, while the per-workspace instructions descend into a leaf package first:
cd typescript/fetch && bun examples
cd typescript/ai-sdk-v5 && bun examples
cd typescript/effect-ai && bun examplesThe structure listing names shared/, fetch/, ai-sdk-v5/, effect-ai/ and openrouter-sdk/ but no runner at the typescript/ level itself, so what the root call picks up is not spelled out anywhere before you type it.
The shell script runs by hand, and the key comes from the shell
The single documented route to the curl example bypasses make entirely:
# curl
bash curl/prompt-caching.shThat path needs the key in the environment first, and jq on the machine, which the prerequisites section lists specifically for the curl examples. The repository also ships an environment sample whose entire content is one empty assignment:
OPENROUTER_API_KEY=Nothing in the Makefile reads that file, and no command shown in the documentation copies it into place, so the sample is a reminder of the variable name rather than a working setup step. A reader who prefers a file over a shell export has no documented path here. Keys come from https://openrouter.ai/keys. Bun is installed separately with curl -fsSL https://bun.sh/install | bash, a prerequisite the quick start never repeats, and make install wraps the other half of the setup with cd typescript && bun install.
Prompt caching is the only feature with code behind it
The features section has a single heading. Prompt caching gets a prose page at docs/prompt-caching.md, one shell script at curl/prompt-caching.sh, and three parallel directories: typescript/fetch/src/prompt-caching/, typescript/ai-sdk-v5/src/prompt-caching/ and typescript/effect-ai/src/prompt-caching/. The opening line advertises examples across multiple ecosystems, and the structure listing marks a fifth workspace, typescript/openrouter-sdk/, with a TODO, so the project's own SDK is the one ecosystem without runnable code.
What is missing at the top level matters more than what is there. No request body, header set, endpoint, streaming case or error branch appears in the quick start or the structure block, so the shape of a call cannot be learned from this repository. The stated benefits, copy-paste ready, tested and proven, evidence-based with expected outputs, all describe files a reader has to open. For the API contract the project points outward: its homepage field is https://openrouter.ai/docs.
Three toolchains share one constants directory
The developer-facing benefits are structural: constants defined once in typescript/shared/, shared types across all TypeScript examples, each ecosystem following its own idioms, and a Bun monorepo for maintenance. That arrangement is why prompt caching can appear four times without four copies of the same values. Installation follows the same shape:
# Install TypeScript dependencies
make install
# Or manually
cd typescript && bun installThe recipe is a thin wrapper around cd typescript && bun install, so both routes end in the same directory. Bun workspaces are the only thing holding the four TypeScript directories together: the root listing shows no lockfile of its own, no root package script and no test runner, and no command in the quick start pins an SDK version beyond the directory name ai-sdk-v5. Formatting rules live in biome.jsonc at the root, and no make target invokes them.
`make clean` removes the resolved lockfile
Three removals, and the third is not a build artifact:
clean:
@echo "=== Cleaning TypeScript artifacts ==="
@rm -rf typescript/node_modules
@rm -rf typescript/*/node_modules
@rm -rf typescript/bun.locktypescript/bun.lock records which package versions the workspaces resolved to, and clean deletes it along with the dependency directories. The next make install therefore reinstalls from scratch with no pinned versions to fall back on, which is worth knowing before running clean on a machine where a reproducible example environment mattered. The glob reaches one level deep, so it covers typescript/fetch/node_modules and its siblings while leaving anything nested below those alone. Nothing outside typescript/ is removed: .env.sample, docs/ and fixtures/ survive untouched.
The structure block leaves out three top-level entries
The root of the repository holds .env.sample, .gitignore, LICENSE.md, Makefile, README.md, biome.jsonc, claude-code/, docs/, fixtures/ and typescript/. The structure diagram shows six of those ten and omits biome.jsonc, claude-code/ and fixtures/. Two omissions change what a newcomer expects to find. claude-code/ appears in no documentation section, since contributing points only at curl/README.md and typescript/README.md, so its purpose has to be discovered by browsing. fixtures/ is named by no command in the Makefile or the quick start, which leaves its contents undocumented at the level most readers stop at. LICENSE.md is a pointer rather than a copy of the MIT terms, so a project that vendors these snippets inherits an MIT license whose text lives in one file reference.
The last commit is dated March 30, 2026, and no release exists
The default branch is main, the last push is dated 2026-03-30, and the project has published no GitHub releases. That combination leaves no changelog to consult before copying a snippet: an example can stop matching the API without any release note saying so. Because the install step resolves whatever the current manifests point at, an ai-sdk-v5 or Effect example written months ago can pick up a newer major version the next time make install runs, and the breakage surfaces as TypeScript errors inside a workspace rather than as anything traceable to this repository. The API side carries the same exposure, since https://openrouter.ai/docs moves independently of the code here. Pin versions in your own project and verify the call shape against the docs rather than trusting the example to stay still.
Editorial conclusion
Use openrouter-examples as a pattern catalogue rather than a finished tutorial. Read the three prompt caching directories to see one feature expressed through fetch, AI SDK v5 and Effect, then check each call against https://openrouter.ai/docs, because the repository shows no request bodies, headers or error handling of its own. Do not follow the quick start literally: make curl is not a target, make examples touches only the TypeScript side, and the last commit is dated March 30, 2026 with no release to announce breaking changes.
Frequently asked questions
Does openrouter-examples have a make curl target?
No. The root Makefile declares help, examples, typescript, install and clean, so make curl stops with a no rule error on a fresh clone. Run the shell example directly instead: bash curl/prompt-caching.sh.
What does make examples in openrouter-examples actually run?
Only the TypeScript half. The target is written as examples: typescript, and the typescript recipe changes into typescript/ and runs bun examples. No recipe walks the curl directory, so the shell scripts stay untouched.
Which OpenRouter feature does openrouter-examples cover?
Prompt caching is the only feature with code behind it: docs/prompt-caching.md, curl/prompt-caching.sh, and prompt-caching directories under typescript/fetch, typescript/ai-sdk-v5 and typescript/effect-ai.
What does openrouter-examples need before any example runs?
The Bun runtime, installed with curl -fsSL https://bun.sh/install | bash, an OpenRouter API key exported as OPENROUTER_API_KEY, TypeScript dependencies from make install, and jq if you intend to run the shell script.
Is the OpenRouter SDK covered by openrouter-examples?
Not yet. The structure listing marks typescript/openrouter-sdk/ as TODO, so the workspace exists but holds no runnable example. The populated workspaces are fetch, ai-sdk-v5 and effect-ai.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/openrouterteam-openrouter-examples)