gptme icon indicating copy to clipboard operation
gptme copied to clipboard

feat: Add AI/ML API provider support

Open D1m7asis opened this issue 7 months ago • 0 comments

from: https://github.com/gptme/gptme/issues/548

Adds AI/ML API as a new provider (aimlapi) with:

  • Provider detection via AIML_API_KEY
  • OpenAI-compatible client (https://api.aimlapi.com/v1)
  • Dynamic model listing from /v1/models
  • Extra headers (HTTP-Referer, X-Title)
  • Docs update (config + providers)
  • Tests for detection, headers, and provider listing

How to test

export AIML_API_KEY=<xxxxxx>

gptme "hello" -m aimlapi/openai/gpt-4o-mini
pytest -k aimlapi

Notes

  • No breaking changes to other providers
    • OpenRouter logic is unchanged.
    • Extra headers are now applied to both OpenRouter and AI/ML API.
    • Dynamic model listing, previously only for OpenRouter, now also supports AI/ML API.

[!IMPORTANT] Adds support for AI/ML API provider with dynamic model listing and extra headers, updating configuration and tests accordingly.

  • Behavior:
    • Adds aimlapi as a new provider with detection via AIML_API_KEY in __init__.py and llm_openai.py.
    • Supports dynamic model listing from /v1/models in llm_openai.py.
    • Adds extra headers (HTTP-Referer, X-Title) for aimlapi in llm_openai.py.
  • Configuration:
    • Updates config.rst and providers.rst to include AIML_API_KEY.
    • Adds aimlapi to models.py with default and summary model settings.
  • Testing:
    • Adds test_llm_aimlapi.py for provider detection, headers, and listing.
    • Updates conftest.py to check for AIML_API_KEY.

This description was created by Ellipsis for 085cad6311d87e6872f38e1de68d7232697d7b37. You can customize this summary. It will automatically update as commits are pushed.

D1m7asis avatar Sep 15 '25 11:09 D1m7asis