vercel/ai · error · UnsupportedFunctionalityError

DeepSeek strict tool calls require a beta base URL ending in

Error message

DeepSeek strict tool calls require a beta base URL ending in `/beta`.

What it means

DeepSeek strict tool calls are a beta-only feature. prepareTools throws UnsupportedFunctionalityError when any function tool has strict: true but the provider was constructed without a /beta base URL (supportsStrictToolCalls === false).

Source

Thrown at packages/deepseek/src/chat/deepseek-prepare-tools.ts:37

}): {
  tools: undefined | Array<DeepSeekFunctionTool>;
  toolChoice: DeepSeekToolChoice;
  toolWarnings: SharedV4Warning[];
} {
  // when the tools array is empty, change it to undefined to prevent errors:
  tools = tools?.length ? tools : undefined;

  const toolWarnings: SharedV4Warning[] = [];

  if (tools == null) {
    return { tools: undefined, toolChoice: undefined, toolWarnings };
  }

  const functionTools = tools.filter(tool => tool.type === 'function');
  const hasStrictTool = functionTools.some(tool => tool.strict === true);

  if (hasStrictTool && supportsStrictToolCalls === false) {
    throw new UnsupportedFunctionalityError({
      functionality: 'DeepSeek strict tool calls',
      message:
        'DeepSeek strict tool calls require a beta base URL ending in `/beta`.',
    });
  }

  if (
    hasStrictTool &&
    supportsStrictToolCalls === true &&
    functionTools.some(tool => tool.strict !== true)
  ) {
    throw new UnsupportedFunctionalityError({
      functionality: 'mixed DeepSeek strict and non-strict tool calls',
      message:
        'DeepSeek strict mode requires every function tool in the request to set `strict: true`.',
    });
  }

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Create the DeepSeek provider with baseURL 'https://api.deepseek.com/beta'
  2. Or remove strict: true from the tools
  3. Or use the beta model variant factory if the provider exposes one

Example fix

// before
const deepseek = createDeepSeek({ apiKey });
const tools = { weather: tool({ inputSchema, execute, strict: true }) };
// after
const deepseek = createDeepSeek({ apiKey, baseURL: 'https://api.deepseek.com/beta' });
Defensive patterns

Strategy: validation

Validate before calling

const baseURL = process.env.DEEPSEEK_BASE_URL ?? 'https://api.deepseek.com';
function assertBetaForStrictTools(tools) {
  const anyStrict = Object.values(tools).some(t => t?.strict === true);
  if (anyStrict && !baseURL.endsWith('/beta')) {
    throw new Error('strict tool calls require a baseURL ending in /beta');
  }
}

Try / catch

try { ... } catch (e) { if (UnsupportedFunctionalityError.isInstance(e) && /strict tool calls/.test(e.message)) { /* switch endpoint or drop strict */ } throw e; }

Prevention

When it happens

Trigger: Passing a tool with strict: true (e.g. tool({ ..., strict: true }) or zod-as-function with strict) to generateText/streamText with a DeepSeek model created with a non-beta baseURL.

Common situations: Copying strict-mode examples while using the production endpoint; enabling strict: true globally via a helper after migrating from OpenAI where strict is GA.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/aa5eef6d87c767c4. Report an issue: GitHub.