{"record":{"id":"113ce832444cc898","repo":"BerriAI/litellm","slug":"ptu-effective-from-is-required-when-ptu-fields-are","errorCode":null,"errorMessage":"ptu_effective_from is required when PTU fields are set. Flat cost accrues from that instant, so without it the start would have to be inferred and a deployment configured today could be billed for days it did not exist","messagePattern":"ptu_effective_from is required when PTU fields are set\\. Flat cost accrues from that instant, so without it the start would have to be inferred and a deployment configured today could be billed for days it did not exist","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/model_management_endpoints.py","lineNumber":331,"sourceCode":"    Window ordering is checked before the count/rate gate. A patch that touches only one\n    end of the window carries no count or rate, and ModelInfo sees one field at a time, so\n    leaving it to either would let an inverted window reach the row; the next load then\n    fails to parse it and drops the deployment out of the router, where no further patch\n    can repair it because each one re-parses the stored value first.\n    \"\"\"\n    effective_from: Final = _coerce_ptu_datetime(model_info.get(\"ptu_effective_from\"))\n    effective_to: Final = _coerce_ptu_datetime(model_info.get(\"ptu_effective_to\"))\n    if effective_from is not None and effective_to is not None and effective_to <= effective_from:\n        raise HTTPException(status_code=400, detail=\"ptu_effective_to must be after ptu_effective_from\")\n\n    has_count: Final = model_info.get(\"ptu_count\") is not None\n    has_rate: Final = model_info.get(\"cost_per_ptu_per_hour\") is not None\n    if not has_count and not has_rate:\n        return\n    if has_count != has_rate:\n        raise HTTPException(status_code=400, detail=\"ptu_count and cost_per_ptu_per_hour must be set together\")\n    if effective_from is None:\n        raise HTTPException(\n            status_code=400,\n            detail=(\n                \"ptu_effective_from is required when PTU fields are set. Flat cost accrues from that \"\n                \"instant, so without it the start would have to be inferred and a deployment configured \"\n                \"today could be billed for days it did not exist\"\n            ),\n        )\n    if not model_info.get(\"team_id\"):\n        raise HTTPException(\n            status_code=400, detail=\"team_id is required when PTU fields are set (one model maps to one team)\"\n        )\n\n\n# The mirrored per-token pricing fields plus the three remaining fields\n# Router._inherit_builtin_cache_pricing back-fills from the public cost map. An unset field is\n# what that back-fill targets, so a field left out here is one a PTU deployment still bills.\n# tiered_pricing is the one mirrored field that is a table of ranges, not a rate, so it is stored\n# empty (see _PTU_EMPTIED_PRICING_FIELDS): its tiers outrank the zeros written beside them, so","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/model_management_endpoints.py#L313-L349","documentation":"Error \"ptu_effective_from is required when PTU fields are set. Flat cost accrues from that instant, so without it the start would have to be inferred and a deployment configured today could be billed for days it did not exist\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/model_management_endpoints.py:331 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide ptu_effective_from when setting PTU fields."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}