Prompt Buddy logoPrompt Buddy

cloudflare · Cloudflare Workers Docs

Workers Create a fine-tuned OpenAI model with R2

A step-by-step tutorial for building a Cloudflare Worker that retrieves fine-tuning datasets from R2 storage and transmits them to the OpenAI API to create custom models.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Workers Create a fine-tuned OpenAI model with R2

A step-by-step tutorial for building a Cloudflare Worker that retrieves fine-tuning datasets from R2 storage and transmits them to the OpenAI API to create custom models.

When To Use

Use when you need to automate the process of feeding training data stored in Cloudflare R2 into OpenAI's fine-tuning API using a Worker application.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-workflow-guide.mdA tutorial guide for using Cloudflare Workers and R2 storage to facilitate the creation of fine-tuned OpenAI models.Questions about a tutorial guide for using Cloudflare Workers and R2 storage to facilitate the creation of fine-tuned OpenAI models.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m.textA step-by-step guide and command sequence for creating a Cloudflare Worker to fine-tune OpenAI models using R2 storage.Exact payloads, commands, or snippets shown in A step-by-step guide and command sequence for creating a Cloudflare Worker to fine-tune OpenAI models using R2 storage.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-2.textThe terminal command used to initialize the fine-tuning project template via the Cloudflare CLI.Exact payloads, commands, or snippets shown in The terminal command used to initialize the fine-tuning project template via the Cloudflare CLI.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-3.textThe pnpm command used to initialize a new Cloudflare Workers project for fine-tuning OpenAI models using R2 storage.Exact payloads, commands, or snippets shown in The pnpm command used to initialize a new Cloudflare Workers project for fine-tuning OpenAI models using R2 storage.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-4.textA sequence of terminal commands and directory navigation steps for setting up the fine-tuning project environment.Exact payloads, commands, or snippets shown in A sequence of terminal commands and directory navigation steps for setting up the fine-tuning project environment.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-5.textA shell command used to create a new R2 bucket via the Wrangler CLI.Exact payloads, commands, or snippets shown in A shell command used to create a new R2 bucket via the Wrangler CLI.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-6.textA wrangler cli command used to upload a file to a Cloudflare R2 bucket.Exact payloads, commands, or snippets shown in A wrangler cli command used to upload a file to a Cloudflare R2 bucket.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-7.textA configuration object defining R2 bucket bindings and settings for fine-tuning OpenAI models using Cloudflare Workers.Exact payloads, commands, or snippets shown in A configuration object defining R2 bucket bindings and settings for fine-tuning OpenAI models using Cloudflare Workers.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-8.textA configuration text file defining the R2 bucket binding and bucket name required to store fine-tuning data for OpenAI models using Cloudflare Workers.Exact payloads, commands, or snippets shown in A configuration text file defining the R2 bucket binding and bucket name required to store fine-tuning data for OpenA...
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-9.textA text-based guide and implementation steps for using Cloudflare Workers and R2 to facilitate OpenAI model fine-tuning.Exact payloads, commands, or snippets shown in A text-based guide and implementation steps for using Cloudflare Workers and R2 to facilitate OpenAI model fine-tuning.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-10.textA text file containing the shell command to add the Hono web framework dependency for the Cloudflare Workers OpenAI fine-tuning tutorial.Exact payloads, commands, or snippets shown in A text file containing the shell command to add the Hono web framework dependency for the Cloudflare Workers OpenAI f...
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-11.textA text file showing the pnpm command to add the Hono web framework for the Cloudflare Workers R2 and OpenAI fine-tuning tutorial.Exact payloads, commands, or snippets shown in A text file showing the pnpm command to add the Hono web framework for the Cloudflare Workers R2 and OpenAI fine-tuni...
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-12.textA list of terminal commands to install the Hono web framework using Bun for a Cloudflare Workers project.Exact payloads, commands, or snippets shown in A list of terminal commands to install the Hono web framework using Bun for a Cloudflare Workers project.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-13.textThe shell commands required to install the OpenAI npm package for the fine-tuning tutorial.Exact payloads, commands, or snippets shown in The shell commands required to install the OpenAI npm package for the fine-tuning tutorial.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-14.textThe shell commands required to install the openai package via yarn for the fine-tuning tutorial.Exact payloads, commands, or snippets shown in The shell commands required to install the openai package via yarn for the fine-tuning tutorial.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-15.textThe shell commands required to install the openai package using pnpm for the Workers R2 fine-tuning tutorial.Exact payloads, commands, or snippets shown in The shell commands required to install the openai package using pnpm for the Workers R2 fine-tuning tutorial.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-16.textThe shell commands required to install the openai package using bun for a Cloudflare Workers project.Exact payloads, commands, or snippets shown in The shell commands required to install the openai package using bun for a Cloudflare Workers project.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-17.textA Hono-based Cloudflare Worker implementation that integrates OpenAI API with R2 storage for fine-tuning models.Exact payloads, commands, or snippets shown in A Hono-based Cloudflare Worker implementation that integrates OpenAI API with R2 storage for fine-tuning models.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-18.textA TypeScript code snippet demonstrating how to retrieve a blob from Cloudflare R2 and upload it to OpenAI for model fine-tuning using a Worker.Exact payloads, commands, or snippets shown in A TypeScript code snippet demonstrating how to retrieve a blob from Cloudflare R2 and upload it to OpenAI for model f...
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-19.textA TypeScript code snippet demonstrating how to use Cloudflare Workers to trigger an OpenAI fine-tuning job using a file stored in R2.Exact payloads, commands, or snippets shown in A TypeScript code snippet demonstrating how to use Cloudflare Workers to trigger an OpenAI fine-tuning job using a fi...
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-20.textA TypeScript code snippet demonstrating how to use the OpenAI client within a Cloudflare Worker to list fine-tuning jobs.Exact payloads, commands, or snippets shown in A TypeScript code snippet demonstrating how to use the OpenAI client within a Cloudflare Worker to list fine-tuning j...
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-21.textA command-line instruction for setting the OPENAI_API_KEY secret using Wrangler in a Cloudflare Workers environment.Exact payloads, commands, or snippets shown in A command-line instruction for setting the OPENAIAPIKEY secret using Wrangler in a Cloudflare Workers environment.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-22.textThe wrangler deploy command used to deploy the Cloudflare Worker for fine-tuning OpenAI models with R2 storage.Exact payloads, commands, or snippets shown in The wrangler deploy command used to deploy the Cloudflare Worker for fine-tuning OpenAI models with R2 storage.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-23.textA curl command to request a fine-tuning JSONL file from a Cloudflare Worker via R2 storage.Exact payloads, commands, or snippets shown in A curl command to request a fine-tuning JSONL file from a Cloudflare Worker via R2 storage.
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-24.textA curl command demonstrating how to request a list of fine-tuned OpenAI models via a Cloudflare Worker using an R2 file ID.Exact payloads, commands, or snippets shown in A curl command demonstrating how to request a list of fine-tuned OpenAI models via a Cloudflare Worker using an R2 fi...
examples/workers-create-finetuned-chatgpt-ai-models-with-r2-a-fine-tuned-openai-m-25.textA JavaScript code snippet demonstrating how to call a fine-tuned OpenAI model using Cloudflare Workers and R2 storage.Exact payloads, commands, or snippets shown in A JavaScript code snippet demonstrating how to call a fine-tuned OpenAI model using Cloudflare Workers and R2 storage.

What This Skill Covers

  • In this tutorial, you will use the OpenAI ↗ API and Cloudflare R2 to create a fine-tuned model ↗.
  • Main sections: Tags, Prerequisites, 1\. Create a Worker application, 2\. Upload a fine-tune document to R2, 3\. Bind your bucket to the Worker.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://developers.cloudflare.com/workers/tutorials/create-finetuned-chatgpt-ai-models-with-r2