Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/prompt-caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,4 @@ See ecosystem-specific examples:
- **TypeScript + fetch**: [typescript/fetch/src/prompt-caching/](../typescript/fetch/src/prompt-caching/)
- **AI SDK v5** (Vercel): [typescript/ai-sdk-v5/src/prompt-caching/](../typescript/ai-sdk-v5/src/prompt-caching/)
- **Effect AI** (@effect/ai): [typescript/effect-ai/src/prompt-caching/](../typescript/effect-ai/src/prompt-caching/)
- **OpenRouter SDK** (@openrouter/sdk): [typescript/openrouter-sdk/src/prompt-caching/](../typescript/openrouter-sdk/src/prompt-caching/)
16 changes: 16 additions & 0 deletions typescript/openrouter-sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# OpenRouter TypeScript SDK Examples

Examples using the official @openrouter/sdk package.

## Status

**TODO**: Examples not yet implemented

## Prerequisites

- Bun runtime: `curl -fsSL https://bun.sh/install | bash`
- `OPENROUTER_API_KEY` environment variable

## Planned Features

- [ ] prompt-caching.ts - Anthropic caching with OpenRouter SDK
15 changes: 15 additions & 0 deletions typescript/openrouter-sdk/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@openrouter-examples/openrouter-sdk",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"examples": "echo 'TODO: OpenRouter SDK examples not yet implemented'"
},
"dependencies": {
"@openrouter-examples/shared": "workspace:*"
},
"devDependencies": {
"@types/bun": "latest"
}
}
28 changes: 28 additions & 0 deletions typescript/openrouter-sdk/src/prompt-caching/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Prompt Caching Examples (OpenRouter SDK)

Examples demonstrating prompt caching with @openrouter/sdk.

## Documentation

For full prompt caching documentation including all providers, pricing, and configuration details, see:
- **[Prompt Caching Guide](../../../../docs/prompt-caching.md)**

## Status

**TODO**: Examples coming soon. This directory will contain:
- `user-message-cache.ts` - Cache large context in user messages
- `multi-message-cache.ts` - Cache system prompt across multi-turn conversations
- `no-cache-control.ts` - Control scenario (validates methodology)

## Expected Usage

```typescript
import OpenRouter from '@openrouter/sdk';

const openrouter = new OpenRouter({
apiKey: process.env.OPENROUTER_API_KEY,
});

// Configuration and cache_control usage pattern will be documented
// when examples are implemented
```
3 changes: 2 additions & 1 deletion typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"shared",
"fetch",
"ai-sdk-v5",
"effect-ai"
"effect-ai",
"openrouter-sdk"
],
"devDependencies": {
"@types/bun": "latest",
Expand Down