# shellcheck shell=dash

___x_cmd_codex_hub(){
    local op="$1"
    case "$op" in
        -h|--help)      ___x_cmd help -m codex hub; return 0 ;;
        --)             shift ;;
    esac

    local model=""
    local apikey; apikey="$(___x_cmd hub ai convo --get-apikey 2>/dev/null)"
    local url="https://agent.x-cmd.com/api"
    local provider="hub"
    local provider_name="Hub AI"
    local wire_api="chat"

    ___x_cmd_codex_other___use "$provider" "$url" "$apikey" "$model" "$provider_name" "$wire_api" \
        --config "model_providers.${provider}.http_headers={ \"X-Service-Authorization\" = \"Bearer ${apikey}\" }" "$@"
}
