These ten questions cover what surprises developers who move from demos to production: token counts that do not follow pixel counts, a budget estimate far above the bill, parameter combinations and sizes the API refuses, a DALL-E 86 parameter that no longer exists, a local text encoder that stops reading, metadata that one re-save erases, a glTF root node you did not create, a 3D API that answers the browser and art that locks its canvas. Every answer comes from a real run on 26 September 2026: questions 3 to 5 made five requests, of which only the one valid size was billed ($0.0033). Write down what each prints and why, then check Appendix H.
Checking your answers
Run the first two with node questions-1-5.mjs and python question-6.py, and question 7 in a shell. Questions 8 to 10 need a web server, because Chrome 1 will not let a page read files over file://: serve the folder with npx serve -l 3808, open http://localhost:3808/questions-8-10.html and read the DevTools console. Question 6 first prints a transformers warning about sequence length, which is itself a clue, and question 9 sends a key that no longer works, so it spends nothing. Predict each line, including the exact error text, before you run anything.
Questions
// questions-1-5.mjs: run next to budget.mjs with OPENAI_API_KEY set (one call is billed)
import OpenAI from 'openai';
import { outputTokens, estimate } from './budget.mjs';
// 1. Which costs more at low quality: a square image or the larger landscape one? (8.5.1)
console.log('1:', ['1024x1024', '1536x1024', '1024x1536'].map((s) => outputTokens(s, 'low')));
// 2. The 8.3 call with size and quality 'auto' cost $0.0066. What does estimate() say? (8.5.2)
console.log('2:', estimate({ size: 'auto', quality: 'auto' }).toFixed(4));
const openai = new OpenAI();
const ask = (params) => openai.images.generate({ model: 'gpt-image-2.5-flare',
prompt: 'A small open book, flat icon', size: '1024x640', quality: 'low', ...params })
.then((r) => `${r.size} ${r.usage.output_tokens} tokens`, (e) => e.message);
// 3. A transparent background as a JPEG. What comes back? (8.3.2)
console.log('3:', await ask({ background: 'transparent', output_format: 'jpeg' }));
// 4. Three custom sizes, all multiples of 16. Which succeed, and at what cost? (8.3.1)
for (const size of ['1008x640', '3072x768', '1024x640']) {
console.log('4:', await ask({ size }));
}
// 5. DALL-E returned URLs. Can a gpt-image model? (8.2.3)
console.log('5:', await ask({ response_format: 'url' }));# question-6.py: run in Section 8.11.3's virtual environment (needs only the tokenizer)
from transformers import CLIPTokenizer
tokenizer = CLIPTokenizer.from_pretrained('stable-diffusion-v1-5/stable-diffusion-v1-5',
subfolder='tokenizer')
prompt = """subject: Nestor, BookNest's mascot, a small round bluebird with a saffron belly.
pose: standing, full body, three-quarter view, holding a tiny open book.
style: flat vector illustration, clean outlines, no gradients.
palette: deep blue #1f5f8b, saffron #e09a10, cream #fff3e0.
composition: centered on a plain white background with generous margins.
avoid: no text, no other characters.""" # nestor.mjs's prompt (8.7.1)
ids = tokenizer(prompt).input_ids
kept = tokenizer(prompt, truncation=True, max_length=tokenizer.model_max_length).input_ids
print('6:', len(ids), len(kept), '| last words kept:', tokenizer.decode(kept[-6:-1]))c2patool icons.png --info
python -c "from PIL import Image; Image.open('icons.png').save('icons.webp')"
c2patool icons.webp --info<!-- Serve this folder (npx serve -l 3808) with cc0-mantel-clock.glb and booknest-art-1.jpg
beside the page, open http://localhost:3808/questions-8-10.html and read the console. -->
<canvas id="view" style="width: 200px; height: 150px"></canvas>
<script src="https://cdn.jsdelivr.net/npm/babylonjs@9.28.0/babylon.js"></script>
<script src="https://cdn.jsdelivr.net/npm/babylonjs-loaders@9.28.0"></script>
<script type="module">
// 8. What is the first mesh Babylon.js returns for a glTF file, and how is it transformed?
// (Section 8.12.4)
const scene = new BABYLON.Scene(new BABYLON.Engine(view, true));
const [root] = (await BABYLON.ImportMeshAsync('cc0-mantel-clock.glb', scene)).meshes;
const turn = root.rotationQuaternion.toEulerAngles().y; // radians about y
console.log('8:', root.name, root.scaling.toString(), turn);
// 9. The page calls Meshy directly with the old test key. Does the browser block it? (8.12.2)
const url = 'https://api.meshy.ai/openapi/v2/text-to-3d';
const init = { method: 'POST', body: '{}', headers: { 'Content-Type': 'application/json',
Authorization: 'Bearer msy_dummy_api_key_for_test_mode_12345678' } };
console.log('9:', await fetch(url, init).then((r) => r.status, (e) => e.message));
// 10. composeCover() reads pixels of art served from another origin, 127.0.0.1 instead of
// localhost. What happens? (Section 8.9.3)
const art = Object.assign(new Image(), { src: 'http://127.0.0.1:3808/booknest-art-1.jpg' });
await art.decode();
const ctx = document.createElement('canvas').getContext('2d');
ctx.drawImage(art, 0, 0);
try { console.log('10:', ctx.getImageData(0, 0, 1, 1).data.join()); }
catch (err) { console.log('10:', err.name, err.message); }
</script>