• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
aarav_jagota

aarav_jagota

final-ai-fasion

Public
Like
final-ai-fasion
Home
Code
2
README.md
main.ts
Environment variables
Branches
1
Pull requests
Remixes
History
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
Viewing readonly version of main branch: v4
View latest version
README.md

final-ai-fasion

// TallFit AI Backend - Correct & Secure Version export default async function handler(req) { const corsHeaders = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'POST, OPTIONS', 'Access-Control-Allow-Headers': 'Content-Type', };

if (req.method === 'OPTIONS') { return new Response(null, { headers: corsHeaders }); }

try { const body = await req.json();

const response = await fetch("https://api.anthropic.com/v1/messages", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": Deno.env.get("ANTHROPIC_API_KEY"),   // ← This line is correct
    "anthropic-version": "2023-06-01"
  },
  body: JSON.stringify({
    model: body.model || "claude-3-5-sonnet-20241022",
    max_tokens: body.max_tokens || 1200,
    system: body.system || "You are a helpful tall fashion assistant.",
    messages: body.messages || []
  })
});

const data = await response.json();

return Response.json(data, { 
  headers: { ...corsHeaders, "Content-Type": "application/json" } 
});

} catch (error) { console.error(error); return Response.json( { error: "Failed to get response from AI" }, { status: 500, headers: corsHeaders } ); } }

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
AboutAlternativesPricingBlogNewsletterCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.