#Worker ai Response is Not Fully OpenAi Compatible.

1 messages · Page 1 of 1 (latest)

mellow juniper
#

Payload

json { "model": "@cf/qwen/qwen3-30b-a3b-fp8", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "how to build a wooden spoon in 3 short steps?" }, { "type": "text", "text": "give as short as answer as possible" } ] } ], "stream": false }

#

As Open ai Client Append /chat/completions automatically

#

The API you're hitting expects content to be a string, but OpenAILLMService sending it as an array (the OpenAI multi-part content format).

This typically happens when you use OpenAILLMService with a non-OpenAI provider (e.g., Cloudflare AI Gateway, a custom proxy, or another OpenAI-compatible API) that doesn't fully support the OpenAI message format — specifically, it doesn't support array-type content fields.

Type mismatch of '/messages/0/content', 'array' not in 'string'

Every message in your context has content as an array (e.g., [{"type": "text", "text": "..."}]) but the endpoint expects a plain string ("...").

mellow juniper
eternal fulcrum
#

Check the input schema for this specific model. Not all the models provided by cloudflare ai workers comes with openai-api support

mellow juniper
eternal fulcrum
#

You've to check the model's output format in the cloudflare documentation. Or use the AI Sdk.

mellow juniper