Implementation:ARCANGEL0 EVA list models
| Knowledge Sources | |
|---|---|
| Domains | LLM, API_Integration |
| Last Updated | 2026-10-29 14:00 GMT |
Overview
Concrete tool for listing available LLM models from a provider with pagination support across OpenAI, Anthropic, and Cloudflare protocols, provided by the Mitsu provider client.
Description
The list_models function queries the provider's model list endpoint and returns a sorted list of model name strings. It handles three pagination styles:
- OpenAI: Uses the `after` cursor parameter and `has_more` flag.
- Anthropic: Uses the `after_id` cursor parameter and `last_id` field.
- Cloudflare: Uses the `page` parameter and `total_pages` from `result_info`.
The function paginates up to 20 times to collect all available models, deduplicating by model ID. It hides API keys in error messages before raising exceptions.
Usage
- Onboarding wizard: Called during first-run setup to populate the model selection list.
- Provider reconfiguration: Called when the operator changes the provider or base URL.
- Model discovery: Called to check if a saved model still exists on the provider.
Code Reference
Source Location
- Repository: Mitsu
- File: providers/client.py
Signature
def list_models(profile: dict[str, Any]) -> list[str]:
Import
from mitsu.providers.client import list_models
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| profile | dict[str, Any] | Yes | Provider config with base_url, api_key, protocol, provider_id |
Outputs
| Name | Type | Description |
|---|---|---|
| returns | list[str] | Sorted list of model name strings |
Usage Examples
List OpenAI Models
from mitsu.providers.client import list_models
profile = {
"base_url": "https://api.openai.com/v1",
"api_key": "sk-...",
"protocol": "openai",
"provider_id": "openai",
}
models = list_models(profile)
print(f"Available models: {models}")
# ['gpt-4', 'gpt-4-turbo', 'gpt-4o', ...]
List Anthropic Models
profile = {
"base_url": "https://api.anthropic.com/v1",
"api_key": "sk-ant-...",
"protocol": "anthropic",
"provider_id": "anthropic",
}
models = list_models(profile)
Related Pages
Implements Principle
- Principle:ARCANGEL0_EVA_Provider_Request_Dispatch
- Principle:ARCANGEL0_EVA_Session_Lifecycle_Management
- Principle:ARCANGEL0_EVA_Configuration_Persistence