Skip to content

Conversation

@sebastiand-cerebras
Copy link
Contributor

Summary

This PR fixes the conservative max tokens calculation for Cerebras models.

Changes

  • Updated the max tokens calculation to use a more conservative approach for Cerebras provider
  • Ensures better compatibility and prevents potential issues with token limits

Testing

  • Built and verified the extension compiles successfully
  • Type checking passes

@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2025

🦋 Changeset detected

Latest commit: 6fdd55c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@kiloconnect kiloconnect bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No Issues Found

2 files reviewed | Confidence: 95% | Recommendation: Merge

Review Details

Files: src/api/providers/cerebras.ts, .changeset/cerebras-conservative-max-tokens.md

Checked: Security, bugs, performance, error handling

Summary:

  • The conservative max_tokens approach (8K default) is well-justified given Cerebras's upfront quota reservation behavior
  • The Math.min(max_tokens || CEREBRAS_DEFAULT_MAX_TOKENS, CEREBRAS_DEFAULT_MAX_TOKENS) logic correctly caps tokens at 8K regardless of model's maxTokens setting
  • Integration header (X-Cerebras-3rd-Party-Integration: kilocode) added consistently to both createMessage and completePrompt methods
  • Constants are well-documented with clear rationale
  • No security concerns with the header addition

@kevinvandijk kevinvandijk self-requested a review December 9, 2025 13:36
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