Skip to content

bug(openai): isReasoningModel detection incorrectly assumes unknown models support developer system message mode #10982

@umuoy1

Description

@umuoy1

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

Related

AI SDK Version

  • @ai-sdk/openai: 2.0.78

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions