Skip to content

Instantly share code, notes, and snippets.

@ftnext
Last active February 9, 2026 15:13
Show Gist options
  • Select an option

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

Select an option

Save ftnext/b426888355bc7d86bf796ca644abd94e to your computer and use it in GitHub Desktop.
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "anthropic>=0.79.0",
# ]
# ///
from pathlib import Path
import anthropic
file_id = "file_011CXxbZQ9DcZHExMDwDZWfA"
OUTPUT_DIR = Path(__file__).parent / "outputs"
OUTPUT_DIR.mkdir(exist_ok=True)
client = anthropic.Anthropic()
file_info = client.beta.files.retrieve_metadata(file_id=file_id)
file_content = client.beta.files.download(file_id=file_id)
with (OUTPUT_DIR / file_info.filename).open("wb") as f:
f.write(file_content.read())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment