test24 / api /config.py
Niansuh's picture
Update api/config.py
3073084 verified
raw
history blame
2.19 kB
# api/config.py
import os
from dotenv import load_dotenv
load_dotenv()
# Base URL and API Endpoint for GizAI
BASE_URL = "https://app.giz.ai"
API_ENDPOINT = "https://app.giz.ai/api/data/users/inferenceServer.infer"
common_headers = {
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'en-US,en;q=0.9',
'Cache-Control': 'no-cache',
'Origin': BASE_URL,
'Pragma': 'no-cache',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36',
'sec-ch-ua': '"Not?A_Brand";v="99", "Chromium";v="130"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Linux"',
'Content-Type': 'application/json'
}
# Header Configurations for Specific API Calls
def get_headers_api_chat(referer_url=None):
headers = common_headers.copy()
if referer_url:
headers['Referer'] = referer_url
return headers
# Define GizAI Models
CHAT_MODELS = [
'chat-gemini-flash',
'chat-gemini-pro',
'chat-gpt4m',
'chat-gpt4',
'claude-sonnet',
'claude-haiku',
'llama-3-70b',
'llama-3-8b',
'mistral-large',
'chat-o1-mini'
]
IMAGE_MODELS = [
'flux1',
'sdxl',
'sd',
'sd35',
]
MODELS = CHAT_MODELS + IMAGE_MODELS
MODEL_ALIASES = {
# Chat model aliases
"gemini-flash": "chat-gemini-flash",
"gemini-pro": "chat-gemini-pro",
"gpt-4o-mini": "chat-gpt4m",
"gpt-4o": "chat-gpt4",
"claude-3.5-sonnet": "claude-sonnet",
"claude-3-haiku": "claude-haiku",
"llama-3.1-70b": "llama-3-70b",
"llama-3.1-8b": "llama-3-8b",
"o1-mini": "chat-o1-mini",
# Image model aliases
"sd-1.5": "sd",
"sd-3.5": "sd35",
"flux-schnell": "flux1",
}
DEFAULT_MODEL = 'chat-gemini-flash'
MODEL_MAPPING = {model: model for model in MODELS}
MODEL_MAPPING.update(MODEL_ALIASES)
ALLOWED_MODELS = MODELS # You can adjust this if you want to restrict further
# Agent modes
AGENT_MODE = {}
TRENDING_AGENT_MODE = {}
MODEL_PREFIXES = {}
MODEL_REFERERS = {}
# **Authentication Secret**
APP_SECRET = os.getenv("APP_SECRET")