-
Notifications
You must be signed in to change notification settings - Fork 0
feat: migrate hosted API auth to TALOCODE_API_KEY #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4df41c6
8954648
d2da2eb
15ff320
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { handleRoute } from '@/lib/talocode-route-handler' | ||
|
|
||
| export async function POST(request: Request): Promise<Response> { | ||
| return handleRoute( | ||
| request, | ||
| { action: 'brief.generate', credits: 15 }, | ||
| async () => { | ||
| const body = await request.json().catch(() => ({})) | ||
| // TODO: implement full brief generation flow | ||
| return Response.json({ | ||
| ok: true, | ||
| data: { | ||
| id: `brief_${Date.now()}`, | ||
| brief: body.prompt ?? '', | ||
| channel: body.channel ?? 'twitter', | ||
| estimatedDuration: 15, | ||
| }, | ||
| }) | ||
| }, | ||
| ) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { handleRoute } from '@/lib/talocode-route-handler' | ||
|
|
||
| export async function POST(request: Request): Promise<Response> { | ||
| return handleRoute( | ||
| request, | ||
| { action: 'campaign.create', credits: 50 }, | ||
| async () => { | ||
| const body = await request.json().catch(() => ({})) | ||
| // TODO: implement campaign creation | ||
| return Response.json({ | ||
| ok: true, | ||
| data: { | ||
| id: `camp_${Date.now()}`, | ||
| name: body.name ?? 'Untitled Campaign', | ||
| status: 'draft', | ||
| videos: [], | ||
| }, | ||
| }) | ||
| }, | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { handleRoute } from '@/lib/talocode-route-handler' | ||
|
|
||
| export async function POST(request: Request): Promise<Response> { | ||
| return handleRoute( | ||
| request, | ||
| { action: 'campaign.package', credits: 400 }, | ||
| async () => { | ||
| const body = await request.json().catch(() => ({})) | ||
| // TODO: implement full campaign packaging | ||
| return Response.json({ | ||
| ok: true, | ||
| data: { | ||
| id: body.campaignId ?? `camp_${Date.now()}`, | ||
| name: 'Packaged Campaign', | ||
| status: 'packaged', | ||
| videos: [], | ||
| }, | ||
| }) | ||
| }, | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| export async function GET(): Promise<Response> { | ||
| return Response.json({ | ||
| status: 'ok', | ||
| service: 'cliploop', | ||
| endpoints: [ | ||
| 'POST /v1/cliploop/brief/generate', | ||
| 'POST /v1/cliploop/script/generate', | ||
| 'POST /v1/cliploop/video/render', | ||
| 'POST /v1/cliploop/campaign/create', | ||
| 'POST /v1/cliploop/campaign/package', | ||
| 'GET /v1/cliploop/health', | ||
| ], | ||
| }) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { handleRoute } from '@/lib/talocode-route-handler' | ||
|
|
||
| export async function POST(request: Request): Promise<Response> { | ||
| return handleRoute( | ||
| request, | ||
| { action: 'script.generate', credits: 15 }, | ||
| async () => { | ||
| const body = await request.json().catch(() => ({})) | ||
| // TODO: implement full script generation | ||
| return Response.json({ | ||
| ok: true, | ||
| data: { | ||
| id: `script_${Date.now()}`, | ||
| script: 'Generated script based on brief.', | ||
| scenes: [ | ||
| { index: 0, visual: 'Intro scene', narration: 'Opening narration', duration: 5 }, | ||
| ], | ||
| }, | ||
| }) | ||
| }, | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { handleRoute } from '@/lib/talocode-route-handler' | ||
|
|
||
| export async function POST(request: Request): Promise<Response> { | ||
| return handleRoute( | ||
| request, | ||
| { action: 'video.render', credits: 200 }, | ||
| async () => { | ||
| const body = await request.json().catch(() => ({})) | ||
| // TODO: implement full render pipeline | ||
| return Response.json({ | ||
| ok: true, | ||
| data: { | ||
| id: `render_${Date.now()}`, | ||
| status: 'rendering' as const, | ||
| duration: 30, | ||
| creditsCharged: 200, | ||
| }, | ||
| }) | ||
| }, | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,52 +1,9 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes"> | ||
| <title>Examples · ClipLoop Developer Docs</title> | ||
| <link rel="stylesheet" href="/styles.css"> | ||
| </head> | ||
| <body> | ||
| <a href="#content" class="skip-link">Skip to content</a> | ||
| <button class="mobile-toggle" aria-label="Open menu" onclick="document.getElementById('sidebar').classList.add('open');document.getElementById('overlay').classList.add('open')">☰</button> | ||
| <div class="sidebar-overlay" id="overlay" onclick="document.getElementById('sidebar').classList.remove('open');document.getElementById('overlay').classList.remove('open')"></div> | ||
| <nav class="sidebar" id="sidebar" aria-label="Docs navigation"> | ||
| <div class="logo"> | ||
| <div class="logo-mark">CL</div> | ||
| <div class="logo-text">ClipLoop<small>Developer Docs</small></div> | ||
| </div> | ||
| <div class="nav-section"> | ||
| <div class="nav-section-title">Getting Started</div> | ||
| <a href="/overview/" class="nav-link ">Overview</a> | ||
| <a href="/quickstart/" class="nav-link ">Quickstart</a> | ||
| <a href="/authentication/" class="nav-link ">Authentication</a> | ||
| <a href="/idempotency/" class="nav-link ">Idempotency</a> | ||
| <a href="/credits/" class="nav-link ">Credits & Billing</a> | ||
| </div> | ||
| <div class="nav-divider"></div> | ||
| <div class="nav-section"> | ||
| <div class="nav-section-title">API Reference</div> | ||
| <a href="/weekly-promo-api/" class="nav-link ">Weekly Promo API</a> | ||
| <a href="/examples/" class="nav-link active">Examples</a> | ||
| <a href="/errors/" class="nav-link ">Error Codes</a> | ||
| </div> | ||
| <div class="nav-divider"></div> | ||
| <div class="nav-section"> | ||
| <div class="nav-section-title">More</div> | ||
| <a href="/roadmap/" class="nav-link ">Roadmap</a> | ||
| <a href="https://app.cliploop.site" class="nav-link">App Dashboard →</a> | ||
| <a href="https://cliploop.site" class="nav-link">Marketing Site →</a> | ||
| </div> | ||
| </nav> | ||
| <main class="main" id="content"> | ||
| <div class="content"> | ||
|
|
||
| <h1>Examples</h1> | ||
| <h1>Examples</h1> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The generated Useful? React with 👍 / 👎. |
||
| <p class="lead">Copy and adapt these examples to call the Weekly Promo API from your backend or scripts.</p> | ||
|
|
||
| <h2 id="curl">cURL</h2> | ||
| <div class="code-block"><code>curl -X POST https://app.cliploop.site/api/public/weekly-promo \ | ||
| -H "Authorization: Bearer $CLIPLOOP_API_KEY" \ | ||
| -H "Authorization: Bearer $TALOCODE_API_KEY" \ | ||
| -H "Idempotency-Key: $IDEMPOTENCY_KEY" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
|
|
@@ -63,7 +20,7 @@ <h2 id="javascript">JavaScript (fetch)</h2> | |
| <div class="code-block"><code>const response = await fetch("https://app.cliploop.site/api/public/weekly-promo", { | ||
| method: "POST", | ||
| headers: { | ||
| Authorization: `Bearer ${process.env.CLIPLOOP_API_KEY}`, | ||
| Authorization: `Bearer ${process.env.TALOCODE_API_KEY}`, | ||
| "Idempotency-Key": `promo-${Date.now()}`, | ||
| "Content-Type": "application/json" | ||
| }, | ||
|
|
@@ -84,7 +41,7 @@ <h2 id="node">Node.js</h2> | |
| <div class="code-block"><code>const response = await fetch("https://app.cliploop.site/api/public/weekly-promo", { | ||
| method: "POST", | ||
| headers: { | ||
| Authorization: `Bearer ${process.env.CLIPLOOP_API_KEY}`, | ||
| Authorization: `Bearer ${process.env.TALOCODE_API_KEY}`, | ||
| "Idempotency-Key": `promo-${Date.now()}`, | ||
| "Content-Type": "application/json" | ||
| }, | ||
|
|
@@ -102,27 +59,13 @@ <h2 id="node">Node.js</h2> | |
| if (!response.ok) throw new Error(data.error?.message || `HTTP ${response.status}`);</code></div> | ||
|
|
||
| <h2 id="environment-variables">Environment variables</h2> | ||
| <div class="code-block"><code>CLIPLOOP_API_KEY=clp_li... | ||
| <div class="code-block"><code># Primary | ||
| TALOCODE_API_KEY=tk_... | ||
| TALOCODE_BASE_URL=https://api.talocode.site | ||
|
|
||
| # Legacy (deprecated) | ||
| # CLIPLOOP_API_KEY=clp_... | ||
|
|
||
| IDEMPOTENCY_KEY=promo-2026-05-30-cliploop</code></div> | ||
| <div class="callout">⚠️ Never commit real API keys to source control. Store them in environment variables or a secrets manager.</div> | ||
|
|
||
| <footer> | ||
| <p style="display:flex; flex-wrap:wrap; gap:14px; align-items:center; justify-content:space-between"> | ||
| <span>© 2026 ClipLoop · Built by <a href="https://talocode.com" style="color:var(--text3)">Talocode</a></span> | ||
| <span style="display:flex; gap:14px"> | ||
| <a href="https://cliploop.site">Marketing</a> | ||
| <a href="https://app.cliploop.site">Dashboard</a> | ||
| <a href="https://github.com/talocode/cliploop">GitHub</a> | ||
| </span> | ||
| </p> | ||
| </footer> | ||
| </div> | ||
| </main> | ||
| <script> | ||
| document.getElementById('overlay').addEventListener('click', function(){ | ||
| document.getElementById('sidebar').classList.remove('open'); | ||
| this.classList.remove('open'); | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> | ||
| <div class="callout">⚠️ <code>CLIPLOOP_API_KEY</code> is deprecated. Use <code>TALOCODE_API_KEY</code> for all hosted ClipLoop API access.</div> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This creates a root-level
app/directory in a project whose real routes live undersrc/app; Next documents thatsrc/appis ignored when a rootappdirectory is present (https://nextjs.org/docs/app/api-reference/file-conventions/src-folder). In this context the existing pages and public API routes undersrc/appwould drop out of routing, leaving only these new root routes active.Useful? React with 👍 / 👎.