-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Description
Background
In PR #9976 (fix(openai): treat unknown models as reasoning), the isReasoningModel function was introduced with a blocklist approach - treating all unknown models as reasoning models by default:
https://github.com/vercel/ai/blob/main/packages/openai/src/openai-is-reasoning-model.ts#L1-L8
export function isReasoningModel(modelId: string) {
if (modelId.startsWith('gpt-3')) return false;
if (modelId.startsWith('gpt-4')) return false;
if (modelId.startsWith('chatgpt-4o')) return false;
if (modelId.startsWith('gpt-5-chat')) return false;
return true;
}This logic was later consolidated into getOpenAILanguageModelCapabilities in commit 78f813e, which determines systemMessageMode:
const systemMessageMode = isReasoningModel ? 'developer' : 'system';Problem
The original intent of #9976 was likely to ensure new OpenAI reasoning models work correctly. However, the blocklist approach has an unintended side effect: any model not explicitly in the blocklist is treated as a reasoning model.
This breaks many legitimate use cases:
- Fine-tuned models
- Third-party OpenAI-compatible API models (e.g.,
[GLM-4.6](https://docs.z.ai/guides/llm/glm-4.6)) - Custom deployed models
These models do NOT support the developer system message role, causing API calls to fail.
Root Cause
The blocklist only covers official OpenAI base model prefixes (gpt-3, gpt-4, chatgpt-4o, gpt-5-chat), but fine-tuned models have prefixes like ft:gpt-4o-... which don't match any blocklist entry, so they incorrectly return isReasoningModel = true.
Environment
@ai-sdk/openaiversion: latest (after PR fix(openai): treat unknown models as reasoning #9976)- Model causing issue: Third-party OpenAI-compatible API model
- Node.js Version: v22.17.1
Related
- PR that introduced the blocklist logic: fix(openai): treat unknown models as reasoning #9976
- Commit that consolidated the logic: 78f813e
AI SDK Version
- @ai-sdk/openai: 2.0.78
Code of Conduct
- I agree to follow this project's Code of Conduct