Repository navigation
feat(providers): add Inference APIs as OpenAI-compatible provider - #41669
TaylorHawkes wants to merge 5 commits into
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Pushed 940fb4d addressing CI and the Greptile review:
Live before/after proof in the description was re-run at the new tip. |
Registers https://api.inferenceapis.com/v1 as a JSON-configured provider (chat completions and Responses API). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…s index, add request-level tests - provider_create_fields.json entry so the Add Model dropdown test passes - provider_endpoints_support.json (+ backup) entry so the provider docs check passes - tests now capture the outgoing HTTP request (URL, auth header, body) instead of only inspecting registrations - drop a redundant comment Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
940fb4d to
f1bda8c
Compare
…httpx.Client Request-level tests now set litellm.client_session to an httpx.Client with a MockTransport, so nothing is monkeypatched on a class. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011qUBY2P8qTTuJCUeMzTCD4
|
Pushed 2a7c105 for the class-level patching note: the request tests now inject a recording |
| class TestInferenceAPIsRequests: | ||
| def test_completion_sends_request_to_inferenceapis(self, monkeypatch): | ||
| sent = [] | ||
| monkeypatch.setattr(litellm, "client_session", _recording_session(sent)) |
There was a problem hiding this comment.
The OpenAI-like handler replaces this client with its own HTTPHandler, so these unit tests can contact the real provider.
Rule Used: What: prevent any tests from being added here that make real network calls - only mock tests can be added to this folder. Exception: tests/e2e folder, this folder can contain network calls. Why: ensure it runs correctly on github ci/cd + for all d... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| "meta", # Meta Model API (Muse Spark) - JSON-configured provider | ||
| "cognition", | ||
| "scx-ai", | ||
| "inferenceapis", # Inference APIs - JSON-configured provider |
There was a problem hiding this comment.
This comment only restates the entry, violating the repository directive limiting source comments. This requirement must be satisfied before merging.
| "inferenceapis", # Inference APIs - JSON-configured provider | |
| "inferenceapis", |
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011qUBY2P8qTTuJCUeMzTCD4
|
Pushed 0ae0ceb.
|
|
You're right. I rechecked the revised test seam and the provider dispatch: JSON providers default to the Tip: You can customize Greptile's behavior for this repo with |
|
Pushed b7b6adb, a separate 3-line commit:
Same intent as dependabot's #41679. If you would rather keep dependency changes out of this PR, say so and I will drop the commit. |
|
Dropped b7b6adb (the That leaves |
b7b6adb to
0ae0ceb
Compare
TLDR
Problem this solves:
inferenceapis/<model>fails with "LLM Provider NOT provided"openai/plus a customapi_baseHow it solves it:
/v1/chat/completionsand/v1/responsesINFERENCEAPIS_API_KEYUser Flow
Before: a developer with an Inference APIs key cannot call it by provider name
INFERENCEAPIS_API_KEYand calllitellm.completion(model="inferenceapis/meta-llama/Llama-3.3-70B-Instruct-Turbo", ...)BadRequestError: LLM Provider NOT providedlitellm.responses(...)After: the same two calls return answers from https://api.inferenceapis.com/v1
INFERENCEAPIS_API_KEYand calllitellm.completion(model="inferenceapis/meta-llama/Llama-3.3-70B-Instruct-Turbo", ...)litellm.responses(...)with the same model returnsstatus=completedRelevant issues
None.
Pre-Submission checklist
pytest tests/test_litellm/llms/openai_like/test_inferenceapis_provider.py tests/test_litellm/llms/openai_like/test_json_providers.pyandtests/test_litellm/proxy/public_endpoints/test_public_endpoints.pypass (57 passed);check_provider_folders_documented.py,ruff checkandruff format --checkare clean on the changed filesScreenshots / Proof of Fix
Shared setup:
INFERENCEAPIS_API_KEYset to a live key. Script (real calls, no mocks):Before (1dd4c13)
/v1/chat/completions
completioncallBadRequestError: litellm.BadRequestError: LLM Provider NOT provided. Pass in the LLM provider you are trying to call. You passed model=inferenceapis/meta-llama/Llama-3.3-70B-Instruct-Turbo/v1/responses
responsescallBadRequestError: litellm.BadRequestError: LLM Provider NOT provided. Pass in the LLM provider you are trying to call. You passed model=inferenceapis/meta-llama/Llama-3.3-70B-Instruct-TurboAfter (0ae0ceb)
/v1/chat/completions
completioncall[chat] OK content='pong' provider=inferenceapis total_tokens=44/v1/responses
responsescall[responses] OK status=completed output_text=['pong']Tests also capture the outgoing HTTP request (URL,
Authorizationheader, JSON body) for both an explicit key and theINFERENCEAPIS_API_KEY/INFERENCEAPIS_API_BASEenvironment variables.Type
🆕 New Feature
Caveats (if any)
Low
osv-scanfails onsoupsieve 2.8.4inuv.lock. Fork PRs may not modifyuv.lock, so this PR leaves it alone;maincarries the same entry and build(deps): bump soupsieve from 2.8.4 to 2.9.2 #41679 fixes itNo dashboard logo or enum entry added; the UI falls back to the provider slug
Model ids contain a slash, e.g.
inferenceapis/openai/gpt-oss-120b/v1/embeddingsand/v1/rerankexist upstream but are not registered hereNo
model_prices_and_context_window.jsonentries yet; follow-up PR/v1/messagesis not offered by this providerDisclosure: I run this service.
🤖 Generated with Claude Code