mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-30 01:52:18 +00:00
feat(pricing): declare input_cost_per_reference_pixel across catalogs, schema and terraform
This commit is contained in:
parent
1ceae6fc43
commit
ef0a49971a
9 changed files with 27 additions and 2 deletions
|
|
@ -345,6 +345,8 @@ pub struct ModelInfo {
|
|||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub input_cost_per_pixel: Option<f64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub input_cost_per_reference_pixel: Option<f64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub input_cost_per_query: Option<f64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub input_cost_per_request: Option<f64>,
|
||||
|
|
|
|||
|
|
@ -10963,7 +10963,8 @@
|
|||
]
|
||||
},
|
||||
"azure_ai/FLUX.2-flex": {
|
||||
"input_cost_per_pixel": 5e-08,
|
||||
"input_cost_per_pixel": 4.76837158203125e-08,
|
||||
"input_cost_per_reference_pixel": 4.76837158203125e-08,
|
||||
"litellm_provider": "azure_ai",
|
||||
"max_input_tokens": 32000,
|
||||
"max_tokens": 32000,
|
||||
|
|
|
|||
|
|
@ -10963,7 +10963,8 @@
|
|||
]
|
||||
},
|
||||
"azure_ai/FLUX.2-flex": {
|
||||
"input_cost_per_pixel": 5e-08,
|
||||
"input_cost_per_pixel": 4.76837158203125e-08,
|
||||
"input_cost_per_reference_pixel": 4.76837158203125e-08,
|
||||
"litellm_provider": "azure_ai",
|
||||
"max_input_tokens": 32000,
|
||||
"max_tokens": 32000,
|
||||
|
|
|
|||
|
|
@ -314,6 +314,10 @@
|
|||
"type": "number",
|
||||
"minimum": 0
|
||||
},
|
||||
"input_cost_per_reference_pixel": {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
},
|
||||
"input_cost_per_query": {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
|
|
|
|||
|
|
@ -157,6 +157,8 @@ The following arguments are supported:
|
|||
|
||||
* `input_cost_per_pixel` - (Optional) float. Cost applied per input pixel for models that charge by image size.
|
||||
|
||||
* `input_cost_per_reference_pixel` - (Optional) float. Cost applied per reference image pixel for image edit models that meter reference inputs.
|
||||
|
||||
* `output_cost_per_pixel` - (Optional) float. Cost applied per output pixel for image-generation models.
|
||||
|
||||
* `input_cost_per_second` - (Optional) float. Cost applied per input second for audio/transcription models.
|
||||
|
|
|
|||
|
|
@ -119,6 +119,10 @@ func resourceLiteLLMModel() *schema.Resource {
|
|||
Type: schema.TypeFloat,
|
||||
Optional: true,
|
||||
},
|
||||
"input_cost_per_reference_pixel": {
|
||||
Type: schema.TypeFloat,
|
||||
Optional: true,
|
||||
},
|
||||
"output_cost_per_pixel": {
|
||||
Type: schema.TypeFloat,
|
||||
Optional: true,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/go-cty/cty"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
)
|
||||
|
||||
|
|
@ -124,6 +125,9 @@ func createOrUpdateModel(d *schema.ResourceData, m interface{}, isUpdate bool) e
|
|||
if inputCostPerPixel := d.Get("input_cost_per_pixel").(float64); inputCostPerPixel > 0 {
|
||||
litellmParams["input_cost_per_pixel"] = inputCostPerPixel
|
||||
}
|
||||
if raw, err := d.GetRawConfigAt(cty.GetAttrPath("input_cost_per_reference_pixel")); err == nil && !raw.IsNull() && raw.Type() == cty.Number {
|
||||
litellmParams["input_cost_per_reference_pixel"] = d.Get("input_cost_per_reference_pixel").(float64)
|
||||
}
|
||||
if outputCostPerPixel := d.Get("output_cost_per_pixel").(float64); outputCostPerPixel > 0 {
|
||||
litellmParams["output_cost_per_pixel"] = outputCostPerPixel
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ type LiteLLMParams struct {
|
|||
InputCostPerToken float64 `json:"input_cost_per_token,omitempty"`
|
||||
OutputCostPerToken float64 `json:"output_cost_per_token,omitempty"`
|
||||
InputCostPerPixel float64 `json:"input_cost_per_pixel,omitempty"`
|
||||
InputCostPerReferencePixel float64 `json:"input_cost_per_reference_pixel,omitempty"`
|
||||
OutputCostPerPixel float64 `json:"output_cost_per_pixel,omitempty"`
|
||||
InputCostPerSecond float64 `json:"input_cost_per_second,omitempty"`
|
||||
OutputCostPerSecond float64 `json:"output_cost_per_second,omitempty"`
|
||||
|
|
|
|||
6
ui/litellm-dashboard/src/lib/http/schema.d.ts
generated
vendored
6
ui/litellm-dashboard/src/lib/http/schema.d.ts
generated
vendored
|
|
@ -31409,6 +31409,8 @@ export interface components {
|
|||
input_cost_per_pixel?: number | null;
|
||||
/** Input Cost Per Query */
|
||||
input_cost_per_query?: number | null;
|
||||
/** Input Cost Per Reference Pixel */
|
||||
input_cost_per_reference_pixel?: number | null;
|
||||
/** Input Cost Per Second */
|
||||
input_cost_per_second?: number | null;
|
||||
/** Input Cost Per Token */
|
||||
|
|
@ -33948,6 +33950,8 @@ export interface components {
|
|||
health_status?: string | null;
|
||||
/** Input Cost Per Pixel */
|
||||
input_cost_per_pixel?: number | null;
|
||||
/** Input Cost Per Reference Pixel */
|
||||
input_cost_per_reference_pixel?: number | null;
|
||||
/** Input Cost Per Token */
|
||||
input_cost_per_token?: number | null;
|
||||
/**
|
||||
|
|
@ -42304,6 +42308,8 @@ export interface components {
|
|||
input_cost_per_pixel?: number | null;
|
||||
/** Input Cost Per Query */
|
||||
input_cost_per_query?: number | null;
|
||||
/** Input Cost Per Reference Pixel */
|
||||
input_cost_per_reference_pixel?: number | null;
|
||||
/** Input Cost Per Second */
|
||||
input_cost_per_second?: number | null;
|
||||
/** Input Cost Per Token */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue