← Back to PRs

#7987: feat: Support iflow/GLM-4.6 reasoning_content and tokens

by EisonMe open 2026-02-03 12:23 View on GitHub →
agents stale
This PR adds support for the non-standard 'reasoning_content' field used by iflow (Alibaba) API for GLM-4.6 models. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds helper types/functions to handle non-standard OpenAI-compatible responses that include iflow/GLM-4.6’s `reasoning_content` field, and extends usage normalization to capture reasoning token counts. It also updates provider classification to treat iflow as a “reasoning tag provider”. The main things to double-check are: (1) whether iflow should be forced into `<think>/<final>` tag mode now that native `reasoning_content` support is being introduced (these approaches can conflict), and (2) whether the new `reasoning` usage field is actually retained everywhere it should be (notably `hasNonzeroUsage()` currently ignores it). <h3>Confidence Score: 3/5</h3> - This PR is likely safe to merge, but a couple logic edges could lead to incorrect behavior for iflow reasoning handling and missing usage reporting. - Changes are small and localized, but `isReasoningTagProvider()` classifying iflow as tag-based may conflict with native `reasoning_content` support, and `hasNonzeroUsage()` not considering `reasoning` can suppress recording of reasoning-only usage. Additionally, the new mapping helpers are exported but currently unused in-repo, so the feature may be incomplete unless wired up elsewhere. - src/utils/provider-utils.ts; src/agents/usage.ts; src/agents/pi-embedded-helpers/openai.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs