fix: recognize openrouter/free router as zero-cost
The free models router (openrouter/free) doesn't use the :free suffix, so it needs an explicit check alongside the suffix-based one. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -114,8 +114,8 @@ class PRAutoBlogger_OpenRouter_Pricing {
|
|||||||
* @return float Estimated cost in USD.
|
* @return float Estimated cost in USD.
|
||||||
*/
|
*/
|
||||||
public function estimate_cost( string $model, int $prompt_tokens, int $completion_tokens ): float {
|
public function estimate_cost( string $model, int $prompt_tokens, int $completion_tokens ): float {
|
||||||
// OpenRouter `:free` suffix models cost nothing.
|
// OpenRouter free models: the `openrouter/free` router and any `:free` suffix model.
|
||||||
if ( ':free' === substr( $model, -5 ) ) {
|
if ( 'openrouter/free' === $model || ':free' === substr( $model, -5 ) ) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user