Skip to main content

New API Version

Get Model Information

Endpoint: GET https://aihubmix.com/api/v1/models Description: Fetches detailed information for all available models.

Model Object Field Descriptions

data
array
An array of model information objects.
model_id
string
The unique identifier for the model.
desc
string
A description of the model’s functionality (in English).
types
string
Model type. Supported values: llm (Large Language Model), image_generation, video, tts (Text-to-Speech), stt (Speech-to-Text), embedding, rerank.
features
string
Supported features. Supported values: thinking (reasoning), tools (tool use), function_calling, web (web search), deepsearch, long_context, structured_outputs.
input_modalities
string
Supported input modalities. Supported values: text, image, audio, video, pdf.
max_output
string
Maximum number of output tokens.
context_length
string
Context window size (maximum number of input tokens).
pricing
object
Pricing information object.
pricing.input
number
Input token price (per 1K tokens, in USD).
pricing.output
number
Output token price (per 1K tokens, in USD).
pricing.cache_read
number
Cache read price (per 1K tokens, in USD, optional field).
pricing.cache_write
number
Cache write price (per 1K tokens, in USD, optional field).

Request Examples

import requests

# API Endpoint
url = "https://aihubmix.com/api/v1/models"

response = requests.get(url)
print(response.json())

# Example with parameters
params = {
    "type": "llm",                   
	"modalities": "text",
	"model": "gpt-5",
	"features": "thinking",
    "sort_by": "context_length",
    "sort_order": "desc"    
}
response = requests.get(url, params=params)
print(response.json())

Request Parameter Descriptions (for Filtering)

type
string
Model type. Supported values: llm (Large Language Model), image_generation, video, tts (Text-to-Speech), stt (Speech-to-Text), embedding, rerank.
modalities
string
Input modalities. Supported values: text, image, audio, video, pdf. Supports multi-modality queries (comma-separated).
model
string
Fuzzy search for model name (supports partial matching).
features
string
Model features. Supported values: thinking (reasoning), tools (tool use), function_calling, web (web search), deepsearch, long_context, structured_outputs. Supports multi-feature queries (comma-separated).
sort_by
string
Sort by field. Supported values:
  • model_ratio: Sort by cost-effectiveness.
  • context_length: Sort by context length.
  • coding: Prioritize coding models.
  • order: Sort by default order.
sort_order
string
Sort order. Supported values:
  • asc (ascending)
  • desc (descending)

Successful Response Example

{
    "data": [
        {
            "model_id": "gpt-5",
            "desc": "GPT-5 is OpenAI's flagship model for coding, reasoning, and agentic tasks across domains.",
            "pricing": {
                "cache_read": 0.125,
                "input": 1.25,
                "output": 10
            },
            "types": "llm",
            "features": "thinking,tools,function_calling,structured_outputs",
            "input_modalities": "text,image",
            "max_output": 128000,
            "context_length": 400000
        },
        {
            "model_id": "gpt-5-codex",
            "desc": "GPT-5-Codex is a version of GPT-5 optimized for autonomous coding tasks in Codex or similar environments. It is only available in the Responses API, and the underlying model snapshots will be updated regularly. https://docs.aihubmix.com/en/api/Responses-API You can also use it in codex-cll; see https://docs.aihubmix.com/en/api/Codex-CLI for using codex-cll through Aihubmix.",
            "pricing": {
                "cache_read": 0.125,
                "input": 1.25,
                "output": 10
            },
            "types": "llm",
            "features": "thinking,tools,function_calling,structured_outputs",
            "input_modalities": "text,image",
            "max_output": 128000,
            "context_length": 400000
        }
    ],
    "message": "",
    "success": true
}

Usage Scenario Examples

GET https://aihubmix.com/api/v1/models?type=llm
Note: When using smart sort for coding models, the system will prioritize models tagged with coding, and other models will be listed in the default order.

Performance Optimization

Caching Mechanism

  • Cache Policy: HTTP caching, cache duration 300 seconds (5 minutes).
  • Cache Control: Cache-Control: public, max-age=300, stale-while-revalidate=300
  • Content Validation: Supports ETag content hash validation.

Cache Usage Example

# Conditional request using ETag
curl -H "If-None-Match: \"abc123...\"" \
     https://aihubmix.com/api/v1/models
If the content has not been updated, the server returns a 304 Not Modified status code.

Error Handling

{
  "success": false,
  "message": "Invalid request parameter format"
}

Important Notes

  1. Data Integrity: This endpoint returns all models that meet the criteria, without pagination.
  2. Type Compatibility: Supports automatic mapping between new and old type identifiers:
    • t2tllm
    • t2iimage_generation
    • t2vvideo
    • rerankingrerank
  3. Filtering Logic: Multiple filter conditions are combined with a logical AND.
  4. Sorting Rule: When no sorting method is specified, models are arranged in the system’s default order.

Legacy API Version

⚠️ Note: The following are legacy API endpoints. It is recommended to use the new API version for better performance and features.

Get Model List

Endpoint: GET /v1/models
  • If a user is logged in, it retrieves the list of available models for the user’s group. If no user is logged in, it retrieves the list for the default group.
  • If the header contains an Authorization field, it queries the list of models configured for the corresponding token.
Response Example:
{
  "data": [
    {
      "id": "gpt-4o-mini",
      "object": "model",
      "created": 1626777600,
      "owned_by": "OpenAI",
      "permission": [
        {
          "id": "modelperm-LwHkVFn8AcMItP432fKKDIKJ",
          "object": "model_permission",
          "created": 1626777600,
          "allow_create_engine": true,
          "allow_sampling": true,
          "allow_logprobs": true,
          "allow_search_indices": false,
          "allow_view": true,
          "allow_fine_tuning": false,
          "organization": "*",
          "group": null,
          "is_blocking": false
        }
      ],
      "root": "gpt-4o-mini",
      "parent": null
    }
  ]
}

Response

Status CodeMeaningDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200
NameTypeRequiredDescription
» data[object]truenone
»» idstringtrueModel ID
»» objectstringtruemodel
»» createdintegertrueTimestamp of creation
»» owned_bystringtrueDeveloper
»» permission[object]¦nulltruenone
»»» idstringtruenone
»»» objectstringtruenone
»»» createdintegertruenone
»»» allow_create_enginebooleantruenone
»»» allow_samplingbooleantruenone
»»» allow_logprobsbooleantruenone
»»» allow_search_indicesbooleantruenone
»»» allow_viewbooleantruenone
»»» allow_fine_tuningbooleantruenone
»»» organizationstringtruenone
»»» groupnulltruenone
»»» is_blockingbooleantruenone
»» rootstringtrueRoot model name
»» parentnulltrueParent model

Get Model Information

Endpoint: GET /v1/models/:model

Request Parameters

NameInTypeRequiredDescription
modelpathstringtrueModel ID
Response Example:
200 Response
{
  "id": "string",
  "object": "string",
  "created": 0,
  "owned_by": "string",
  "permission": [
    {
      "id": "string",
      "object": "string",
      "created": 0,
      "allow_create_engine": true,
      "allow_sampling": true,
      "allow_logprobs": true,
      "allow_search_indices": true,
      "allow_view": true,
      "allow_fine_tuning": true,
      "organization": "string",
      "group": null,
      "is_blocking": true
    }
  ],
  "root": "string",
  "parent": null
}

Response

Status CodeMeaningDescriptionData Model
200OKnoneInline

Response Data Structure

Status Code 200
NameTypeRequiredDescription
idstringtrueModel ID
objectstringtruemodel
createdintegertrueTimestamp of creation
owned_bystringtrueDeveloper
permission[object]truenone
» idstringfalsenone
» objectstringfalsenone
» createdintegerfalsenone
» allow_create_enginebooleanfalsenone
» allow_samplingbooleanfalsenone
» allow_logprobsbooleanfalsenone
» allow_search_indicesbooleanfalsenone
» allow_viewbooleanfalsenone
» allow_fine_tuningbooleanfalsenone
» organizationstringfalsenone
» groupnullfalsenone
» is_blockingbooleanfalsenone
rootstringtrueRoot model name
parentnulltrueParent model