It should be possible for the Graph extension to specify non-default api endpoint via the wgGraphAllowedDomains parameter. For example, instead of setting it as
$wgGraphAllowedDomains = [ 'wikiraw' => [ 'tools.wikimedia.pl' ], 'http' => [ 'tools.wikimedia.pl' ] ];
it should be:
$wgGraphAllowedDomains = [ 'wikiraw' => [ 'http://tools.wikimedia.pl/a/b/c/api.php' ] ];