Skip to content

docs: maxTokens is a model property, not a tool property - #1208

Closed
chiranjeet-vapi wants to merge 1 commit into
VapiAI:mainfrom
chiranjeet-vapi:fix/custom-tools-troubleshooting-maxtokens
Closed

docs: maxTokens is a model property, not a tool property#1208
chiranjeet-vapi wants to merge 1 commit into
VapiAI:mainfrom
chiranjeet-vapi:fix/custom-tools-troubleshooting-maxtokens

Conversation

@chiranjeet-vapi

Copy link
Copy Markdown
Contributor

Problem

fern/tools/custom-tools-troubleshooting.mdx tells readers to set maxTokens on a tool, in three code blocks and in the debugging table. A customer followed the "Increase token limits" section and got:

{"message":["assistant.model.each value in tools.function.property maxTokens should not exist"],"error":"Bad Request","statusCode":400}

maxTokens is not a tool field. Checked against https://api.vapi.ai/api-json on 2026-09-10:

OpenAIFunction properties          name, strict, description, parameters
OpenAIFunctionParameters           type, properties, required
JsonSchema properties              type, items, properties, description,
                                   pattern, format, required, enum, title

maxTokens is defined on the model schemas only (OpenAIModel, AnthropicModel, GoogleModel and the rest), with minimum: 50, maximum: 10000 and a documented default of 250. The page said the default was 100, which is not a value the API has anywhere.

What changed

All in fern/tools/custom-tools-troubleshooting.mdx. No other page in the repo places maxTokens outside model.

  1. Token truncation section now points at model.maxTokens, gives the real range and default, and carries a warning with the verbatim 400 so the error string is searchable.
  2. "maxTokens": 500 removed from the schema validation example and from the complete tool configuration template.
  3. Debugging table row now says model.maxTokens.
  4. Quick diagnosis card reworded to match.

Two further copy-paste failures in the same examples, same class of defect:

  1. The async and sync examples showed async as a sibling of name, which is the function object. async is a tool property; name is a function property. Both examples now show the real nesting.
  2. The complete tool configuration template had no type, no function wrapper and no server, so it was not a payload the API would accept. It now is.

Verification

Every claim above comes from https://api.vapi.ai/api-json fetched 2026-09-10. fern check validates the API definition and is unaffected by an mdx change.

🤖 Generated with Claude Code

The custom tools troubleshooting page told readers to set maxTokens on a
tool, in three code blocks and the debugging table. The API has no such
field: OpenAIFunction accepts only name, strict, description and
parameters, and JsonSchema (used for each property) accepts only type,
items, properties, description, pattern, format, required, enum and
title. Copying the example back returns 400 Bad Request with
"assistant.model.each value in tools.function.property maxTokens should
not exist".

maxTokens is defined on the model schemas only, with a range of 50 to
10000 and a default of 250, so the token truncation section now points
at model.maxTokens and states the real default. The page previously said
the default was 100, which is not a value in the API.

The same section fixes two other copy-paste failures on the page: async
is a tool property rather than a function property, and the complete
tool configuration template was missing the type, function and server
nesting, so it was not a payload the API would accept either.

Verified against https://api.vapi.ai/api-json on 2026-09-10.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lightsage-app

lightsage-app Bot commented Sep 10, 2026

Copy link
Copy Markdown

Lightsage docs evals

Waiting for the staging docs URL before running evals.

Lightsage will start the selected PR evals automatically when GitHub reports a successful docs deployment for this PR. This usually happens within 15 minutes.

Commit: 57af298
Status: waiting for staging docs URL

@chiranjeet-vapi

Copy link
Copy Markdown
Contributor Author

Closing in favour of #1209.

This PR reached beyond the reported issue and two of its claims were wrong. I tested them against POST https://api.vapi.ai/assistant afterwards:

  • async inside function is not rejected. The API accepts it. It is inert there, since async is read at tool level, but this PR described it as a validation failure and that is incorrect.
  • server is not required on a function tool. A correctly nested tool without one returns no server error, so listing it as part of what the template was missing was wrong.

The maxTokens finding holds and reproduces verbatim. #1209 carries only that, with the reproduction included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant