Skip to content

feat: add Cheaper Inference as AI provider - #149

Merged
recabasic merged 1 commit into
CaviraOSS:mainfrom
aiapienthusiast:cheaperinference-provider
Sep 30, 2026
Merged

recabasic merged 1 commit into
CaviraOSS:mainfrom
aiapienthusiast:cheaperinference-provider

Conversation

@aiapienthusiast

Copy link
Copy Markdown
Contributor

📋 Description

This PR adds Cheaper Inference as an LLM provider in the backend.
It uses the same pattern as #147 (Requesty).

Cheaper Inference is an OpenAI-compatible LLM gateway.
One API key gives access to models from several labs.

Usage:

LLM_PROVIDER=cheaperinference
CHEAPER_INFERENCE_API_KEY=ci_live_...
CHEAPER_INFERENCE_MODEL=gpt-5.4-mini

Embeddings use the OpenAI settings, like the MiniMax provider.

Details

Files:

  • backend/src/utils/llm/models/cheaperinference.ts: new provider. It uses ChatOpenAI with base URL https://api.cheaperinference.com/v1.
  • backend/src/utils/llm/models/index.ts: add the cheaperinference case.
  • backend/src/config/env.ts: read CHEAPER_INFERENCE_API_KEY, CHEAPER_INFERENCE_MODEL, CHEAPER_INFERENCE_BASE_URL.
  • backend/src/utils/llm/models/__tests__/cheaperinference.test.ts: new unit test with a mocked @langchain/openai.
  • .env.example, README.md: document the provider.

Tests:

  • npx vitest run: 7 files passed, 1 skipped (41 tests passed, 3 skipped).
  • npm run build: pass.
  • The unit test uses mocks.
  • Live check: gpt-5.4-mini returned a reply through makeModels() with LLM_PROVIDER=cheaperinference.

🔄 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🎨 Style/UI changes
  • ♻️ Code refactoring
  • ⚡ Performance improvements
  • 🧪 Test updates
  • 🔧 Build/CI changes

🧪 Testing

  • I have tested this change locally
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

📱 Screenshots (if applicable)

Not applicable. No UI change.

🔍 Code Review Checklist

  • Code follows the project's coding standards
  • Self-review of the code has been performed
  • Code is properly commented, particularly in hard-to-understand areas
  • Changes generate no new warnings
  • Any dependent changes have been merged and published

📚 Related Issues

None.

🚀 Deployment Notes

No change for current users.
The provider is active only with LLM_PROVIDER=cheaperinference.

📋 Additional Context

Keys: https://cheaperinference.com/signup

@recabasic
recabasic merged commit 6abbf02 into CaviraOSS:main Sep 30, 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