For the complete documentation index, see llms.txt. This page is also available as Markdown.

Models and benchmarks

client.models and client.benchmarks — manage models, benchmarks, custom registrations, smart benchmarks.

client.models

# List/filter
models = client.models.get(
 type="public", # public / custom
 name="gpt-4o",
 key="openai/gpt-4o",
 categories=["transformer"],
 companies=["OpenAI"],
 regions=["usa"],
 licenses=["mit"],
)
# models -> Optional[List[Model]]; each Model has.id,.name,.key,.description

# Direct lookups
model = client.models.get_by_id("model_abc")
model = client.models.get_by_key("openai/gpt-4o") # case-sensitive

# Project membership
client.models.add(model_id_1, model_id_2) # variadic
client.models.remove(model_id_1)

# Custom model — OpenAI-compatible endpoint
response = client.models.create_custom(
 name="My Fine-tuned Model",
 key="my-org/custom-model-v1", # lowercase alphanumeric with dots/hyphens/slashes
 description="Fine-tuned GPT for medical Q&A",
 api_url="https://my-api.example.com/v1",
 max_tokens=4096,
 api_key=os.environ.get("MY_PROVIDER_API_KEY"), # optional
)
print(f"Created model: {response.model_id}")

client.benchmarks

JSONL format for custom benchmarks

subset is optional, used for grouping results.

Async

See also

Last updated

Was this helpful?