workerd icon indicating copy to clipboard operation
workerd copied to clipboard

Types missing for new AI models `gpt-oss-120b`, `gpt-oss-20b`

Open Cherry opened this issue 6 months ago • 4 comments

This model is missing from the input types:

await env.AI.run('@cf/openai/gpt-oss-120b', {
	instructions: 'some prompt'
	input: 'some input',
	max_tokens: 10240,
})

Argument of type '"@cf/openai/gpt-oss-120b"' is not assignable to parameter of type 'keyof AiModels'.ts(2345)

And I've not found any output type that matches the output correctly either. It's very different from AiTextGenerationOutput. This isn't helped when https://developers.cloudflare.com/workers-ai/models/gpt-oss-120b/ doesn't document this type either.

Cherry avatar Sep 14 '25 15:09 Cherry

It seems like an update here landed as per https://github.com/cloudflare/workerd/pull/5111, but as per my comment at https://github.com/cloudflare/workerd/pull/5111#issuecomment-3304247714, the output types for these models are not quite accurate and now throw errors like this:

const response = await context.env.AI.run('@cf/openai/gpt-oss-120b', {
	instructions: 'some prompt',
	input: 'some input',
	max_tokens: 10240,
});

const results = response?.output?.find?.(item => item.type === 'message');
Property 'output' does not exist on type 'Ai_Cf_Openai_Gpt_Oss_120B_Output'.
  Property 'output' does not exist on type '{}'.

cc @thatsKevinJain

Cherry avatar Sep 19 '25 18:09 Cherry

Hello, I am hitting this issue as well when trying to use the model. Is there any workaround till the issue is fixed?

raress96 avatar Oct 16 '25 19:10 raress96

any update?

robzlabz avatar Dec 14 '25 04:12 robzlabz

Hey @robzlabz the types package has been updated for the gpt-oss models: https://github.com/cloudflare/workerd/pull/5434

You can update the "@cloudflare/workers-types" to the latest version.

thatsKevinJain avatar Dec 14 '25 04:12 thatsKevinJain