Skip to content

Feature request: parameter max_output_tokens #1228

Closed

Description

@MatejRojec

Would it be possible to add a parameter to the Jina Reader API that allows limiting the output length (e.g., max_output_tokens). This would let users retrieve partial content, such as the first 5,000 tokens, without hitting the token budget errors or receiving full responses. It would improve efficiency for workflows that only need the initial portion of extracted text.

Activity

  1. AyusKumarPathak commented on Jan 4, 2026

    @AyusKumarPathak

    @MatejRojec @joshdevins @nomagick @hanxiao @crazyurus
    Hello maintainers 👋

    I want to implement support for the max_output_tokens parameter.
    Solution plan:

    1. Add the new parameter in the API schema.
    2. Pass it downstream to the LLM inference call.
    3. Update tests to verify output truncation behavior.
    4. Update README/examples with usage.

    Please assign this to me if that’s okay.

    — AyusKumarPathak

  2. nomagick commented on May 11, 2026

    @nomagick
    Member

    Solved. Now you can pass x-max-tokens: n where n needs to be > 500.

    'X-Max-Tokens': {
    description: 'Trim the response content at a maximum number of tokens.',
    in: 'header',
    schema: { type: 'string' }

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions