docs
Models
List All Models

List All Models

MakeHub provides access to a variety of AI models from different providers. This page explains how to retrieve information about the available models and how to interpret the response data.

Listing Available Models

You can retrieve a list of all available models through the /v1/models endpoint:

GET https://api.makehub.ai/v1/models

This endpoint requires authentication with your MakeHub API key.

Python Example

import requests
 
API_BASE_URL = "https://api.makehub.ai"
API_KEY = "your_makehub_api_key"
 
def list_models():
    headers = {
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json"
    }
    
    response = requests.get(f"{API_BASE_URL}/v1/models", headers=headers)
    
    if response.status_code == 200:
        return response.json()
    else:
        return {"error": response.text}
 
models = list_models()
print(models)

TypeScript Example

import axios from 'axios';
 
async function listModels() {
  try {
    const response = await axios.get('https://api.makehub.ai/v1/models', {
      headers: {
        'Authorization': `Bearer your_makehub_api_key`,
        'Content-Type': 'application/json'
      }
    });
    
    return response.data;
  } catch (error) {
    console.error('Error fetching models:', error);
    return { error: error.message };
  }
}
 
// Example usage
listModels().then(data => console.log(data));

cURL Example

curl "https://api.makehub.ai/v1/models" \
  -H "Authorization: Bearer your_makehub_api_key" \
  -H "Content-Type: application/json"

Response Format

The response contains an array of model objects under the data key. Each model object includes the following properties:

PropertyTypeDescription
model_idstringUnique identifier for the model (in the format organisation/model_name)
model_namestringName of the model
organisationstringOrganisation that created the model
provider_namestringService provider hosting the model
contextintegerMaximum context length in thousands of tokens
price_per_input_tokennumberCost per input token in cents/1M tokens
price_per_output_tokennumberCost per output token in cents/1M tokens
quantisationstring or nullQuantisation level, if applicable
native_support_function_callingbooleanWhether the model natively supports function calling
native_support_tools_callingbooleanWhether the model natively supports tools calling

Sample Response

{
  "data": [
    {
      "context": 200,
      "model_id": "anthropic/claude-3-5-haiku",
      "model_name": "claude-3-5-haiku",
      "organisation": "anthropic",
      "price_per_input_token": 0.8,
      "price_per_output_token": 4,
      "provider_name": "anthropic",
      "quantisation": null,
      "native_support_function_calling": true,
      "native_support_tools_calling": true
    },
    {
      "context": 200,
      "model_id": "anthropic/claude-3-5-sonnet",
      "model_name": "claude-3-5-sonnet",
      "organisation": "anthropic",
      "price_per_input_token": 3,
      "price_per_output_token": 15,
      "provider_name": "anthropic",
      "quantisation": null,
      "native_support_function_calling": true,
      "native_support_tools_calling": true
    },
    {
      "context": 131,
      "model_id": "openai/gpt-4o",
      "model_name": "gpt-4o",
      "organisation": "openai",
      "price_per_input_token": 2.5,
      "price_per_output_token": 10,
      "provider_name": "azure-UKSouth",
      "quantisation": null,
      "native_support_function_calling": true,
      "native_support_tools_calling": true
    }
    // Additional models omitted for brevity
  ]
}

Finding the Most Cost-Effective Model

def find_cheapest_model_for_task(min_context_size=32, require_function_calling=False):
    models_data = list_models()
    
    # Filter models based on requirements
    eligible_models = [
        model for model in models_data["data"] 
        if model.get("context", 0) >= min_context_size and
        (not require_function_calling or model.get("native_support_function_calling", False))
    ]
    
    # Sort by output token price (most common cost driver)
    eligible_models.sort(key=lambda x: x.get("price_per_output_token", float('inf')))
    
    return eligible_models[0] if eligible_models else None