Skip to content

Instantly share code, notes, and snippets.

@ftnext
Last active February 10, 2026 14:42
Show Gist options
  • Select an option

  • Save ftnext/3d2cec4cea08dd56562af111eade14f0 to your computer and use it in GitHub Desktop.

Select an option

Save ftnext/3d2cec4cea08dd56562af111eade14f0 to your computer and use it in GitHub Desktop.
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "anthropic>=0.79.0",
# ]
# ///
import anthropic
client = anthropic.Anthropic()
pptx_response = client.beta.messages.create(
model="claude-haiku-4-5-20251001",
max_tokens=4096,
container={
"skills": [{"type": "anthropic", "skill_id": "pptx", "version": "latest"}]
},
tools=[
{"type": "code_execution_20250825", "name": "code_execution"},
{"type": "web_search_20250305", "name": "web_search", "max_uses": 3},
],
messages=[
{
"role": "user",
"content": """\
アイドルマスターミリオンライブ!のエミリースチュアートさんについて、2025年の活躍を網羅的に知りたい
ミリシタのイベントやカードへの登場、コラボへの抜擢、ライブでの歌唱など
Create a PowerPoint presentation.
Use clean, professional formatting.
""",
}
],
betas=["code-execution-2025-08-25", "files-api-2025-04-14", "skills-2025-10-02"],
)
print("PowerPoint Response:")
print("=" * 80)
for content in pptx_response.content:
# if content.type == "text":
# print(content.text)
print(content)
print("\n\n📊 Token Usage:")
print(f" Input: {pptx_response.usage.input_tokens}")
print(f" Output: {pptx_response.usage.output_tokens}")
for block in pptx_response.content:
# Check for bash_code_execution_tool_result (beta API format)
if block.type == "bash_code_execution_tool_result":
try:
if hasattr(block, "content") and hasattr(block.content, "content"):
for item in block.content.content:
if hasattr(item, "file_id"):
print("File created:", item.file_id)
except Exception as e:
print(f"Warning: Error parsing bash_code_execution_tool_result: {e}")
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment