Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Togethercomputer Together python Models Resource

From Leeroopedia
Knowledge Sources
Domains Model_Management, API
Last Updated 2026-02-15 16:00 GMT

Overview

Concrete tool for listing available models and uploading custom models to the Together AI platform provided by the Together Python SDK.

Description

The Models class provides list() (with optional dedicated-only filter) and upload() methods. Listing returns all available models sorted alphabetically with metadata including type, pricing, context length, and organization. Upload supports custom models and adapters from Hugging Face repos or S3 paths.

Usage

Import this class when you need to discover available models or upload custom models/adapters. Access via client.models.

Code Reference

Source Location

Signature

class Models(ModelsBase):
    def list(self, dedicated: bool = False) -> List[ModelObject]: ...

    def upload(
        self,
        *,
        model_name: str,
        model_source: str,
        model_type: str = "model",
        hf_token: str | None = None,
        description: str | None = None,
        base_model: str | None = None,
        lora_model: str | None = None,
    ) -> ModelUploadResponse: ...

Import

from together import Together

client = Together()
# Access via client.models

I/O Contract

Inputs

Name Type Required Description
dedicated bool No If True, return only dedicated-deployable models (default: False)
model_name str Yes (upload) Name for the uploaded model
model_source str Yes (upload) HuggingFace repo or S3 path
model_type str No "model" or "adapter" (default: "model")
hf_token str No HuggingFace access token
base_model str No Base model for adapter type

Outputs

Name Type Description
list() returns List[ModelObject] Sorted list of models with id, type, pricing, context_length
upload() returns ModelUploadResponse Upload job info: job_id, model_name, model_id, message

Usage Examples

from together import Together

client = Together()

# List all models
models = client.models.list()
for model in models:
    print(f"{model.id}: {model.type} (ctx: {model.context_length})")

# List only dedicated-deployable models
dedicated = client.models.list(dedicated=True)

# Upload a custom model from HuggingFace
response = client.models.upload(
    model_name="my-org/my-custom-model",
    model_source="huggingface/my-model-repo",
    model_type="model",
    hf_token="hf_...",
    description="My fine-tuned model",
)
print(f"Upload job: {response.job_id}")

# Upload a LoRA adapter
response = client.models.upload(
    model_name="my-org/my-adapter",
    model_source="huggingface/my-adapter-repo",
    model_type="adapter",
    base_model="meta-llama/Llama-4-Scout-17B-16E-Instruct",
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment