Помогите найти ошибку в func.php подключение к Дипсик

Приветствую. Пытаюсь настроить загрузку описаний в карточку товара через дипсик. Через SHH

`curl -v https://api.deepseek.com/v1/chat/completions \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{"model":"deepseek-chat","messages":[{"role":"user","content":"Hello"}],"stream":false}'`

подключается, ключ определяется как валидный, баланс положительный
в func.php

<?php
/***************************************************************************
*                                                                          *
*   (c) 2024 DeepSeek AI Description Generator                             *
*                                                                          *
****************************************************************************/

use Tygh\Registry;

if (!defined('BOOTSTRAP')) { die('Access denied'); }

/**
 * Основная функция генерации описания товара
 */
function fn_deepseek_description_generate($product_id)
{
    $lang_code = CART_LANGUAGE;
    $product = fn_get_product_data($product_id, $auth, $lang_code, '', true, true, true, true, false, true);
    
    if (empty($product)) {
        return false;
    }

    // Сбор характеристик товара
    $features_list = [];
    if (!empty($product['product_features'])) {
        foreach ($product['product_features'] as $f) {
            $val = !empty($f['variant']) ? $f['variant'] : ($f['value'] ?? '');
            if ($val) {
                $features_list[] = $f['description'] . ': ' . $val;
            }
        }
    }
    $features_text = implode('; ', $features_list);

    // Подготовка промпта
    $placeholders = [
        '{name}'     => $product['product'],
        '{category}' => fn_get_category_name($product['main_category'], $lang_code),
        '{features}' => $features_text,
        '{sku}'      => $product['product_code']
    ];
    
    $template = Registry::get('addons.deepseek_description.prompt_template');
    $prompt = str_replace(array_keys($placeholders), array_values($placeholders), $template);

    // Настройки API
    $api_key = trim(Registry::get('addons.deepseek_description.api_key'));
    $model   = Registry::get('addons.deepseek_description.model') ?: 'deepseek-chat';

    if (empty($api_key)) {
        fn_set_notification('E', 'Ошибка', 'API ключ DeepSeek не заполнен');
        return false;
    }

    // ВЫЗОВ API С ЛОГИРОВАНИЕМ В ФАЙЛ
    $result = fn_deepseek_api_call_v3($api_key, $model, $prompt, $lang_code);

    if (!empty($result['choices'][0]['message']['content'])) {
        $description = $result['choices'][0]['message']['content'];

        db_query(
            "UPDATE ?:product_descriptions SET full_description = ?s WHERE product_id = ?i AND lang_code = ?s",
            $description, $product_id, $lang_code
        );

        fn_clear_cart_cache([$product_id]);

        $tokens = $result['usage']['total_tokens'] ?? 0;
        fn_deepseek_log($product_id, $prompt, $description, $tokens, 'S');
        
        fn_set_notification('N', 'Успех', 'Описание успешно обновлено');
        return true;
    } else {
        $error_info = isset($result['error_debug']) ? $result['error_debug'] : 'Ошибка API';
        fn_deepseek_log($product_id, $prompt, '', 0, 'F', $error_info);
        fn_set_notification('E', 'Ошибка DeepSeek', "Код: " . ($result['http_code'] ?? '???') . " | См. deepseek_debug.txt");
        return false;
    }
}

/**
 * Вызов API с жесткой фиксацией URL (v1/chat/completions)
 */
function fn_deepseek_api_call_v3($api_key, $model, $prompt, $lang_code) {
    $data = json_encode([
        'model' => $model,
        'messages' => [['role' => 'user', 'content' => $prompt]],
        'temperature' => 0.7,
        'stream' => false
    ]);

    // Инициализация с ПОЛНЫМ путем, который прошел тест в консоли
    $ch = curl_init('https://api.deepseek.com');
    
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST           => true,
        CURLOPT_HTTPHEADER     => [
            'Authorization: Bearer ' . trim($api_key),
            'Content-Type: application/json'
        ],
        CURLOPT_POSTFIELDS     => $data,
        CURLOPT_TIMEOUT        => 60,
        CURLOPT_SSL_VERIFYPEER => false,
        CURLOPT_IPRESOLVE      => CURL_IPRESOLVE_V4
    ]);

    $response = curl_exec($ch);
    $info = curl_getinfo($ch);
    $curl_err = curl_error($ch);
    curl_close($ch);

    // Финальная запись отладки
    $debug = "\n--- FINAL CHECK --- \n";
    $debug .= "SENT_TO: " . $info['url'] . "\n";
    $debug .= "CODE: " . $info['http_code'] . "\n";
    $debug .= "CURL_ERR: " . $curl_err . "\n";
    $debug .= "RES: " . substr($response, 0, 500) . "\n";
    file_put_contents(DIR_ROOT . '/deepseek_debug.txt', $debug, FILE_APPEND);

    if ($info['http_code'] === 200) {
        return json_decode($response, true);
    }
    return [
        'error_debug' => "HTTP " . $info['http_code'],
        'http_code' => $info['http_code']
    ];
}

/**
 * Заглушка баланса
 */
function fn_deepseek_format_balance()
{
    return 'Статус баланса проверяется при генерации';
}

/**
 * Логирование в БД
 */
function fn_deepseek_log($p_id, $prompt, $res, $tokens, $status, $err = '') {
    db_query('INSERT INTO ?:deepseek_log ?e', [
        'product_id'  => $p_id,
        'prompt'      => $prompt,
        'response'    => ($status == 'S') ? $res : $err,
        'tokens_used' => (int)$tokens,
        'status'      => $status,
        'created_at'  => time()
    ]);
}

возвращает

SENT_TO: https://api.deepseek.com
CODE: 404
CURL_ERR: 
RES: 

Есть мысли что могло пойти не так? Перепробовал уже кучу вариантов и все никак. Буду благодарен.

а метод?

вот тут метод указан

версия API

метод

1 лайк