The AI Models system provides comprehensive management of AI models across multiple providers, enabling model listing, selection, and configuration for the Nova Coder platform.
Overview
The AI Models system allows developers to view and manage available AI models from configured providers. It supports multiple AI providers including OpenAI, Anthropic, Cohere, HuggingFace, LocalAI, and vLLM, providing a unified interface for model management.
Features
- Model Listing: View all available AI models from configured providers
- Provider Information: Display provider information for each model
- Model Size Display: Show model size information
- Multi-Provider Support: Support for multiple AI providers
- Model Selection: Select models for use in AI operations
API Endpoints
GET /api/models
List all available AI models from configured providers.
GET /api/ai/management/dashboard
Returns the unified model management dashboard with provider status, cost summary, and failover state.
GET /api/ai/management/providers
Lists provider health and availability.
GET /api/ai/management/costs
Returns aggregated cost metrics across providers and models.
GET /api/ai/management/failover
Returns the current provider failover routing configuration.
Response:
[
{
"name": "gpt-4",
"provider": "openai",
"size": "-"
},
{
"name": "claude-3-opus",
"provider": "anthropic",
"size": "-"
},
{
"name": "command",
"provider": "cohere",
"size": "-"
}
]
Web UI Integration
The AI Models system is fully integrated into the Nova Coder Web UI with a dedicated "AI Models" navigation item under the Administration section.
AI Models UI Features
The AI Models UI provides:
- Model Listing Display: View all available AI models in a grid layout
- Provider Information: Display provider name for each model
- Model Size Display: Show model size information
- Grid Layout: Organized display of models in a grid layout for easy browsing
API Endpoints Used
The AI Models UI integrates with the following API endpoint:
GET /api/models- List all available AI models from configured providers
UI Navigation
Access the AI Models UI by:
- Navigate to the Administration section in the sidebar
- Click on "AI Models"
- The UI displays all available models in a grid layout
JavaScript Integration
The AI Models UI is implemented in the React SPA (novacoder/web/react/src/pages/Ai.tsx, backed by GET /api/models); there is no separate novacoder/web/static/js/app.js. The legacy inline UI in novacoder/api/_html.py also calls /api/models.
Response Handling
The UI handles API responses according to the actual response structure from the models endpoint:
- Models Response: Expects array of model objects with name, provider, and size fields
- Model Object: Each model contains name (model identifier), provider (provider name), and size (model size information)
Display Format
The AI Models UI displays models in a grid layout with:
- Model Name: Displayed as the card title
- Provider Information: Displayed below the model name
- Model Size: Displayed below the provider information
Supported AI Providers
The AI Models system supports the following providers:
- OpenAI: GPT-4, GPT-3.5, and other OpenAI models
- Anthropic: Claude 3 Opus, Claude 3 Sonnet, and other Anthropic models
- Cohere: Command, Command Light, and other Cohere models
- HuggingFace: Various open-source models
- LocalAI: Local models via LocalAI
- vLLM: Local models via vLLM
- Azure OpenAI: Azure-hosted OpenAI models
- Bedrock: AWS Bedrock models
- Vertex AI: Google Vertex AI models
Usage Examples
Listing Available Models
from novacoder.ai.service import AIService
from novacoder.app import create_app
app = create_app()
ai_service = app.container.resolve(AIService)
# List all available models
providers = ai_service.manager.list_providers()
for provider_name in providers:
provider = ai_service.manager.load(provider_name)
models = await provider.available_models()
print(f"Provider: {provider_name}")
for model in models:
print(f" - {model}")
Getting Model Information
# Get model information for a specific provider
provider = ai_service.manager.load("openai")
models = await provider.available_models()
for model in models:
print(f"Model: {model}")
print(f"Provider: openai")
Model Configuration
Models are configured through the AI provider configuration:
from novacoder.config.settings import AppConfig
config = AppConfig(
ai={
"providers": {
"openai": {
"api_key": "your-api-key",
"model": "gpt-4"
}
}
}
)
Model Selection
Select models for specific operations:
# Use a specific model for AI operations
provider = ai_service.manager.load("openai")
response = await provider.complete(
prompt="Hello, world!",
model="gpt-4"
)
Related Documentation
- AI Runtime
- AI Provider Configuration
- AI Provider Metrics
- AI Health Monitoring
- REST API
- Web Interface
- AI Providers