Available Models
ProxAI provides functions to list and filter available models based on your configured API keys.
Examples
Simple Usage
import proxai as px
# List all available models
models = px.models.list_models()
for model in models:
print(model)(anthropic, claude-sonnet)
(openai, gpt-4)
(openai, gpt-4o)
(google, gemini-2.0-flash)
...Filter by Features
import proxai as px
# List models that support web search and pydantic response format
models = px.models.list_models(
features=['web_search', 'response_format::pydantic'])
for model in models:
print(model)(openai, gpt-4o)
(openai, gpt-4o-mini)
...Filter by Model Size
import proxai as px
# List only large models
models = px.models.list_models(model_size='large')
for model in models:
print(model)(anthropic, claude-sonnet)
(openai, gpt-4o)
(google, gemini-2.0-flash)
...Functions
There are two categories of functions for checking models:
List all configured models (based on API keys in environment):
px.models.list_models()px.models.list_providers()px.models.list_provider_models()px.models.get_model()
List verified working models (tested with actual API calls):
px.models.list_working_models()px.models.list_working_providers()px.models.list_working_provider_models()px.models.get_working_model()
px.models.list_models()
It is possible to list all available models as follows:
provider_models = px.models.list_models()
for provider_model in provider_models:
print(provider_model)(claude, haiku)
(claude, opus)
(claude, sonnet)
(gemini, gemini-2.0-flash)
(gemini, gemini-2.0-flash-lite)
(gemini, gemini-2.5-pro-preview-03-25)
(openai, chatgpt-4o-latest)
(openai, gpt-4.1)
...- Returns a list of
ProviderModelTypeobjects.
Parameters
| Option | Type | Default Value | Description |
|---|---|---|---|
model_size | str | None | One of |
features | List[str] | None | List of required features that models must support (e.g.,
|
call_type | CallType | GENERATE_TEXT | The type of API call to filter models for. |
px.models.list_providers()
Lists all providers that have API keys configured in environment variables.
providers = px.models.list_providers()
for provider in providers:
print(provider)anthropic
google
openai
...- Returns a sorted list of provider names (
List[str]).
Parameters
| Option | Type | Default Value | Description |
|---|---|---|---|
call_type | CallType | GENERATE_TEXT | The type of API call to filter providers for. |
px.models.list_provider_models()
Lists all models available from a specific provider.
provider_models = px.models.list_provider_models(provider='openai')
for provider_model in provider_models:
print(provider_model)(openai, gpt-4)
(openai, gpt-4-turbo)
(openai, gpt-3.5-turbo)
...- Returns a list of
ProviderModelTypeobjects.
Parameters
| Option | Type | Default Value | Description |
|---|---|---|---|
provider | str | Required | The provider name to list models for (e.g., |
model_size | str | None | One of |
features | List[str] | None | List of required features that models must support. |
px.models.get_model()
Gets a specific model by provider and model name. This function returns the model if it exists and the provider’s API key is configured, but does not verify that the model is actually working.
model = px.models.get_model(provider='openai', model='gpt-4')
print(model)(openai, gpt-4)- Returns a
ProviderModelTypeobject. - Raises
ValueErrorif the provider’s API key is not found or the model doesn’t exist.
Parameters
| Option | Type | Default Value | Description |
|---|---|---|---|
provider | str | Required | The provider name (e.g., |
model | str | Required | The model name (e.g., |
call_type | CallType | GENERATE_TEXT | The type of API call the model should support. |
px.models.list_working_models()
Lists models that have been verified to work by sending actual test requests. Results are cached to avoid repeated testing.
working_models = px.models.list_working_models()
for model in working_models:
print(model)(anthropic, claude-3-opus)
(openai, gpt-4)
(openai, gpt-3.5-turbo)
...- Returns a list of
ProviderModelTypeobjects, or aModelStatusobject ifreturn_all=True.
Parameters
| Option | Type | Default Value | Description |
|---|---|---|---|
model_size | str | None | One of |
features | List[str] | None | List of required features that models must support. |
verbose | bool | True | If |
px.models.list_working_providers()
Lists providers that have at least one working model. Tests models and returns providers that have successfully responded to at least one test request.
providers = px.models.list_working_providers()
print(providers)['anthropic', 'openai']- Returns a sorted list of provider names (
List[str]).
Parameters
| Option | Type | Default Value | Description |
|---|---|---|---|
verbose | bool | True | If |
clear_model_cache | bool | False | If |
call_type | CallType | GENERATE_TEXT | The type of API call to test. |
px.models.list_working_provider_models()
Lists working models from a specific provider by testing each model.
openai_working = px.models.list_working_provider_models('openai')
for model in openai_working:
print(model)(openai, gpt-4)
(openai, gpt-3.5-turbo)- Returns a list of
ProviderModelTypeobjects, or aModelStatusobject ifreturn_all=True. - Raises
ValueErrorif the provider’s API key is not found.
Parameters
| Option | Type | Default Value | Description |
|---|---|---|---|
provider | str | Required | The provider name to list models for. |
model_size | str | None | One of |
features | List[str] | None | List of required features that models must support. |
verbose |
px.models.get_working_model()
Verifies and returns a specific model if it’s working. Tests the model and returns it only if it successfully responds.
model = px.models.get_working_model('openai', 'gpt-4')
print(model)(openai, gpt-4)- Returns a
ProviderModelTypeobject if the model is working. - Raises
ValueErrorif the provider’s API key is not found, the model doesn’t exist, or the model failed the health check.
Parameters
| Option | Type | Default Value | Description |
|---|---|---|---|
provider | str | Required | The provider name (e.g., |
model | str | Required | The model name (e.g., |
verbose | bool | False | If |
clear_model_cache |
Details of how models are checked
The available models are determined as follows:
- It checks environment variables for provider API keys (see Provider Integrations)
- Then, it looks if the model was previously cached
- Finally, it makes a simple request for each un-cached model to check if these models are available