OpenRouter::Model
Inherits JSON::Serializable < Struct < Value < Object
Represents a language model retrieved from the OpenRouter API via the /models endpoint
Constructors
new(pull : JSON::PullParser)
Sourcenew(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
}
}
new(*, __pull_for_json_serializable pull : JSON::PullParser)
SourceInstance methods
architecture_instruct_type
Sourcearchitecture_modality
Sourcearchitecture_tokenizer
Sourcecontext_length
Sourcecreated
Sourcedescription
Sourceid
Sourcename
Sourceper_request_limits_completion_tokens
Sourceper_request_limits_prompt_tokens
Sourcepricing_completion
Sourcepricing_image
Sourcepricing_input_cache_read
Sourcepricing_input_cache_write
Sourcepricing_internal_reasoning
Sourcepricing_prompt
Sourcepricing_request
Sourcepricing_web_search
Sourceto_s
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.
top_provider_context_length
Sourcetop_provider_is_moderated
Sourcetop_provider_max_completion_tokens
Source