Skip to content

Commit ec10a70

Browse files
thomasdavisclaude
andcommitted
feat(agent): add 24-hour cache for agent endpoint
The .agent endpoint uses AI generation (GPT-4o-mini) which is expensive. Adding caching reduces API costs and improves response times for repeated requests. Cache settings: - s-maxage=86400: CDN caches for 24 hours - stale-while-revalidate=3600: Serve stale content for 1 hour while revalidating in the background 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0cdfd92 commit ec10a70

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

apps/registry/pages/api/[username].js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ export default async function handler(req, res) {
4343
);
4444
res.setHeader('Access-Control-Allow-Origin', '*');
4545

46+
// Add 24-hour cache for agent endpoint (AI-generated, expensive)
47+
if (extension === 'agent') {
48+
res.setHeader(
49+
'Cache-Control',
50+
'public, s-maxage=86400, stale-while-revalidate=3600'
51+
);
52+
}
53+
4654
// if there is an extension, render the file as if it were present
4755
// some formatters require special response headers
4856
headers.forEach((header) => {

0 commit comments

Comments
 (0)