Skip to content

Commit e7c33b3

Browse files
Add prompt-caching placeholder for OpenRouter SDK
- Add typescript/openrouter-sdk/src/prompt-caching/README.md - Placeholder for future @openrouter/sdk examples - Will follow same pattern as other SDKs (separate files per scenario)
1 parent 189d80e commit e7c33b3

File tree

5 files changed

+61
-1
lines changed

5 files changed

+61
-1
lines changed

docs/prompt-caching.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,4 @@ See ecosystem-specific examples:
190190
- **TypeScript + fetch**: [typescript/fetch/src/prompt-caching/](../typescript/fetch/src/prompt-caching/)
191191
- **AI SDK v5** (Vercel): [typescript/ai-sdk-v5/src/prompt-caching/](../typescript/ai-sdk-v5/src/prompt-caching/)
192192
- **Effect AI** (@effect/ai): [typescript/effect-ai/src/prompt-caching/](../typescript/effect-ai/src/prompt-caching/)
193+
- **OpenRouter SDK** (@openrouter/sdk): [typescript/openrouter-sdk/src/prompt-caching/](../typescript/openrouter-sdk/src/prompt-caching/)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# OpenRouter TypeScript SDK Examples
2+
3+
Examples using the official @openrouter/sdk package.
4+
5+
## Status
6+
7+
**TODO**: Examples not yet implemented
8+
9+
## Prerequisites
10+
11+
- Bun runtime: `curl -fsSL https://bun.sh/install | bash`
12+
- `OPENROUTER_API_KEY` environment variable
13+
14+
## Planned Features
15+
16+
- [ ] prompt-caching.ts - Anthropic caching with OpenRouter SDK
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@openrouter-examples/openrouter-sdk",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"examples": "echo 'TODO: OpenRouter SDK examples not yet implemented'"
8+
},
9+
"dependencies": {
10+
"@openrouter-examples/shared": "workspace:*"
11+
},
12+
"devDependencies": {
13+
"@types/bun": "latest"
14+
}
15+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Anthropic Prompt Caching Examples (OpenRouter SDK)
2+
3+
**TODO**: Add prompt caching examples using the @openrouter/sdk package.
4+
5+
This directory will contain examples demonstrating Anthropic's prompt caching feature via the OpenRouter TypeScript SDK.
6+
7+
## Placeholder
8+
9+
Examples will be added in a future commit.
10+
11+
## Expected Structure
12+
13+
```
14+
prompt-caching/
15+
├── README.md # This file
16+
├── system-message-cache.ts # TODO: Cache on system message
17+
├── user-message-cache.ts # TODO: Cache on user message
18+
├── multi-message-cache.ts # TODO: Cache in conversation
19+
└── no-cache-control.ts # TODO: Control scenario
20+
```
21+
22+
## Pattern (To Be Implemented)
23+
24+
The examples will use the official @openrouter/sdk package to demonstrate:
25+
- How to configure cache_control with the SDK
26+
- Where cache metrics appear in responses
27+
- Evidence-based verification of cache behavior

typescript/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"shared",
1414
"fetch",
1515
"ai-sdk-v5",
16-
"effect-ai"
16+
"effect-ai",
17+
"openrouter-sdk"
1718
],
1819
"devDependencies": {
1920
"@types/bun": "latest",

0 commit comments

Comments
 (0)