Skip to content

fix(opencode): account for Pollinations token pricing categories - #865

Open
mdev34-lab wants to merge 1 commit into
dev-vibecodedfrom
pollinations-token-pricing
Open

mdev34-lab wants to merge 1 commit into
dev-vibecodedfrom
pollinations-token-pricing

Conversation

@mdev34-lab

Copy link
Copy Markdown
Owner

Fixes #863

Changes

  • Derive the flat input rate from the highest token-denominated prompt*Tokens price, excluding the separately mapped cache fields.
  • Derive the flat output rate from the highest token-denominated completion*Tokens price, including reasoning-token rates.
  • Preserve cached-read and cache-write rates separately.
  • Respect pricing_units: custom units such as megapixels are not treated as per-token rates.

Deliberate limitation

SilverCode's shared Model.cost type is limited to one input, output, and two cache rates. This change avoids using a lower text-only rate when another token category costs more, but it cannot represent separately billed non-token units or per-request pricing_adjustments. The remaining approximation is documented beside the adapter implementation; it is not a complete reconstruction of Pollinations' final invoice.

Verification

  • Added regression coverage for a higher image-input rate, a higher reasoning-output rate, and a non-token pricing_units entry.
  • Automated GitHub Actions checks will run for this PR; tests have not been run locally in this session.

@github-actions

Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@kilo-code-bot

kilo-code-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/opencode/src/provider/pollinations.ts
  • packages/opencode/test/provider/pollinations.test.ts

Reviewed by free · Input: 60.4K · Output: 2.6K · Cached: 193K

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant