Add A Model Adapter

This guide describes how to add a provider without changing core orchestration.

1) Implement adapter

Create hexi.adapters.model_<provider>.py with adapter responsibilities only:

  • auth/header handling,
  • request formatting,
  • response extraction.

Do not add orchestration logic in adapters.

2) Register provider mapping

Update provider resolution in hexi.cli._pick_model.

3) Support provider config block

Load [providers.<provider>] values through memory/config parsing.

4) Add tests

Required coverage:

  • success response parsing,
  • non-200/provider error handling,
  • missing key failure path.

5) Validate end-to-end

Run:

PYTHONPATH=src pytest -q
hexi doctor --probe-model