Last quarter I needed a way to spit out investor‑ready slide decks from a one‑sentence brief without spending hours in PowerPoint. The problem wasn’t the ideas—it was the repetitive formatting, theme tweaks, and placeholder hunting that ate up my billable time. After a few failed attempts with generic AI writers, I built a small pipeline that takes a prompt, runs it through a language model, and spits out a ready‑to‑edit Google Slides file.
What most guides get wrong
Most tutorials treat the AI as a magic black box that can be pointed at Google Slides and expect perfect output. They skip the part where the model has to speak the Slides JSON schema, and they ignore the fact that Slides API expects specific object IDs for each element. The result is either a blank presentation or a file that throws a 400 error when you try to open it.
What actually works is to separate the generation into two clear steps: first, produce a structured outline in JSON that matches the Slides batchUpdate format; second, send that JSON to the Slides API via a simple POST. If you try to generate raw HTML or Markdown and then hope Slides will import it, you’ll waste time debugging formatting issues that never surface in the logs.
How to debug when this breaks
When the API returns a 400, the error message usually points to the first malformed request in the batch. Open the response body, look for the “index” field—it tells you which operation in the array failed. Common culprits are missing “objectId” fields on shapes, or trying to set text on a shape that doesn’t exist yet. I keep a small log file that writes the outgoing JSON to disk before each call; comparing the good and bad versions side by side makes the typo obvious.
Another frequent snag is the page size mismatch. If you set a shape’s width to 9000000 EMUs (the default slide width) but forget to convert from points, the shape ends up off‑canvas and Slides silently clips it. The fix is to multiply your point values by 12700 (the EMU per point) before inserting them into the request.
Concrete named example: prompt, tool, cost
Here’s the exact prompt I feed to OpenAI GPT‑4o (the model I use because it handles long JSON outputs reliably):
You are a slide deck generator. Output ONLY a valid Google Slides batchUpdate JSON array. No extra text. The deck must have a title slide and three content slides. Use the theme 'Simple Light'. Each slide should have a title placeholder and a body placeholder. Fill the title with the user's idea and the body with three bullet points that expand on it. User prompt: "AI‑powered supply chain optimization for mid‑size manufacturers".
The model returns something like:
[ {"createSlide":{"slideLayoutReference":{"predefinedLayout":"TITLE"}}}, {"createShape":{"objectId":"title1","shapeType":"TEXT_BOX","elementProperties":{"pageObjectId":"slide1","size":{"height":{"magnitude":1000000,"unit":"EMU"},"width":{"magnitude":5000000,"unit":"EMU"}},"transform":{"scaleX":1,"scaleY":1,"translateX":100000,"translateY":100000,"unit":"EMU"}}}}, {"insertText":{"objectId":"title1","text":"AI‑powered supply chain optimization for mid‑size manufacturers"}}, ... ]
I then POST that array to https://slides.googleapis.com/v1/presentations/{presentationId}:batchUpdate with a Bearer token from a service account. The whole flow runs in a cheap Cloud Run container that costs about $0.0004 per invocation; at 500 runs a month that’s under $0.20, plus the OpenAI token cost of roughly $0.015 per deck (based on 800‑token output at $0.02 per 1k tokens). So each finished deck is roughly $0.016 in compute plus $0.015 in AI—call it $0.03 total.
I think $0.03 per deck is a steal compared to the $15‑$20 I’d pay a designer for a quick mockup, but if you’re doing high‑volume sales enablement the OpenAI cost can add up. In that case swapping to a local Llama‑3 8B model quantized to 4‑bit drops the AI cost to under $0.005 per deck, though you lose a bit of fluency on niche industry jargon.
