CloudCodeTree LogoCloudCodeTree
AI NewsTutorialsAbout
CloudCodeTree Logo
CloudCodeTree
  • AI News
  • Tutorials
  • About
← Back to AI News
Add PPTX, XLSX, DOCX, and PDF Generation to Any Claude API Call With Two Beta Headers

Add PPTX, XLSX, DOCX, and PDF Generation to Any Claude API Call With Two Beta Headers

Chris Harper

2 min read

Jul 5, 2026 · 20:05 UTC

AI
Workflow
Agents
Claude Code
Best Practices

TL;DR: Anthropic's Agent Skills API generates real Office documents from a plain messages.create call — add a container.skills param and two beta headers, retrieve the file via the Files API.

The Anthropic API now includes four pre-built "Agent Skills" for document creation: PowerPoint (pptx), Excel (xlsx), Word (docx), and PDF (pdf). Enabling one adds a single extra parameter to your existing messages.create call — no separate microservice, no file-parsing boilerplate.

How it works

Claude writes Python that produces the document, executes it in a sandboxed code-execution container, and returns a file_id you download via the Files API. You send the request, you download the result.

The minimal Python call

import anthropic
from pathlib import Path
import tempfile

client = anthropic.Anthropic()

response = client.beta.messages.create(
    model="claude-opus-4-8",
    max_tokens=16000,
    betas=["code-execution-2025-08-25", "skills-2025-10-02"],
    container={
        "skills": [{"type": "anthropic", "skill_id": "pptx", "version": "latest"}]
    },
    messages=[{"role": "user", "content": "Create a 5-slide Q2 results deck"}],
    tools=[{"type": "code_execution_20250825", "name": "code_execution"}],
)

Two beta headers: code-execution-2025-08-25 and skills-2025-10-02. The container.skills array picks the skill. Swap pptx for xlsx, docx, or pdf.

Getting the file back

file_id = None
for block in response.content:
    if block.type == "code_execution_tool_result":
        if block.content.type == "code_execution_result":
            for output in block.content.content:
                file_id = output.file_id

if file_id:
    out = Path(tempfile.gettempdir()) / "output.pptx"
    client.beta.files.download(file_id=file_id).write_to_file(out)

When to reach for this

  • Report pipelines: generate a formatted PDF/PPTX from structured data without a separate templating layer
  • Agent deliverables: give your agent a tool that outputs an actual file (Excel model, Word brief) instead of Markdown
  • Automation: replace scripts that call python-docx directly — let Claude handle the structure and formatting

List available skills at runtime: client.beta.skills.list(source="anthropic") returns pptx, xlsx, docx, pdf with display titles. Custom skills (domain expertise packaged as a skill and uploaded via the API) are also available through the Agent Skills Cookbook.

Sources: Agent Skills quickstart — Anthropic Platform Docs, Agent Skills overview, anthropics/skills — GitHub