Repository navigation
feat: add Cheaper Inference as a provider option - #291
aiapienthusiast wants to merge 3 commits into
Conversation
Eigenwise
left a comment
There was a problem hiding this comment.
The missing-key path needs fixing before merge. The new branch passes None to OpenAI when CHEAPER_INFERENCE_API_KEY is absent. The locked SDK then falls back to OPENAI_API_KEY, so choosing this gateway can send an unrelated provider key to the third-party URL. Validate a nonempty vendor key before constructing the client, and test that missing-key path with a dummy unrelated OpenAI key and no network requests.
There are no tests of the actual new setup branch. Please add properly mocked selector, credential, request-shape and structured-response tests. The modified setup function also exceeds our per-function complexity bar; the existing core coverage job doesn't cover this example.
Please explain the distinct developer benefit of another named gateway entry beyond the existing OpenAI-compatible examples. A provider-neutral configuration example may cover the use case with less maintenance. I haven't verified this vendor's model/mode/token-parameter compatibility, so I'm not treating that as a confirmed failure.
There was a problem hiding this comment.
Source-only recheck of 2f28aa63: the missing/empty vendor-key path now rejects the key before constructing OpenAI, and setup_client is down to complexity 2. The added tests contain relevant selector, credential and request assertions. Those repairs look right in the source.
One measured production blocker remains: atomic-examples/quickstart/quickstart/4_basic_chatbot_different_providers.py:134-205, the new main, has native Radon 6.0.1 complexity 7. Our per-function CRAP requirement is strictly below 6, so this fails even with full coverage. Please simplify the interactive flow at meaningful boundaries. Keep the useful test assertions.
I haven't run this head's tests, measured its coverage or verified SDK/provider behavior. The links remain neutral; the earlier question about the distinct benefit of another named gateway entry is still open.
This PR adds Cheaper Inference as a provider option in the quickstart example.
It uses the same pattern as #270 (Eden AI).
Cheaper Inference is an OpenAI-compatible LLM gateway.
One API key gives access to models from several labs.
Usage:
Get a key at https://cheaperinference.com/signup.
Details
Files:
atomic-examples/quickstart/quickstart/4_basic_chatbot_different_providers.py: add option 9,cheaperinference.It uses
instructor.from_openaiwith base URLhttps://api.cheaperinference.com/v1and modelgpt-5.4-mini.README.md: add Cheaper Inference to the list of OpenAI-compatible APIs.Tests:
black --check(24.10) on the changed example: unchanged.flake8on the changed example: clean.Live check:
gpt-5.4-minireturned a reply throughsetup_client("cheaperinference")andAtomicAgent.run().