<?php
/**
 * API Configuration
 *
 * @package ZenoChatbot
 */

// Prevent direct access
if (!defined('ABSPATH')) {
    exit;
}

return [

    /*
    |--------------------------------------------------------------------------
    | API Namespace
    |--------------------------------------------------------------------------
    */
    'namespace' => 'zeno-chatbot-ai/v1',

    /*
    |--------------------------------------------------------------------------
    | LLM Configuration
    |--------------------------------------------------------------------------
    |
    | Single model configuration - user selects one provider and one model
    | at a time. Settings are stored separately and merged with this config.
    |
    */

    // Default LLM settings (can be overridden by user settings)
    'llm_defaults' => [
        'provider' => 'openai',
        'model' => 'gpt-5-mini',
        'temperature' => 0.7,
        'max_tokens' => 1000,
        'system_prompt' => 'You are a helpful AI assistant for this website. Answer questions based on the provided context and be concise and helpful.',
    ],

    // Available LLM providers and their models (ordered newest-first)
    'llm_providers' => [
        'openai' => [
            'name' => 'OpenAI',
            'description' => 'Verified OpenAI chat models via chat.completions API.',
            'website' => 'https://openai.com',
            'api_url' => 'https://api.openai.com/v1',
            'api_key_format' => 'sk-[a-zA-Z0-9]{48}',
            'enabled' => true,
            'models' => [
                'gpt-5.5' => [
                    'name' => 'GPT-5.5',
                    'description' => 'Newest flagship model for complex reasoning and professional work; 1M context.',
                    'max_tokens' => 128000,
                    'context_window' => 1050000,
                    'cost_per_1k_input_tokens' => 0.005,
                    'cost_per_1k_output_tokens' => 0.03,
                ],
                'gpt-5.4' => [
                    'name' => 'GPT-5.4',
                    'description' => 'Frontier model for complex professional work; 1M context, more affordable than 5.5.',
                    'max_tokens' => 128000,
                    'context_window' => 1050000,
                    'cost_per_1k_input_tokens' => 0.0025,
                    'cost_per_1k_output_tokens' => 0.015,
                ],
                'gpt-5.4-mini' => [
                    'name' => 'GPT-5.4 Mini',
                    'description' => 'Strongest mini model for coding and high-volume workloads; 400K context.',
                    'max_tokens' => 128000,
                    'context_window' => 400000,
                    'cost_per_1k_input_tokens' => 0.00075,
                    'cost_per_1k_output_tokens' => 0.0045,
                ],
                'gpt-5.4-nano' => [
                    'name' => 'GPT-5.4 Nano',
                    'description' => 'Cheapest 5.4-class model for simple, high-volume tasks; 400K context.',
                    'max_tokens' => 128000,
                    'context_window' => 400000,
                    'cost_per_1k_input_tokens' => 0.0002,
                    'cost_per_1k_output_tokens' => 0.00125,
                ],
                'gpt-5' => [
                    'name' => 'GPT-5',
                    'description' => 'Previous reasoning model for coding and agentic tasks; 400K context.',
                    'max_tokens' => 128000,
                    'context_window' => 400000,
                    'cost_per_1k_input_tokens' => 0.00125,
                    'cost_per_1k_output_tokens' => 0.01,
                ],
                'gpt-5-mini' => [
                    'name' => 'GPT-5 Mini',
                    'description' => 'Near-frontier intelligence for cost-sensitive, low-latency workloads; 400K context.',
                    'max_tokens' => 128000,
                    'context_window' => 400000,
                    'cost_per_1k_input_tokens' => 0.00025,
                    'cost_per_1k_output_tokens' => 0.002,
                ],
                'gpt-5-nano' => [
                    'name' => 'GPT-5 Nano',
                    'description' => 'Fastest, most cost-efficient GPT-5 for summarization and classification; 400K context.',
                    'max_tokens' => 128000,
                    'context_window' => 400000,
                    'cost_per_1k_input_tokens' => 0.00005,
                    'cost_per_1k_output_tokens' => 0.0004,
                ],
                'gpt-4.1' => [
                    'name' => 'GPT-4.1',
                    'description' => 'Advanced reasoning with 1M token context and ~32K max output tokens.',
                    'max_tokens' => 32768,
                    'context_window' => 1000000,
                    'cost_per_1k_input_tokens' => 0.002,
                    'cost_per_1k_output_tokens' => 0.008,
                ],
                'gpt-4.1-mini' => [
                    'name' => 'GPT-4.1 Mini',
                    'description' => 'Lightweight 4.1 model; 1M token context, ~32K output tokens.',
                    'max_tokens' => 32768,
                    'context_window' => 1000000,
                    'cost_per_1k_input_tokens' => 0.0004,
                    'cost_per_1k_output_tokens' => 0.0016,
                ],
                'gpt-4.1-nano' => [
                    'name' => 'GPT-4.1 Nano',
                    'description' => 'Smallest 4.1 model; 1M token context, ~32K output tokens.',
                    'max_tokens' => 32768,
                    'context_window' => 1000000,
                    'cost_per_1k_input_tokens' => 0.0001,
                    'cost_per_1k_output_tokens' => 0.0004,
                    'deprecated' => true,
                ],
                'gpt-4o' => [
                    'name' => 'GPT-4o',
                    'description' => 'Fast, intelligent, flexible GPT model; 128K context, up to ~16K output tokens.',
                    'max_tokens' => 16384,
                    'context_window' => 128000,
                    'cost_per_1k_input_tokens' => 0.005,
                    'cost_per_1k_output_tokens' => 0.015,
                    'deprecated' => true,
                ],
                'chatgpt-4o-latest' => [
                    'name' => 'ChatGPT-4o',
                    'description' => 'GPT-4o model used in ChatGPT; auto-updating channel.',
                    'max_tokens' => 16384,
                    'context_window' => 128000,
                    'cost_per_1k_input_tokens' => 0.005,
                    'cost_per_1k_output_tokens' => 0.015,
                    'deprecated' => true,
                ],
                'gpt-4o-mini' => [
                    'name' => 'GPT-4o Mini',
                    'description' => 'Cost-efficient 4o family model; 128K context, up to ~16K output tokens.',
                    'max_tokens' => 16384,
                    'context_window' => 128000,
                    'cost_per_1k_input_tokens' => 0.00015,
                    'cost_per_1k_output_tokens' => 0.0006,
                ],
                'gpt-4-turbo' => [
                    'name' => 'GPT-4 Turbo',
                    'description' => 'High-context GPT-4 variant; 128K context, ~4K max output tokens.',
                    'max_tokens' => 4096,
                    'context_window' => 128000,
                    'cost_per_1k_input_tokens' => 0.01,
                    'cost_per_1k_output_tokens' => 0.03,
                    'deprecated' => true,
                ],
                'gpt-4' => [
                    'name' => 'GPT-4',
                    'description' => 'Original GPT-4 (8K context); strong reasoning, lower latency.',
                    'max_tokens' => 4096,
                    'context_window' => 8192,
                    'cost_per_1k_input_tokens' => 0.03,
                    'cost_per_1k_output_tokens' => 0.06,
                ],
                'gpt-3.5-turbo' => [
                    'name' => 'GPT-3.5 Turbo',
                    'description' => 'Legacy fast & cost-effective chat model; ~16K context window.',
                    'max_tokens' => 4096,
                    'context_window' => 16385,
                    'cost_per_1k_input_tokens' => 0.0005,
                    'cost_per_1k_output_tokens' => 0.0015,
                    'deprecated' => true,
                ],
                'gpt-3.5-turbo-16k' => [
                    'name' => 'GPT-3.5 Turbo 16K',
                    'description' => 'Legacy 16K-context variant of GPT-3.5 Turbo.',
                    'max_tokens' => 4096,
                    'context_window' => 16385,
                    'cost_per_1k_input_tokens' => 0.003,
                    'cost_per_1k_output_tokens' => 0.004,
                    'deprecated' => true,
                ],
            ],
            'default_model' => 'gpt-5-mini',
        ],

        'gemini' => [
            'name' => 'Google Gemini',
            'description' => 'Verified Gemini models via generateContent API.',
            'website' => 'https://ai.google.dev',
            'api_url' => 'https://generativelanguage.googleapis.com/v1',
            'api_key_format' => 'AIza[a-zA-Z0-9_-]{35}',
            'enabled' => true,
            'models' => [
                'gemini-3.5-flash' => [
                    'name' => 'Gemini 3.5 Flash',
                    'description' => 'Frontier Flash model for agentic coding and long-horizon tasks; 4x faster output, 1M context.',
                    'max_tokens' => 65536,
                    'context_window' => 1048576,
                    'cost_per_1k_input_tokens' => 0.0015,
                    'cost_per_1k_output_tokens' => 0.009,
                ],
                'gemini-3.1-pro' => [
                    'name' => 'Gemini 3.1 Pro',
                    'description' => 'Most advanced Gemini reasoning model for complex tasks, deep research, and coding; 1M context.',
                    'max_tokens' => 65536,
                    'context_window' => 1048576,
                    'cost_per_1k_input_tokens' => 0.0025,
                    'cost_per_1k_output_tokens' => 0.015,
                ],
                'gemini-3.1-flash-lite' => [
                    'name' => 'Gemini 3.1 Flash-Lite',
                    'description' => 'Most cost-efficient Gemini model for high-volume, low-latency workloads; 1M context.',
                    'max_tokens' => 65536,
                    'context_window' => 1048576,
                    'cost_per_1k_input_tokens' => 0.0002,
                    'cost_per_1k_output_tokens' => 0.0008,
                ],
                'gemini-2.5-pro' => [
                    'name' => 'Gemini 2.5 Pro',
                    'description' => 'Previous-gen reasoning model; 1M context. Retiring October 2026.',
                    'max_tokens' => 65536,
                    'context_window' => 1048576,
                    'cost_per_1k_input_tokens' => 0.00125,
                    'cost_per_1k_output_tokens' => 0.01,
                    'deprecated' => true,
                ],
                'gemini-2.5-flash' => [
                    'name' => 'Gemini 2.5 Flash',
                    'description' => 'Previous-gen hybrid reasoning model; 1M context. Retiring October 2026.',
                    'max_tokens' => 65536,
                    'context_window' => 1048576,
                    'cost_per_1k_input_tokens' => 0.00015,
                    'cost_per_1k_output_tokens' => 0.0006,
                    'deprecated' => true,
                ],
                'gemini-2.5-flash-lite' => [
                    'name' => 'Gemini 2.5 Flash-Lite',
                    'description' => 'Previous-gen cost-efficient model; 1M context. Retiring October 2026.',
                    'max_tokens' => 65536,
                    'context_window' => 1048576,
                    'cost_per_1k_input_tokens' => 0.0001,
                    'cost_per_1k_output_tokens' => 0.0004,
                    'deprecated' => true,
                ],
            ],
            'default_model' => 'gemini-3.5-flash',
        ],

        'anthropic' => [
            'name' => 'Anthropic Claude',
            'description' => 'Claude models via the Messages API with strong reasoning and safety.',
            'website' => 'https://www.anthropic.com',
            'api_url' => 'https://api.anthropic.com/v1',
            'api_key_format' => 'sk-ant-[a-zA-Z0-9_-]{90,}',
            'enabled' => true,
            'models' => [
                'claude-opus-4-8' => [
                    'name' => 'Claude Opus 4.8',
                    'description' => 'Frontier intelligence for long-running agents, agentic coding, and high-autonomy work; 1M context.',
                    'max_tokens' => 128000,
                    'context_window' => 1000000,
                    'cost_per_1k_input_tokens' => 0.005,
                    'cost_per_1k_output_tokens' => 0.025,
                ],
                'claude-sonnet-4-6' => [
                    'name' => 'Claude Sonnet 4.6',
                    'description' => 'Best combination of speed and intelligence for most production workloads; 1M context.',
                    'max_tokens' => 128000,
                    'context_window' => 1000000,
                    'cost_per_1k_input_tokens' => 0.003,
                    'cost_per_1k_output_tokens' => 0.015,
                ],
                'claude-haiku-4-5' => [
                    'name' => 'Claude Haiku 4.5',
                    'description' => 'Fastest and most cost-effective model for high-volume, simple tasks; 200K context.',
                    'max_tokens' => 8192,
                    'context_window' => 200000,
                    'cost_per_1k_input_tokens' => 0.001,
                    'cost_per_1k_output_tokens' => 0.005,
                ],
            ],
            'default_model' => 'claude-sonnet-4-6',
        ],
    ],

    // Parameter limits for validation
    'llm_limits' => [
        'temperature' => ['min' => 0.0, 'max' => 2.0, 'step' => 0.1],
        'max_tokens' => ['min' => 50, 'max' => 128000, 'step' => 50],
        'system_prompt' => ['max_length' => 2000],
    ],


    /*
    |--------------------------------------------------------------------------
    | Response Configuration
    |--------------------------------------------------------------------------
    */
    'responses' => [
        'default_error_message' => 'Sorry, I encountered an error. Please try again.',
        'rate_limit_message' => 'Too many requests. Please wait a moment.',
        'service_unavailable_message' => 'Chat service is temporarily unavailable.',
    ],

];
