From 8f2e1483f6a3c3354b56fd5936488173dca625ae Mon Sep 17 00:00:00 2001
From: Jicheng Lu <103353@smsassist.com>
Date: Fri, 24 Jul 2026 11:50:05 -0500
Subject: [PATCH] relocate llm cost setting
---
.../MLTasks/Settings/LlmCostSetting.cs | 64 +++++++++++++++++++
.../MLTasks/Settings/LlmModelSetting.cs | 64 -------------------
2 files changed, 64 insertions(+), 64 deletions(-)
create mode 100644 src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmCostSetting.cs
diff --git a/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmCostSetting.cs b/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmCostSetting.cs
new file mode 100644
index 000000000..825b20906
--- /dev/null
+++ b/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmCostSetting.cs
@@ -0,0 +1,64 @@
+namespace BotSharp.Abstraction.MLTasks.Settings;
+
+///
+/// Cost per 1K tokens
+///
+public class LlmCostSetting
+{
+ #region Text token
+ public float TextInputCost { get; set; } = 0f;
+ public float CachedTextInputCost { get; set; } = 0f;
+ public float CachedTextInputWriteCost { get; set; } = 0f;
+ public float TextOutputCost { get; set; } = 0f;
+ public string DefaultServiceTier { get; set; } = "standard";
+ public IList? TextTokenCostTiers { get; set; }
+ #endregion
+
+ #region Audio token
+ public float AudioInputCost { get; set; } = 0f;
+ public float CachedAudioInputCost { get; set; } = 0f;
+ public float AudioOutputCost { get; set; } = 0f;
+ #endregion
+
+ #region Image token
+ public float ImageInputCost { get; set; } = 0f;
+ public float CachedImageInputCost { get; set; } = 0f;
+ public float ImageOutputCost { get; set; } = 0f;
+ #endregion
+
+ #region Image
+ public IList? ImageCosts { get; set; }
+ #endregion
+
+ public LlmTextTokenCostTier? GetTextTokenCostTier(long inputTokens, string? serviceTier = null)
+ {
+ var selectedServiceTier = string.IsNullOrWhiteSpace(serviceTier)
+ ? DefaultServiceTier
+ : serviceTier;
+
+ return TextTokenCostTiers?.FirstOrDefault(x =>
+ string.Equals(x.ServiceTier, selectedServiceTier, StringComparison.OrdinalIgnoreCase)
+ && (!x.InputTokensGreaterThan.HasValue || inputTokens > x.InputTokensGreaterThan.Value)
+ && (!x.InputTokensLessThanOrEqual.HasValue || inputTokens <= x.InputTokensLessThanOrEqual.Value));
+ }
+}
+
+public class LlmTextTokenCostTier
+{
+ public string ServiceTier { get; set; } = "standard";
+ public long? InputTokensGreaterThan { get; set; }
+ public long? InputTokensLessThanOrEqual { get; set; }
+ public float TextInputCost { get; set; }
+ public float CachedTextInputCost { get; set; }
+ public float CachedTextInputWriteCost { get; set; }
+ public float TextOutputCost { get; set; }
+}
+
+public class LlmImageCost
+{
+ ///
+ /// Attributes: e.g., [quality]: "medium", [size] = "1024x1024"
+ ///
+ public Dictionary Attributes { get; set; } = [];
+ public float Cost { get; set; } = 0f;
+}
\ No newline at end of file
diff --git a/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs b/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs
index c843c0395..815b3b44a 100644
--- a/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs
@@ -176,70 +176,6 @@ public class ModelParamSetting
public IEnumerable? Options { get; set; }
}
-
-///
-/// Cost per 1K tokens
-///
-public class LlmCostSetting
-{
- #region Text token
- public float TextInputCost { get; set; } = 0f;
- public float CachedTextInputCost { get; set; } = 0f;
- public float CachedTextInputWriteCost { get; set; } = 0f;
- public float TextOutputCost { get; set; } = 0f;
- public string DefaultServiceTier { get; set; } = "standard";
- public IList? TextTokenCostTiers { get; set; }
- #endregion
-
- #region Audio token
- public float AudioInputCost { get; set; } = 0f;
- public float CachedAudioInputCost { get; set; } = 0f;
- public float AudioOutputCost { get; set; } = 0f;
- #endregion
-
- #region Image token
- public float ImageInputCost { get; set; } = 0f;
- public float CachedImageInputCost { get; set; } = 0f;
- public float ImageOutputCost { get; set; } = 0f;
- #endregion
-
- #region Image
- public IList? ImageCosts { get; set; }
- #endregion
-
- public LlmTextTokenCostTier? GetTextTokenCostTier(long inputTokens, string? serviceTier = null)
- {
- var selectedServiceTier = string.IsNullOrWhiteSpace(serviceTier)
- ? DefaultServiceTier
- : serviceTier;
-
- return TextTokenCostTiers?.FirstOrDefault(x =>
- string.Equals(x.ServiceTier, selectedServiceTier, StringComparison.OrdinalIgnoreCase)
- && (!x.InputTokensGreaterThan.HasValue || inputTokens > x.InputTokensGreaterThan.Value)
- && (!x.InputTokensLessThanOrEqual.HasValue || inputTokens <= x.InputTokensLessThanOrEqual.Value));
- }
-}
-
-public class LlmTextTokenCostTier
-{
- public string ServiceTier { get; set; } = "standard";
- public long? InputTokensGreaterThan { get; set; }
- public long? InputTokensLessThanOrEqual { get; set; }
- public float TextInputCost { get; set; }
- public float CachedTextInputCost { get; set; }
- public float CachedTextInputWriteCost { get; set; }
- public float TextOutputCost { get; set; }
-}
-
-public class LlmImageCost
-{
- ///
- /// Attributes: e.g., [quality]: "medium", [size] = "1024x1024"
- ///
- public Dictionary Attributes { get; set; } = [];
- public float Cost { get; set; } = 0f;
-}
-
public enum LlmModelType
{
All = 0,