Skip to content

feat: add Cheaper Inference as a provider option - #291

Closed
aiapienthusiast wants to merge 3 commits into
Eigenwise:mainfrom
aiapienthusiast:cheaperinference-provider
Closed

aiapienthusiast wants to merge 3 commits into
Eigenwise:mainfrom
aiapienthusiast:cheaperinference-provider

Conversation

@aiapienthusiast

Copy link
Copy Markdown

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:

export CHEAPER_INFERENCE_API_KEY=...
python atomic-examples/quickstart/quickstart/4_basic_chatbot_different_providers.py
# choose 9 or "cheaperinference"

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_openai with base URL https://api.cheaperinference.com/v1 and model gpt-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.
  • flake8 on the changed example: clean.

Live check: gpt-5.4-mini returned a reply through setup_client("cheaperinference") and AtomicAgent.run().

@Eigenwise Eigenwise left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Eigenwise Eigenwise left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Eigenwise

Copy link
Copy Markdown
Owner

I'm closing this under the policy in #273 and #286. We're not adding more named gateways to the quickstart; OpenAI-compatible endpoints are already covered by the generic setup. I should've caught that before asking for revisions. No further changes needed.

@Eigenwise Eigenwise closed this Oct 9, 2026
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.

2 participants