Class Model
ScriptableObject representation of a generative AI model with metadata, configuration, and pricing information.
Supports token limits, ownership, creation time, and dynamic pricing for various content types (text, image, audio).
Assembly: .dll
Syntax
public class Model : ApiAsset
Properties
Family
The family classification of the model (e.g., GPT, Gemini, Imagen).
This information is usually used to determine the structure of the request body.
Declaration
public string Family { get; }
Property Value
Features
Features of the model, such as text generation, image generation, etc.
This information is used to determine the capabilities of the model.
Declaration
public ModelFeature Features { get; }
Property Value
A bitflag indicating supported input modalities (e.g., Text, Image, Audio).
This information is used to determines which input types the model supports.
Declaration
public Modality InputModality { get; }
Property Value
IsFineTuned
Indicates whether the model is a fine-tuned version (i.e., custom).
Declaration
public bool IsFineTuned { get; }
Property Value
IsLegacy
Indicates whether the model is a legacy version.
Legacy models often have a different endpoint or API structure.
Declaration
public bool IsLegacy { get; }
Property Value
The maximum number of input tokens allowed for this model.
Declaration
public int MaxInputTokens { get; }
Property Value
MaxN
The maximum number of images that this model can generate in a single request.
This information is only relevant for image generation models.
Declaration
Property Value
MaxOutputTokens
The maximum number of output tokens that the model can generate.
Declaration
public int MaxOutputTokens { get; }
Property Value
OutputModality
A bitflag indicating supported output modalities (e.g., Text, Image, Audio).
This information is used to determines which output types the model supports.
Declaration
public Modality OutputModality { get; }
Property Value
Prices
An array of pricing definitions for this model based on content type and usage (e.g., per 1K tokens).
Declaration
public ModelPrice[] Prices { get; }
Property Value
Version
The specific version identifier of the model.
Declaration
public string Version { get; }
Property Value
VersionNumber
The version identifier for the model's family or group (e.g., GPT-4, Gemini-1.5).
Declaration
public float VersionNumber { get; }
Property Value
Methods
EstimatePrice(Usage)
Estimates the price of using the model based on a usage report.
Automatically handles free usage and empty input.
Declaration
public Currency EstimatePrice(Usage usage)
Parameters
Type |
Name |
Description |
Usage |
usage |
The usage data containing token counts by type.
|
Returns
Type |
Description |
Currency |
A Glitch9.Currency object representing the estimated price.
|
HasFeature(ModelFeature)
Declaration
public bool HasFeature(ModelFeature feature)
Parameters
Returns
Operators
implicit operator Model(string)
Declaration
public static implicit operator Model(string apiName)
Parameters
Type |
Name |
Description |
string |
apiName |
|
Returns