{
  "streamed": true,
  "usage": {
    "prompt_tokens": 114,
    "completion_tokens": 59603,
    "total_tokens": 59717,
    "cost": 1.490645,
    "is_byok": false,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0,
      "audio_tokens": 0,
      "video_tokens": 0
    },
    "cost_details": {
      "upstream_inference_cost": 1.490645,
      "upstream_inference_prompt_cost": 0.00057,
      "upstream_inference_completions_cost": 1.490075
    },
    "completion_tokens_details": {
      "reasoning_tokens": 7390,
      "image_tokens": 0,
      "audio_tokens": 0
    }
  },
  "finishReason": "stop",
  "content": "```html\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>Big Mac 3D</title>\n<style>*{margin:0;padding:0}body{overflow:hidden;background:#000}canvas{display:block}</style>\n</head>\n<body>\n<script type=\"importmap\">\n{\n  \"imports\": {\n    \"three\": \"https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js\",\n    \"three/addons/\": \"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/\"\n  }\n}\n</script>\n<script type=\"module\">\nimport * as THREE from 'three';\nimport { OrbitControls } from 'three/addons/controls/OrbitControls.js';\n\nconst renderer = new THREE.WebGLRenderer({ antialias: true });\nrenderer.setSize(innerWidth, innerHeight);\nrenderer.setPixelRatio(Math.min(devicePixelRatio, 2));\nrenderer.shadowMap.enabled = true;\nrenderer.shadowMap.type = THREE.PCFSoftShadowMap;\nrenderer.toneMapping = THREE.ACESFilmicToneMapping;\nrenderer.toneMappingExposure = 1.1;\nrenderer.outputColorSpace = THREE.SRGBColorSpace;\ndocument.body.appendChild(renderer.domElement);\n\nconst scene = new THREE.Scene();\nscene.background = new THREE.Color(0x1a120a);\nscene.fog = new THREE.FogExp2(0x1a120a, 0.025);\n\nconst camera = new THREE.PerspectiveCamera(35, innerWidth / innerHeight, 0.1, 100);\ncamera.position.set(4, 4, 5.5);\n\nconst ctrl = new OrbitControls(camera, renderer.domElement);\nctrl.enableDamping = true;\nctrl.dampingFactor = 0.05;\nctrl.minDistance = 3;\nctrl.maxDistance = 12;\nctrl.target.set(0, 1.5, 0);\nctrl.maxPolarAngle = Math.PI * 0.85;\n\n/* ── Procedural Textures ── */\n\nfunction mkTex(w, h, fn, linear) {\n  const c = document.createElement('canvas');\n  c.width = w; c.height = h;\n  fn(c.getContext('2d'), w, h);\n  const t = new THREE.CanvasTexture(c);\n  if (!linear) t.colorSpace = THREE.SRGBColorSpace;\n  return t;\n}\n\nfunction addNoise(ctx, w, h, amp) {\n  const id = ctx.getImageData(0, 0, w, h), d = id.data;\n  for (let i = 0; i < d.length; i += 4) {\n    const n = (Math.random() - .5) * amp;\n    d[i] = Math.min(255, Math.max(0, d[i] + n));\n    d[i+1] = Math.min(255, Math.max(0, d[i+1] + n * .9));\n    d[i+2] = Math.min(255, Math.max(0, d[i+2] + n * .6));\n  }\n  ctx.putImageData(id, 0, 0);\n}\n\nfunction addSpots(ctx, w, h, n, rMin, rMax, cr, cg, cb, aMin, aMax) {\n  for (let i = 0; i < n; i++) {\n    const x = Math.random()*w, y = Math.random()*h, r = rMin+Math.random()*(rMax-rMin);\n    const g = ctx.createRadialGradient(x,y,0,x,y,r);\n    g.addColorStop(0, `rgba(${cr+(Math.random()*30|0)},${cg+(Math.random()*20|0)},${cb+(Math.random()*15|0)},${aMin+Math.random()*(aMax-aMin)})`);\n    g.addColorStop(1, 'rgba(0,0,0,0)');\n    ctx.fillStyle = g; ctx.fillRect(x-r,y-r,r*2,r*2);\n  }\n}\n\nconst tBun = mkTex(512, 512, (c,w,h) => {\n  c.fillStyle='#C8893A'; c.fillRect(0,0,w,h);\n  addSpots(c,w,h,120,2,14,150,90,40,.1,.2);\n  addNoise(c,w,h,22);\n});\n\nconst tBunTop = mkTex(512, 512, (c,w,h) => {\n  c.fillStyle='#B87828'; c.fillRect(0,0,w,h);\n  addSpots(c,w,h,100,3,16,130,80,30,.12,.25);\n  addNoise(c,w,h,18);\n});\n\nconst tBunBump = mkTex(512, 512, (c,w,h) => {\n  c.fillStyle='#808080'; c.fillRect(0,0,w,h);\n  for (let i=0;i<600;i++){\n    const x=Math.random()*w,y=Math.random()*h,r=1+Math.random()*3,v=128+(Math.random()-.5)*50;\n    const g=c.createRadialGradient(x,y,0,x,y,r);\n    g.addColorStop(0,`rgb(${v+15},${v+15},${v+15})`);\n    g.addColorStop(1,`rgb(${v},${v},${v})`);\n    c.fillStyle=g;c.beginPath();c.arc(x,y,r,0,Math.PI*2);c.fill();\n  }\n  addNoise(c,w,h,30);\n}, true);\n\nconst tPatty = mkTex(512, 512, (c,w,h) => {\n  c.fillStyle='#4A2515'; c.fillRect(0,0,w,h);\n  c.strokeStyle='rgba(25,12,5,0.4)'; c.lineWidth=7;\n  for(let i=0;i<7;i++){c.beginPath();c.moveTo(0,35+i*68);for(let x=0;x<w;x+=15)c.lineTo(x,35+i*68+(Math.random()-.5)*3);c.stroke();}\n  addSpots(c,w,h,250,1,6,40,15,5,.15,.4);\n  addNoise(c,w,h,30);\n});\n\nconst tPattyBump = mkTex(256,256,(c,w,h)=>{c.fillStyle='#808080';c.fillRect(0,0,w,h);addNoise(c,w,h,55);},true);\n\nconst tLettuce = mkTex(256, 256, (c,w,h) => {\n  c.fillStyle='#5CB840'; c.fillRect(0,0,w,h);\n  for(let i=0;i<25;i++){\n    c.strokeStyle=`rgba(${35+(Math.random()*30|0)},${100+(Math.random()*50|0)},${25+(Math.random()*20|0)},0.3)`;\n    c.lineWidth=.5+Math.random()*2;c.beginPath();\n    let x=Math.random()*w,y=0;c.moveTo(x,y);\n    while(y<h){x+=(Math.random()-.5)*25;y+=10+Math.random()*30;c.lineTo(x,y);}\n    c.stroke();\n  }\n  addNoise(c,w,h,20);\n});\n\n/* ── Materials ── */\n\nconst mBun = new THREE.MeshStandardMaterial({\n  map:tBun, bumpMap:tBunBump, bumpScale:.15, roughness:.72, metalness:0\n});\nconst mBunTop = new THREE.MeshPhysicalMaterial({\n  map:tBunTop, bumpMap:tBunBump, bumpScale:.15,\n  roughness:.42, metalness:.02,\n  clearcoat:.25, clearcoatRoughness:.3,\n  sheen:.3, sheenRoughness:.5, sheenColor:new THREE.Color(0x8B5A2B)\n});\nconst mPatty = new THREE.MeshStandardMaterial({\n  map:tPatty, bumpMap:tPattyBump, bumpScale:.4, roughness:.85, metalness:0\n});\nconst mCheese = new THREE.MeshPhysicalMaterial({\n  color:0xF5A623, roughness:.3, metalness:0, side:THREE.DoubleSide,\n  clearcoat:.08, clearcoatRoughness:.3\n});\nconst mLettuce = new THREE.MeshStandardMaterial({\n  map:tLettuce, color:0x6CCF55, roughness:.55, metalness:0, side:THREE.DoubleSide\n});\nconst mSauce = new THREE.MeshStandardMaterial({color:0xE8A060, roughness:.25, metalness:.05});\nconst mPickle = new THREE.MeshStandardMaterial({color:0x5E8928, roughness:.45, metalness:0});\nconst mOnion = new THREE.MeshStandardMaterial({color:0xF0EBD8, roughness:.5, metalness:0, transparent:true, opacity:.88});\nconst mSeed = new THREE.MeshStandardMaterial({color:0xF5E6CA, roughness:.55, metalness:0});\n\n/* ── Geometry Builders ── */\n\nconst R = 1.8, SEG = 64;\nconst V2 = (x,y) => new THREE.Vector2(x,y);\nconst lathe = pts => new THREE.LatheGeometry(pts.map(p=>V2(p[0],p[1])), SEG);\n\nfunction makeBottomBun() {\n  const m = new THREE.Mesh(lathe([\n    [0,0],[R*.88,0],[R*.98,.02],[R*1.03,.1],[R*1.05,.2],\n    [R*1.04,.32],[R*1.0,.42],[R*.92,.48],[R*.7,.52],[R*.4,.54],[0,.55]\n  ]), mBun);\n  m.castShadow = m.receiveShadow = true; return m;\n}\n\nfunction makeTopBun() {\n  const H=1.1, pts=[[0,0],[R*.82,0],[R*.97,.02],[R*1.02,.06]];\n  for(let i=0;i<=28;i++){const t=i/28,a=t*Math.PI*.5;pts.push([R*Math.cos(a)*(1-t*t*.12),H*Math.sin(a)+.06]);}\n  pts.push([0,H+.06]);\n  const m = new THREE.Mesh(lathe(pts), mBunTop);\n  m.castShadow = m.receiveShadow = true; return m;\n}\n\nfunction makeMiddleBun() {\n  const r=R*.97, h=.32;\n  const m = new THREE.Mesh(lathe([\n    [0,0],[r*.88,0],[r*.98,.015],[r*1.02,.05],[r*1.04,h*.4],\n    [r*1.03,h*.65],[r*1.0,h*.85],[r*.95,h-.01],[r*.85,h],[r*.5,h+.01],[0,h+.015]\n  ]), mBun);\n  m.castShadow = m.receiveShadow = true; return m;\n}\n\nfunction makePatty() {\n  const h=.22,r=R*.96,pts=[[0,.01],[r*.5,0],[r*.85,.01]];\n  for(let i=0;i<=10;i++){const t=i/10;pts.push([r+Math.sin(t*Math.PI*4)*.025+Math.sin(t*Math.PI*7)*.015+.03,t*h]);}\n  pts.push([r*.85,h-.01],[r*.5,h],[0,h-.01]);\n  const g=lathe(pts); g.computeVertexNormals();\n  const m=new THREE.Mesh(g,mPatty); m.castShadow=m.receiveShadow=true; return m;\n}\n\nfunction makeCheese(rot) {\n  const s=R*1.15, g=new THREE.PlaneGeometry(s*2,s*2,28,28);\n  const p=g.attributes.position;\n  for(let i=0;i<p.count;i++){\n    const x=p.getX(i),y=p.getY(i),d=Math.max(Math.abs(x),Math.abs(y));\n    let z=d>R*.7?-(d-R*.7)*.35+Math.sin(Math.atan2(y,x)*6)*.02:0;\n    p.setZ(i,z+(Math.random()-.5)*.008);\n  }\n  g.rotateZ(rot); g.computeVertexNormals();\n  const m=new THREE.Mesh(g,mCheese); m.rotation.x=-Math.PI/2;\n  m.castShadow=m.receiveShadow=true; return m;\n}\n\nfunction makeLettuce() {\n  const grp=new THREE.Group();\n  for(let i=0;i<12;i++){\n    const ang=i/12*Math.PI*2+Math.random()*.3, w=.5+Math.random()*.35, l=.7+Math.random()*.45;\n    const g=new THREE.PlaneGeometry(w,l,10,6), pos=g.attributes.position;\n    for(let j=0;j<pos.count;j++){\n      const x=pos.getX(j),y=pos.getY(j),e=Math.abs(y)/(l*.5);\n      pos.setZ(j,Math.sin(x*8+i*2)*.07*(.5+e)+Math.sin(x*13+y*5)*.035-e*e*.1);\n    }\n    g.computeVertexNormals();\n    const mat=mLettuce.clone();\n    mat.color.setHSL(.33+(Math.random()-.5)*.08,.6+Math.random()*.15,.42+Math.random()*.1);\n    const m=new THREE.Mesh(g,mat);\n    const rd=R*.65+Math.random()*R*.3;\n    m.position.set(Math.cos(ang)*rd,(Math.random()-.5)*.06,Math.sin(ang)*rd);\n    m.rotation.set(-Math.PI/2+(Math.random()-.5)*.35,ang+Math.PI+(Math.random()-.5)*.25,0);\n    m.castShadow=true; grp.add(m);\n  }\n  return grp;\n}\n\nfunction makeSauce() {\n  const grp=new THREE.Group();\n  for(let i=0;i<9;i++){\n    const ang=i/9*Math.PI*2,r=R*.5+Math.random()*R*.28;\n    const g=new THREE.SphereGeometry(.1+Math.random()*.07,8,6); g.scale(1,.3,1.2);\n    const m=new THREE.Mesh(g,mSauce);\n    m.position.set(Math.cos(ang)*r,0,Math.sin(ang)*r);\n    m.rotation.y=Math.random()*Math.PI; m.castShadow=true; grp.add(m);\n  }\n  return grp;\n}\n\nfunction makePickles() {\n  const grp=new THREE.Group();\n  for(let i=0;i<4;i++){\n    const ang=i/4*Math.PI*2+.4,r=R*.3+Math.random()*R*.35;\n    const m=new THREE.Mesh(new THREE.CylinderGeometry(.22,.22,.05,16),mPickle);\n    m.position.set(Math.cos(ang)*r,0,Math.sin(ang)*r);\n    m.rotation.x=(Math.random()-.5)*.1; m.castShadow=true; grp.add(m);\n  }\n  return grp;\n}\n\nfunction makeOnions() {\n  const grp=new THREE.Group();\n  for(let i=0;i<20;i++){\n    const ang=Math.random()*Math.PI*2,r=Math.random()*R*.7,s=.03+Math.random()*.05;\n    const m=new THREE.Mesh(new THREE.BoxGeometry(s,.015,s*(.4+Math.random())),mOnion);\n    m.position.set(Math.cos(ang)*r,Math.random()*.02,Math.sin(ang)*r);\n    m.rotation.y=Math.random()*Math.PI; grp.add(m);\n  }\n  return grp;\n}\n\nfunction makeSeeds() {\n  const grp=new THREE.Group(), H=1.1;\n  const sg=new THREE.SphereGeometry(1,8,6); sg.scale(.04,.02,.08);\n  for(let i=0;i<55;i++){\n    const phi=Math.random()*Math.PI*2,t=.12+Math.random()*.6,a=t*Math.PI*.5;\n    const sr=R*Math.cos(a)*(1-t*t*.12)*1.015, sy=H*Math.sin(a)+.06;\n    const x=sr*Math.cos(phi),z=sr*Math.sin(phi);\n    const seed=new THREE.Mesh(sg,mSeed); seed.position.set(x,sy,z);\n    const n=new THREE.Vector3(x,(sy-.06)*R*R/(H*H),z).normalize();\n    seed.quaternion.setFromUnitVectors(new THREE.Vector3(0,1,0),n);\n    seed.rotateY(Math.random()*Math.PI);\n    seed.castShadow=true; grp.add(seed);\n  }\n  return grp;\n}\n\n/* ── Assemble Burger ── */\n\nconst burger = new THREE.Group();\nlet y = 0;\nfunction add(m,dy){m.position.y=y;burger.add(m);y+=dy;}\n\nadd(makeBottomBun(),.56);\nadd(makeSauce(),.06);\nadd(makeLettuce(),.1);\nadd(makeCheese(Math.PI/4),.04);\nadd(makePatty(),.25);\nadd(makeMiddleBun(),.35);\nadd(makeSauce(),.06);\nadd(makeLettuce(),.1);\nadd(makeCheese(0),.04);\nadd(makePatty(),.25);\nadd(makePickles(),.06);\nadd(makeOnions(),.03);\n\nconst topBun=makeTopBun(); topBun.position.y=y; burger.add(topBun);\nconst seeds=makeSeeds(); seeds.position.y=y; burger.add(seeds);\n\nscene.add(burger);\n\n/* ── Environment Map ── */\n\nconst ec=document.createElement('canvas'); ec.width=512; ec.height=256;\nconst ex=ec.getContext('2d');\nconst eg=ex.createLinearGradient(0,0,0,256);\neg.addColorStop(0,'#352010'); eg.addColorStop(.35,'#503820');\neg.addColorStop(.5,'#604828'); eg.addColorStop(.65,'#503820'); eg.addColorStop(1,'#150A04');\nex.fillStyle=eg; ex.fillRect(0,0,512,256);\nex.fillStyle='rgba(255,230,190,0.4)'; ex.beginPath(); ex.arc(140,70,40,0,Math.PI*2); ex.fill();\nex.fillStyle='rgba(255,210,160,0.2)'; ex.beginPath(); ex.arc(350,85,50,0,Math.PI*2); ex.fill();\nex.fillStyle='rgba(255,240,200,0.15)'; ex.beginPath(); ex.arc(256,50,25,0,Math.PI*2); ex.fill();\n\nconst envTex=new THREE.CanvasTexture(ec);\nenvTex.mapping=THREE.EquirectangularReflectionMapping;\nenvTex.colorSpace=THREE.SRGBColorSpace;\nconst pmrem=new THREE.PMREMGenerator(renderer);\nscene.environment=pmrem.fromEquirectangular(envTex).texture;\nenvTex.dispose(); pmrem.dispose();\n\n/* ── Lighting ── */\n\nconst key=new THREE.DirectionalLight(0xFFF4E0,3);\nkey.position.set(4,8,3); key.castShadow=true;\nkey.shadow.mapSize.set(2048,2048);\nkey.shadow.bias=-.0005; key.shadow.normalBias=.02;\nObject.assign(key.shadow.camera,{near:1,far:20,left:-5,right:5,top:5,bottom:-5});\nscene.add(key);\n\nconst fill=new THREE.DirectionalLight(0xC0D8FF,.6);\nfill.position.set(-3,3,4); scene.add(fill);\n\nconst rim=new THREE.DirectionalLight(0xFFD0A0,1.5);\nrim.position.set(-1,4,-4); scene.add(rim);\n\nconst side=new THREE.DirectionalLight(0xFFE8C0,.4);\nside.position.set(5,2,-2); scene.add(side);\n\nconst topPt=new THREE.PointLight(0xFFF0D0,.8,12);\ntopPt.position.set(0,6,0); topPt.castShadow=true;\ntopPt.shadow.mapSize.set(1024,1024); scene.add(topPt);\n\nscene.add(new THREE.HemisphereLight(0xFFE8D0,0x302010,.45));\n\nconst bounce=new THREE.PointLight(0xFF9060,.2,6);\nbounce.position.y=-.5; scene.add(bounce);\n\n/* ── Ground ── */\n\nconst gDiff=mkTex(512,512,(c,w,h)=>{\n  c.fillStyle='#28180C'; c.fillRect(0,0,w,h);\n  for(let i=0;i<35;i++){\n    const yy=Math.random()*h;\n    c.strokeStyle=`rgba(${25+(Math.random()*15|0)},${12+(Math.random()*10|0)},${6+(Math.random()*6|0)},.18)`;\n    c.lineWidth=.5+Math.random()*1.5; c.beginPath(); c.moveTo(0,yy);\n    for(let x=0;x<w;x+=25)c.lineTo(x,yy+(Math.random()-.5)*4); c.stroke();\n  }\n  addNoise(c,w,h,12);\n});\nconst gBump=mkTex(256,256,(c,w,h)=>{c.fillStyle='#808080';c.fillRect(0,0,w,h);addNoise(c,w,h,18);},true);\n\nconst ground=new THREE.Mesh(\n  new THREE.PlaneGeometry(25,25),\n  new THREE.MeshStandardMaterial({map:gDiff,bumpMap:gBump,bumpScale:.08,roughness:.85,metalness:.05})\n);\nground.rotation.x=-Math.PI/2; ground.position.y=-.02;\nground.receiveShadow=true; scene.add(ground);\n\n/* ── Animate ── */\n\nconst clock=new THREE.Clock();\n(function loop(){\n  requestAnimationFrame(loop);\n  const t=clock.getElapsedTime();\n  burger.rotation.y=t*.25;\n  burger.position.y=.02+Math.sin(t*.5)*.015;\n  ctrl.update();\n  renderer.render(scene,camera);\n})();\n\naddEventListener('resize',()=>{\n  camera.aspect=innerWidth/innerHeight;\n  camera.updateProjectionMatrix();\n  renderer.setSize(innerWidth,innerHeight);\n});\n</script>\n</body>\n</html>\n```"
}