struct OpenRouter::Model
- OpenRouter::Model
- Struct
- Value
- Object
Overview
Represents a language model retrieved from the OpenRouter API via the /models
endpoint
Defined in:
openrouter/types/model.crConstructors
-
.new(json : JSON::Any)
Creates a new Model object from a JSON response from the OpenRouter API.
Instance Method Summary
- #architecture_instruct_type : String | Nil
- #architecture_modality : String
- #architecture_tokenizer : String
- #context_length : Int32
- #created : Int32
- #description : String
- #id : String
- #name : String
- #per_request_limits_completion_tokens : Int32?
- #per_request_limits_prompt_tokens : Int32?
- #pricing_completion : String
- #pricing_image : String
- #pricing_prompt : String
- #pricing_request : String
-
#to_s
Returns a nicely readable and concise string representation of this object, typically intended for users.
- #top_provider_context_length : Int32 | Nil
- #top_provider_is_moderated : Bool
- #top_provider_max_completion_tokens : Int32 | Nil
Constructor Detail
def self.new(json : JSON::Any)
#
Creates a new Model object from a JSON response from the OpenRouter API.
The JSON response from the OpenRouter API should be formatted as follows:
{
"id": "string",
"name": "string",
"created": 0,
"description": "string",
"pricing": {
"prompt": "string",
"completion": "string",
"request": "string",
"image": "string"
},
"context_length": 0,
"architecture": {
"tokenizer": "Router",
"instruct_type": "none",
"modality": "text->text"
},
"top_provider": {
"context_length": 0,
"max_completion_tokens": 0,
"is_moderated": true
},
"per_request_limits": {
"prompt_tokens": null,
"completion_tokens": null
}
}
Instance Method Detail
def to_s
#
Description copied from class Object
Returns a nicely readable and concise string representation of this object, typically intended for users.
This method should usually not be overridden. It delegates to
#to_s(IO)
which can be overridden for custom implementations.
Also see #inspect
.