diff --git a/docs/prompt-caching.md b/docs/prompt-caching.md index 9973b95..0fc23ab 100644 --- a/docs/prompt-caching.md +++ b/docs/prompt-caching.md @@ -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/) diff --git a/typescript/openrouter-sdk/README.md b/typescript/openrouter-sdk/README.md new file mode 100644 index 0000000..c26d9c6 --- /dev/null +++ b/typescript/openrouter-sdk/README.md @@ -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 diff --git a/typescript/openrouter-sdk/package.json b/typescript/openrouter-sdk/package.json new file mode 100644 index 0000000..6cf8810 --- /dev/null +++ b/typescript/openrouter-sdk/package.json @@ -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" + } +} diff --git a/typescript/openrouter-sdk/src/prompt-caching/README.md b/typescript/openrouter-sdk/src/prompt-caching/README.md new file mode 100644 index 0000000..b0888af --- /dev/null +++ b/typescript/openrouter-sdk/src/prompt-caching/README.md @@ -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 +``` diff --git a/typescript/package.json b/typescript/package.json index 2e0ec08..305eea9 100644 --- a/typescript/package.json +++ b/typescript/package.json @@ -13,7 +13,8 @@ "shared", "fetch", "ai-sdk-v5", - "effect-ai" + "effect-ai", + "openrouter-sdk" ], "devDependencies": { "@types/bun": "latest",