Implementation:Cohere ai Cohere python GetModelResponse Model
| Knowledge Sources | |
|---|---|
| Domains | SDK, Models |
| Last Updated | 2026-02-15 14:00 GMT |
Overview
GetModelResponse is a Pydantic model that contains metadata about a Cohere model, including its name, supported endpoints, context length, and fine-tuning status.
Description
The GetModelResponse class represents the response returned when querying information about a specific Cohere model. It extends UncheckedBaseModel and provides fields describing the model's capabilities and configuration, such as which API endpoints it is compatible with (chat, embed, classify, summarize, rerank, rate, generate), whether it has been fine-tuned, the maximum context length, a public URL to the tokenizer configuration, default endpoints, and supported features. All fields are optional and default to None.
Usage
Use GetModelResponse when you need to inspect model metadata returned by the Cohere Models API. This is useful for programmatically determining model capabilities, checking deprecation status, or selecting models based on context length and endpoint compatibility.
Code Reference
Source Location
- Repository: Cohere Python SDK
- File:
src/cohere/types/get_model_response.py
Signature
class GetModelResponse(UncheckedBaseModel):
name: typing.Optional[str] = pydantic.Field(default=None)
is_deprecated: typing.Optional[bool] = pydantic.Field(default=None)
endpoints: typing.Optional[typing.List[CompatibleEndpoint]] = pydantic.Field(default=None)
finetuned: typing.Optional[bool] = pydantic.Field(default=None)
context_length: typing.Optional[float] = pydantic.Field(default=None)
tokenizer_url: typing.Optional[str] = pydantic.Field(default=None)
default_endpoints: typing.Optional[typing.List[CompatibleEndpoint]] = pydantic.Field(default=None)
features: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
Import
from cohere.types import GetModelResponse
I/O Contract
Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
name |
Optional[str] |
No | None |
The model name to specify in the model parameter of API requests.
|
is_deprecated |
Optional[bool] |
No | None |
Whether the model is deprecated. |
endpoints |
Optional[List[CompatibleEndpoint]] |
No | None |
The API endpoints that the model is compatible with (e.g., chat, embed, classify, summarize, rerank, rate, generate). |
finetuned |
Optional[bool] |
No | None |
Whether the model has been fine-tuned. |
context_length |
Optional[float] |
No | None |
The maximum number of tokens the model can process in a single request. |
tokenizer_url |
Optional[str] |
No | None |
Public URL to the tokenizer's configuration file. |
default_endpoints |
Optional[List[CompatibleEndpoint]] |
No | None |
The API endpoints that the model is the default for. |
features |
Optional[List[str]] |
No | None |
The features that the model supports. |
Usage Examples
import cohere
client = cohere.Client(api_key="YOUR_API_KEY")
# Retrieve model information
model_info = client.models.get("command-r-plus")
# Access model metadata
print(f"Model name: {model_info.name}")
print(f"Context length: {model_info.context_length}")
print(f"Fine-tuned: {model_info.finetuned}")
print(f"Deprecated: {model_info.is_deprecated}")
# Check compatible endpoints
if model_info.endpoints:
for endpoint in model_info.endpoints:
print(f"Compatible endpoint: {endpoint}")
# Check default endpoints
if model_info.default_endpoints:
for endpoint in model_info.default_endpoints:
print(f"Default for endpoint: {endpoint}")
# Access tokenizer URL
if model_info.tokenizer_url:
print(f"Tokenizer config: {model_info.tokenizer_url}")