Files
igny8/backend/igny8_core/ai/constants.py

55 lines
1.8 KiB
Python

"""
AI Constants - Configuration constants for AI operations
NOTE: Model pricing (MODEL_RATES, IMAGE_MODEL_RATES) has been moved to the database
via AIModelConfig. Use ModelRegistry to get model pricing:
from igny8_core.ai.model_registry import ModelRegistry
cost = ModelRegistry.calculate_cost(model_id, input_tokens=N, output_tokens=N)
The constants below are DEPRECATED and kept only for reference/backward compatibility.
Do NOT use MODEL_RATES or IMAGE_MODEL_RATES in new code.
"""
# DEPRECATED - Use AIModelConfig database table instead
# Model pricing (per 1M tokens) - kept for reference only
MODEL_RATES = {
'gpt-4.1': {'input': 2.00, 'output': 8.00},
'gpt-4o-mini': {'input': 0.15, 'output': 0.60},
'gpt-4o': {'input': 2.50, 'output': 10.00},
'gpt-5.1': {'input': 1.25, 'output': 10.00},
'gpt-5.2': {'input': 1.75, 'output': 14.00},
}
# DEPRECATED - Use AIModelConfig database table instead
# Image model pricing (per image) - kept for reference only
IMAGE_MODEL_RATES = {
'dall-e-3': 0.040,
'dall-e-2': 0.020,
'gpt-image-1': 0.042,
'gpt-image-1-mini': 0.011,
}
# Valid OpenAI image generation models (only these work with /v1/images/generations endpoint)
VALID_OPENAI_IMAGE_MODELS = {
'dall-e-3',
'dall-e-2',
# Note: gpt-image-1 and gpt-image-1-mini are NOT valid for OpenAI's /v1/images/generations endpoint
}
# Valid image sizes per model (from OpenAI official documentation)
VALID_SIZES_BY_MODEL = {
'dall-e-3': ['1024x1024', '1024x1792', '1792x1024'],
'dall-e-2': ['256x256', '512x512', '1024x1024'],
}
# Default model
DEFAULT_AI_MODEL = 'gpt-4.1'
# JSON mode supported models
JSON_MODE_MODELS = ['gpt-4o', 'gpt-4o-mini', 'gpt-4-turbo-preview', 'gpt-5.1', 'gpt-5.2']
# Debug mode - controls console logging
# Set to False in production to disable verbose logging
DEBUG_MODE = True