Skip to content

feat(providers): add Cheaper Inference as an OpenAI-compatible gateway - #248

Open
aiapienthusiast wants to merge 5 commits into
HKUDS:mainfrom
aiapienthusiast:feat/cheaperinference
Open

aiapienthusiast wants to merge 5 commits into
HKUDS:mainfrom
aiapienthusiast:feat/cheaperinference

Conversation

@aiapienthusiast

Copy link
Copy Markdown

Description

This PR adds Cheaper Inference as a provider template.
Cheaper Inference is an OpenAI-compatible LLM gateway.
It gives access to models from several labs with one API key.

Cheaper Inference is one of the fastest-growing AI routers.
Each model costs 15–60% less than the list price of its lab.

The template uses the generic openai_compat backend.
It follows the pattern of #159.

Related Issues

None.

Changes Made

  • Add a cheaperinference ProviderSpec with the gateway endpoint class.
  • Add the matching ProvidersConfig field.
  • Add a setup section to docs/guide/models.md.
  • Add unit tests.

Checklist

  • Changes tested locally
  • Code reviewed
  • Documentation updated (if necessary)
  • Unit tests added (if applicable)

Additional Notes

Model IDs are bare, so the spec sets strip_model_prefix=True.
The tests make no network calls.
I checked the API with a live key: model list, chat, streaming, tool calls and JSON schema output with gpt-5.4-mini.

Details

Spec values:

  • Base URL: https://api.cheaperinference.com/v1
  • Key variable: CHEAPER_INFERENCE_API_KEY
  • Base detection keyword: cheaperinference.com
  • Model catalog: auto, which resolves to the OpenAI /v1/models listing.

Files:

  • core/providers/registry.py
  • core/config.py
  • docs/guide/models.md
  • tests/test_cheaperinference_provider.py (new)
  • tests/test_provider_egress.py

Commands run:

python -m pytest -q tests/test_cheaperinference_provider.py tests/test_provider_egress.py <related provider tests>
# 68 passed
python -m pytest -q <all provider, catalog, config, profile and connection test files>
# 217 passed
ruff check --ignore=E402 core/config.py core/providers/registry.py tests/test_cheaperinference_provider.py tests/test_provider_egress.py
ruff format --check core/config.py core/providers/registry.py tests/test_cheaperinference_provider.py tests/test_provider_egress.py
# ruff 0.15.21, as in .pre-commit-config.yaml; all passed

Cheaper Inference has no embeddings endpoint. The docs say so.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant