1
0

initial commit

This commit is contained in:
2026-03-04 07:59:35 +01:00
commit 3ceb0e4884
27 changed files with 2280 additions and 0 deletions

48
OpenRouter/ModelInfo.cs Normal file
View 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";
}