From da38ea61c4b7db88d5a4c9db104edd0c550b0347 Mon Sep 17 00:00:00 2001 From: mchen Date: Tue, 5 Aug 2025 16:38:00 -0400 Subject: [PATCH 1/4] pinning and pricing --- src/components/ModelCatalog.tsx | 2 ++ src/content/docs/workers-ai/platform/pricing.mdx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/components/ModelCatalog.tsx b/src/components/ModelCatalog.tsx index 5a7dc014b24fa8..9a02787452b042 100644 --- a/src/components/ModelCatalog.tsx +++ b/src/components/ModelCatalog.tsx @@ -22,6 +22,8 @@ const ModelCatalog = ({ models }: { models: WorkersAIModelsSchema[] }) => { // List of model names to pin at the top const pinnedModelNames = [ + "@cf/openai/gpt-oss-120b", + "@cf/openai/gpt-oss-20b", "@cf/meta/llama-4-scout-17b-16e-instruct", "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "@cf/meta/llama-3.1-8b-instruct-fast", diff --git a/src/content/docs/workers-ai/platform/pricing.mdx b/src/content/docs/workers-ai/platform/pricing.mdx index 9c2101abcb3b8d..513728353f95de 100644 --- a/src/content/docs/workers-ai/platform/pricing.mdx +++ b/src/content/docs/workers-ai/platform/pricing.mdx @@ -54,6 +54,8 @@ The Price in Tokens column is equivalent to the Price in Neurons column - the di | @cf/google/gemma-3-12b-it | $0.345 per M input tokens
$0.556 per M output tokens | 31371 neurons per M input tokens
50560 neurons per M output tokens | | @cf/qwen/qwq-32b | $0.660 per M input tokens
$1.000 per M output tokens | 60000 neurons per M input tokens
90909 neurons per M output tokens | | @cf/qwen/qwen2.5-coder-32b-instruct | $0.660 per M input tokens
$1.000 per M output tokens | 60000 neurons per M input tokens
90909 neurons per M output tokens | +| @cf/openai/gpt-oss-120b | $0.350 per M input tokens
$0.750 per M output tokens | 31818 neurons per M input tokens
68182 neurons per M output tokens | +| @cf/openai/gpt-oss-20b | $0.200 per M input tokens
$0.300 per M output tokens | 18182 neurons per M input tokens
27273 neurons per M output tokens | ## Embeddings model pricing From cb89579488ba8a5252e0114a0f5838b1b000824d Mon Sep 17 00:00:00 2001 From: Craig Dennis Date: Tue, 5 Aug 2025 14:36:10 -0700 Subject: [PATCH 2/4] Adds Code Samples for Responses API --- .../OpenAIResponsesTextGenerationCode.astro | 83 +++++++++++++++++++ src/pages/workers-ai/models/[name].astro | 18 ++-- 2 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 src/components/models/code/OpenAIResponsesTextGenerationCode.astro diff --git a/src/components/models/code/OpenAIResponsesTextGenerationCode.astro b/src/components/models/code/OpenAIResponsesTextGenerationCode.astro new file mode 100644 index 00000000000000..83d9f03a64a20d --- /dev/null +++ b/src/components/models/code/OpenAIResponsesTextGenerationCode.astro @@ -0,0 +1,83 @@ +--- +import { z } from "astro:schema"; +import { Aside, Code } from "@astrojs/starlight/components"; +import Details from "~/components/Details.astro"; + +type Props = z.infer; + +const props = z.object({ + name: z.string(), + lora: z.boolean(), +}); + +const { name } = props.parse(Astro.props); + +const worker = ` +export default { + async fetch(request, env): Promise { + const response = await env.AI.run('${name}', { + instructions: 'You are a concise.', + input: 'What is the origin of the phrase Hello, World?', + }); + + return Response.json(response); + }, +} satisfies ExportedHandler; +`; + +const python = ` +import os +import requests + +ACCOUNT_ID = os.environ.get("CLOUDFLARE_ACCOUNT_ID") +AUTH_TOKEN = os.environ.get("CLOUDFLARE_AUTH_TOKEN") + +prompt = "Tell me all about PEP-8" +response = requests.post( + f"https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/v1/responses", + headers={"Authorization": f"Bearer {AUTH_TOKEN}"}, + json={ + "model": "${name}", + "input": "Tell me all about PEP-8" + } +) +result = response.json() +print(result) +`; + +const curl = ` +curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $CLOUDFLARE_AUTH_TOKEN" \ + -d '{ + "model": "${name}", + "input": "What are the benefits of open-source models?" + }' +`; +--- + +<> +
+ +
+ +
+ +
+ +
+ +
+ + + +) + diff --git a/src/pages/workers-ai/models/[name].astro b/src/pages/workers-ai/models/[name].astro index f37151f8e672bd..c65ccb844dd7bf 100644 --- a/src/pages/workers-ai/models/[name].astro +++ b/src/pages/workers-ai/models/[name].astro @@ -28,6 +28,7 @@ import LlamaGuard from "~/components/models/code/LlamaGuard.astro"; import BgeRerankerBase from "~/components/models/code/Bge-Reranker-Base.astro"; import { authorData } from "~/components/models/data"; +import OpenAIResponsesTextGenerationCode from "~/components/models/code/OpenAIResponsesTextGenerationCode.astro"; export const getStaticPaths = (async () => { const models = await getCollection("workers-ai-models"); @@ -108,6 +109,13 @@ if (model.name === "@cf/baai/bge-reranker-base") { CodeExamples = BgeRerankerBase; } +if ( + model.name === "@cf/openai/gpt-oss-120b" || + model.name === "@cf/openai/gpt-oss-20b" +) { + CodeExamples = OpenAIResponsesTextGenerationCode; +} + const description = model.description; const isBeta = model.properties.find( @@ -148,7 +156,7 @@ const starlightPageProps = { alt={`${author.name} logo`} /> ) : ( -
+
{model.name.split("/")[1].substring(0, 1)}
) @@ -156,10 +164,10 @@ const starlightPageProps = {

{name} - {isBeta && } + {isBeta && }

@@ -167,7 +175,7 @@ const starlightPageProps = { {model.name} -

{description}

+

{description}

{ model.name === "@cf/meta/llama-3.2-11b-vision-instruct" && ( @@ -256,4 +264,4 @@ const starlightPageProps = { - \ No newline at end of file + From b3ce9fc103ebab0fe0ee03da5a2441a86de8e202 Mon Sep 17 00:00:00 2001 From: Craig Dennis Date: Tue, 5 Aug 2025 14:37:36 -0700 Subject: [PATCH 3/4] Adds the /v1/responses to the note --- .../models/code/OpenAIResponsesTextGenerationCode.astro | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/models/code/OpenAIResponsesTextGenerationCode.astro b/src/components/models/code/OpenAIResponsesTextGenerationCode.astro index 83d9f03a64a20d..a12e70ec648144 100644 --- a/src/components/models/code/OpenAIResponsesTextGenerationCode.astro +++ b/src/components/models/code/OpenAIResponsesTextGenerationCode.astro @@ -71,8 +71,9 @@ curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/