List custom models

Retrieve all models accessible to your organization, including both global models (shared across all organizations) and your custom models. ## Query parameters - `sort_by` *string*: Field to sort by. **Example** ``` ?sort_by=model_name ``` - `all` *boolean*: If `true`, returns all models without pagination. ## Response Returns an array of model objects with their configurations and associated providers. **Model types:** - **Global models** (`affiliation_category: "respan"`): Shared across all organizations - **Custom models** (`affiliation_category: "custom"`): Organization-specific models ```json 200 OK [ { "id": "my-custom-gpt-4", "model_name": "my-custom-gpt-4", "display_name": "My Custom GPT-4", "base_model_name": "gpt-4", "affiliation_category": "custom", "is_called_by_custom_name": false, "input_cost": 0.03, "output_cost": 0.06, "cache_hit_input_cost": 0.0, "cache_creation_input_cost": 0.0, "max_context_window": 8192, "streaming_support": 1, "function_call": 1, "image_support": 0, "source": "db", "provider": { "id": "my-custom-provider", "provider_id": "my-custom-provider", "provider_name": "My Custom Provider", "organization_id": 123 } }, { "id": "openai/gpt-4", "model_name": "openai/gpt-4", "display_name": "GPT-4", "affiliation_category": "respan", "input_cost": 0.03, "output_cost": 0.06, "max_context_window": 8192, "streaming_support": 1, "function_call": 1, "image_support": 0, "source": "hardcoded", "provider": null } ] ``` ```json 401 Unauthorized { "detail": "Authentication credentials were not provided." } ``` ```python Python url = "https://api.respan.ai/api/models/" headers = { "Authorization": "Bearer YOUR_API_KEY" } params = {"sort_by": "model_name"} response = requests.get(url, headers=headers, params=params) print(response.json()) ``` ```typescript TypeScript const url = 'https://api.respan.ai/api/models/?sort_by=model_name'; const headers = { 'Authorization': 'Bearer YOUR_API_KEY' }; const response = await fetch(url, { method: 'GET', headers: headers }); const data = await response.json(); console.log(data); ``` ```bash cURL curl "https://api.respan.ai/api/models/?sort_by=model_name" \ -H "Authorization: Bearer YOUR_API_KEY" ```

Authentication

AuthorizationBearer
API key authentication. Get your API key from https://platform.respan.ai/platform/api-keys

Query parameters

sort_bystringOptionalDefaults to model_name
Field to sort by.
allbooleanOptional
If true, returns all models without pagination.

Response

Successful response for List custom models

Errors

401
Unauthorized Error