Implementation:Togethercomputer Together python Endpoint Types
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Type_System |
| Last Updated | 2026-02-15 16:00 GMT |
Overview
Concrete type definitions for dedicated endpoint management provided by the Together Python SDK.
Description
This module defines the Pydantic models used for endpoint-related API requests and responses. Key types include DedicatedEndpoint (full endpoint details), ListEndpoint (summary for list queries), HardwareWithStatus (hardware config with availability), Autoscaling (scaling config), and the base TogetherJSONModel which provides JSON serialization with datetime handling.
Usage
Import these types when you need to type-hint endpoint-related data structures or inspect endpoint response objects returned by the Endpoints resource methods.
Code Reference
Source Location
- Repository: Together Python
- File: src/together/types/endpoints.py
- Lines: 1-123
Signature
class TogetherJSONModel(BaseModel): ...
class Autoscaling(TogetherJSONModel):
min_replicas: int
max_replicas: int
class HardwareWithStatus(TogetherJSONModel):
object: Literal["hardware"]
id: str
pricing: EndpointPricing
specs: HardwareSpec
availability: Optional[HardwareAvailability] = None
updated_at: datetime
class DedicatedEndpoint(BaseEndpoint):
id: str
type: Literal["dedicated"]
display_name: str
hardware: str
autoscaling: Autoscaling
class ListEndpoint(BaseEndpoint):
type: Literal["dedicated", "serverless"]
Import
from together.types.endpoints import DedicatedEndpoint, ListEndpoint, HardwareWithStatus
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (constructed from API response dicts) | Dict[str, Any] | Yes | API JSON response data parsed into typed models |
Outputs
| Name | Type | Description |
|---|---|---|
| DedicatedEndpoint | Pydantic Model | Full endpoint with id, model, hardware, autoscaling, state |
| ListEndpoint | Pydantic Model | Summary endpoint with id, model, type, owner, state |
| HardwareWithStatus | Pydantic Model | Hardware config with GPU specs, pricing, and availability |
| Autoscaling | Pydantic Model | min_replicas and max_replicas configuration |
Usage Examples
from together import Together
client = Together()
# DedicatedEndpoint is returned by create/get/update
endpoint = client.endpoints.create(
model="meta-llama/Llama-4-Scout-17B-16E-Instruct",
hardware="1x_nvidia_h100_80gb_sxm",
min_replicas=1,
max_replicas=3,
)
# Access typed fields
print(endpoint.autoscaling.min_replicas) # 1
print(endpoint.hardware) # "1x_nvidia_h100_80gb_sxm"
print(endpoint.state) # "STARTED"
# HardwareWithStatus from list_hardware
hw_list = client.endpoints.list_hardware()
for hw in hw_list:
print(f"{hw.specs.gpu_type}: {hw.specs.gpu_memory}GB x{hw.specs.gpu_count}")