initial commit
This commit is contained in:
48
OpenRouter/ModelInfo.cs
Normal file
48
OpenRouter/ModelInfo.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace AnchorCli.OpenRouter;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the response from OpenRouter's /api/v1/models endpoint.
|
||||
/// </summary>
|
||||
internal sealed class ModelsResponse
|
||||
{
|
||||
[JsonPropertyName("data")]
|
||||
public List<ModelInfo> Data { get; set; } = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A single model entry from the OpenRouter API.
|
||||
/// </summary>
|
||||
internal sealed class ModelInfo
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; set; } = "";
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
[JsonPropertyName("pricing")]
|
||||
public ModelPricing? Pricing { get; set; }
|
||||
|
||||
[JsonPropertyName("context_length")]
|
||||
public int ContextLength { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pricing info for a model. All values are USD per token (as strings).
|
||||
/// </summary>
|
||||
internal sealed class ModelPricing
|
||||
{
|
||||
/// <summary>USD per input token.</summary>
|
||||
[JsonPropertyName("prompt")]
|
||||
public string Prompt { get; set; } = "0";
|
||||
|
||||
/// <summary>USD per output token.</summary>
|
||||
[JsonPropertyName("completion")]
|
||||
public string Completion { get; set; } = "0";
|
||||
|
||||
/// <summary>Fixed USD cost per API request.</summary>
|
||||
[JsonPropertyName("request")]
|
||||
public string Request { get; set; } = "0";
|
||||
}
|
||||
Reference in New Issue
Block a user