# shellcheck shell=dash disable=SC2034

___x_cmd_gemini_count_request___try(){
    gemini:debug "Sending request to gemini server"
    # requestbody="$(___x_cmd cat "$request_body_file" | ___x_cmd jo .contents)"
    # requestbody="{\"contents\": $requestbody}"

    [ -z "$confirm_before_send" ] || {
        < "$request_body_file" ___x_cmd j2y | ___x_cmd bat -l yml --wrap never >"$___X_CMD_DEVTTY_FP"
        ___x_cmd ui yesno "Do your want to send this message?" || {
            ___X_CMD_RETRY_ABORT=1
            return 1
        }
        confirm_before_send=
    }

    {
        local _md5; _md5="$(< "$request_body_file" ___x_cmd str md5 )"
        < "$request_body_file" \
        ___x_cmd ccmd "$cache_time" -- \
            ___x_cmd_gemini_request_count "$model" "$_md5"
    } | {
        local errcode=0
        ___x_cmd cawk  -m j/json,j/jiter,j/jcp                                      \
                -f "$___X_CMD_ROOT_MOD/gemini/lib/awk/count_response.awk" || errcode=$?

        return "$errcode"
    }
}