feat: Introduce a pluggable LLM provider system with token extraction, pricing, and updated setup configuration.
This commit is contained in:
25
Providers/ITokenExtractor.cs
Normal file
25
Providers/ITokenExtractor.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace AnchorCli.Providers;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for extracting token usage from provider responses.
|
||||
/// </summary>
|
||||
internal interface ITokenExtractor
|
||||
{
|
||||
/// <summary>
|
||||
/// Extracts token usage from response headers and/or body.
|
||||
/// Returns (inputTokens, outputTokens) or null if unavailable.
|
||||
/// </summary>
|
||||
(int inputTokens, int outputTokens)? ExtractTokens(HttpResponseHeaders headers, string? responseBody);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the latency from response headers (in ms).
|
||||
/// </summary>
|
||||
int? ExtractLatency(HttpResponseHeaders headers);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the provider name for display purposes.
|
||||
/// </summary>
|
||||
string ProviderName { get; }
|
||||
}
|
||||
Reference in New Issue
Block a user