Duck
Tutorials5 min read

How to Build a Google Slides AI Generator for Client Decks

Samet Turan— Editor··5 min read

Learn to create a Google Slides AI generator that turns prompts into polished decks, with real examples, pricing, and debugging tips.

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.

What I love and what annoys me

Love: the moment the deck appears in my Google Drive folder with the correct theme applied and the bullets already populated—I can open it, tweak a single sentence, and hit “Present” in under two minutes. That speed lets me turn a client call into a visual follow‑up while the conversation is still fresh.

Gripe: Google’s Slides API requires you to pre‑generate every objectId you plan to reference, and there’s no convenient way to reserve a block of IDs in advance. I ended up writing a small UUID‑like generator that guarantees uniqueness, but it feels like a workaround for something the API should handle internally.

Is the free tier actually usable? (reader question)

If you’re just experimenting, the free tier of OpenAI gives you $5 of credit, which is enough for about 300 decks at the output size I use. The Slides API itself is free as long as you stay under the daily request quota (100 batchUpdate calls per day per project). For a solo operator testing ideas, that’s more than enough—no paid cloud compute needed if you run the script on your laptop.

However, once you cross a few hundred decks a day you’ll hit the OpenAI rate limit and the Slides quota, and you’ll need to upgrade to a paid plan or spin up your own container. The jump from free to paid isn’t steep—$20 a month gets you 1M OpenAI tokens, which covers roughly 650 decks at my usage level.

We cover this in more depth elsewhere — AI meeting tools coverage.

Putting it all together: a minimal operator playbook

  1. Create a Google Cloud project, enable the Slides API, and create a service account with presentations.edit scope. Download the JSON key.
  2. Store the key securely (I use Docker secrets) and set the environment variable GOOGLE_APPLICATION_CREDENTIALS to its path.
  3. Write a small Node.js (or Python) script that:
    • Accepts a user prompt via CLI or HTTP.
    • Calls the OpenAI chat endpoint with the system prompt shown above.
    • Parses the returned string as JSON (throw if invalid).
    • Posts the JSON to the Slides batchUpdate endpoint using the service account token.
    • Returns the newly created presentation URL.
  4. Deploy the script to Cloud Run (or run it locally with node index.js). Set the concurrency to 1 to avoid cold‑start spikes.
  5. Test with a simple prompt like "Quarterly sales outlook for SaaS startup". Verify the deck opens and the theme is applied.

If you’d rather skip the build and deploy a working version in an afternoon, we’ve packaged this workflow as a blueprint at deepusecase.com/vault.

— The Colophon

One AI tool. Tested. Reviewed.
In your inbox every Sunday.

~3 minute read. Real outcomes from operators, not marketers.

Free. One email per Sunday. Unsubscribe in one click.