Cloudflare R2 is used to store image, audio, and PDF files. It is
free, has zero egress fees, and is S3 compatible.
Chat with PDF
Upload a PDF and use OpenAI to chat with it
Voice to notes
Record audio, transcribe it and summarize it using AI
Stable Diffusion XL
Generate images using SDXL
DALL-E
Generate logos using DALL-E
GPT-4o & Vision
Analyze and describe images using GPT-4 or GPT Vision
Set up Cloudflare R2
Setting it up is easy and shouldn’t take more than 5 minutes.1. Create a bucket

Create an R2 bucket on Cloudflare
- Go to Cloudflare -> R2 -> Overview
- Click “Create a bucket”
- Give your bucket a name
- Choose a location
.env
file.
2. Enable public access
- Go to your bucket
- Click on Settings
- Copy your S3 API and Location
- You can remove the name of your bucket from the link. For instance, in the image below, you would copy everything except the /testing part.

Copy your endpoint ID and location
- Now you have two options:
- Option A: If you have a domain name on Cloudflare, add a custom domain, e.g.,
cdn.anotherwrapper.com
. Your files will be accessible from that domain. - Option B: If you don’t have a custom domain, allow the
R2.dev
subdomain. Note: This is not recommended for production environments as it is rate-limited.
- Option A: If you have a domain name on Cloudflare, add a custom domain, e.g.,
.env
file.

Use an R2.dev domain if you don't have a custom one
3. Get API keys and other information
- Go to R2 -> Overview
- Click on Manage R2 API tokens
Click on Manage R2 API tokens
- Click on Create API token
- Under permissions, give it
Admin Read & Write
. This allows users to delete their own data. - Define how long the token will stay active
- Click save

Copy the Access Key ID and the Secret Access Key
.env
file:
.env
@/lib/cloudflare.ts
.