gptme
gptme copied to clipboard
feat: Add AI/ML API provider support
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
aimlapias a new provider with detection viaAIML_API_KEYin__init__.pyandllm_openai.py.- Supports dynamic model listing from
/v1/modelsinllm_openai.py.- Adds extra headers (
HTTP-Referer,X-Title) foraimlapiinllm_openai.py.- Configuration:
- Updates
config.rstandproviders.rstto includeAIML_API_KEY.- Adds
aimlapitomodels.pywith default and summary model settings.- Testing:
- Adds
test_llm_aimlapi.pyfor provider detection, headers, and listing.- Updates
conftest.pyto check forAIML_API_KEY.This description was created by
for 085cad6311d87e6872f38e1de68d7232697d7b37. You can customize this summary. It will automatically update as commits are pushed.