MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / get_anthropic_models

Function get_anthropic_models

web/pgadmin/llm/__init__.py:408–437  ·  view source on GitHub ↗

Fetch available Anthropic models. Returns models that support tool use.

()

Source from the content-addressed store, hash-verified

406)
407@pga_login_required
408def get_anthropic_models():
409 """
410 Fetch available Anthropic models.
411 Returns models that support tool use.
412 """
413 from pgadmin.llm.utils import get_anthropic_api_key, get_anthropic_api_url
414
415 api_key = get_anthropic_api_key()
416 api_url = get_anthropic_api_url()
417 if not api_key and not api_url:
418 return make_json_response(
419 data={'models': [], 'error': 'No API key configured'},
420 status=200
421 )
422
423 try:
424 models = _fetch_anthropic_models(api_key, api_url)
425 return make_json_response(data={'models': models}, status=200)
426 except LLMApiError as e:
427 return make_json_response(
428 data={'models': [], 'error': str(e)},
429 status=200
430 )
431 except Exception:
432 return make_json_response(
433 data={'models': [],
434 'error': 'Failed to fetch Anthropic models. '
435 'Check the API key and URL configuration.'},
436 status=200
437 )
438
439
440@blueprint.route(

Callers

nothing calls this directly

Calls 4

get_anthropic_api_keyFunction · 0.90
get_anthropic_api_urlFunction · 0.90
make_json_responseFunction · 0.90
_fetch_anthropic_modelsFunction · 0.85

Tested by

no test coverage detected