Skip to content

feat(llm): add 11 LLM providers (NVIDIA NIM, watsonx.ai, Snowflake Cortex, DeepInfra, Nebius, Baseten, Upstage, Reka, Hyperbolic, FriendliAI, Clarifai) - #941

Merged
AmitoVrito merged 2 commits into
SynapseKit:mainfrom
DhruvGarg111:feat/issue-887-llm-provider-expansion
Aug 29, 2026
Merged

AmitoVrito merged 2 commits into
SynapseKit:mainfrom
DhruvGarg111:feat/issue-887-llm-provider-expansion

Conversation

@DhruvGarg111

Copy link
Copy Markdown
Collaborator

Summary

Adds the 11 LLM providers requested in #887 — eight OpenAI-compatible adapters and three bespoke native async REST integrations.

OpenAI-compatible (lazy AsyncOpenAI client, custom base URLs, streaming + tool calls):
DeepInfra, Nebius AI Studio, Baseten, Upstage Solar, Reka, Hyperbolic, FriendliAI, Clarifai

Bespoke (native httpx.AsyncClient, provider-specific auth):

  • NVIDIA NIM — hosted (integrate.api.nvidia.com) and self-hosted/unauthenticated deployments
  • IBM watsonx.ai — IAM API-key → bearer token exchange, project/space scoping, tool_choice_option tool calling
  • Snowflake Cortex — PAT/JWT bearer + X-Snowflake-Authorization-Token-Type header, documented /api/v2/cortex/v1/chat/completions endpoint

Acceptance mapping (#887)

  • Registered in _factory + top-level lazy exports; extras (nvidia-nim, watsonx, snowflake-cortex, deepinfra, nebius, baseten, upstage, reka, hyperbolic, friendli, clarifai) + lazy imports
  • respx contract tests — streaming and tool-calls where supported; opt-in live smoke tests (skipped without credentials)
  • README provider list + comparison-matrix row (separate provider-page docs PR in the docs repo follows)

Also: BaseLLM.aclose() / async context manager so lazily-created clients release connection pools; cumulative usage accounting; top_p forwarded on all providers.

Verification (local, pre-push)

  • pytest tests/llm — 804 passed, 27 skipped (opt-in live tests)
  • ruff check / ruff format --check — clean
  • mypy — no issues (578 files)
  • deptry src/ — no issues
  • uv lock --check — consistent

Closes #887

Add eight OpenAI-compatible providers (DeepInfra, Nebius AI Studio,
Baseten, Upstage Solar, Reka, Hyperbolic, FriendliAI, Clarifai) reusing
the lazy AsyncOpenAI client pattern, plus three bespoke native async
REST providers with provider-specific auth: NVIDIA NIM (hosted and
self-hosted), IBM watsonx.ai (IAM token exchange), and Snowflake
Cortex (PAT with token-type header).

- Register all providers in the factory and package/top-level lazy exports
- Add provider extras and lockfile metadata (openai>=1.40 / httpx>=0.27)
- Add streaming/SSE, usage accounting, tool-call normalization, top_p
  forwarding, custom endpoints, and async client lifecycle (aclose) on BaseLLM
- Update README provider list and comparison matrix
- respx HTTP contracts for the eight OpenAI-compatible adapters (auth,
  custom base URLs, SSE streaming, usage tracking, tool normalization)
- Bespoke auth/request/SSE/tool-call tests for NVIDIA NIM, watsonx.ai,
  and Snowflake Cortex, including top_p forwarding, cumulative usage,
  and client lifecycle (aclose / async context manager)
- Factory/export contract tests for all 11 providers
- Opt-in live smoke tests gated by SYNAPSEKIT_RUN_LIVE_LLM_TESTS
@AmitoVrito
AmitoVrito merged commit 9cd09f8 into SynapseKit:main Aug 29, 2026
24 checks passed
AmitoVrito added a commit that referenced this pull request Aug 29, 2026
The eight AsyncOpenAI-based providers added in #941 built their client
without passing config.timeout, so a configured per-request timeout was
silently dropped (LLMConfig.timeout documents that it applies to providers
that build their own client). Forward it when set, leaving the SDK default
in place when it is None.

Co-authored-by: Dhruv Garg <[email protected]>
AmitoVrito added a commit that referenced this pull request Aug 29, 2026
AmitoVrito added a commit that referenced this pull request Aug 29, 2026
Eight OpenAI-compatible adapters (DeepInfra, Nebius, Baseten, Upstage,
Reka, Hyperbolic, FriendliAI, Clarifai) plus three bespoke native-async
REST integrations (NVIDIA NIM, IBM watsonx.ai, Snowflake Cortex).

Post-merge review fixed the watsonx streaming endpoint (closes #942),
config.timeout forwarding, IAM token refresh margin, and unguarded
tool-arg json.loads.

Co-authored-by: Dhruv Garg <[email protected]>
@AmitoVrito

Copy link
Copy Markdown
Collaborator

Merged into main 🎉 Thanks @DhruvGarg111 — this is a big, clean expansion (8 OpenAI-compatible + 3 bespoke REST providers, all with contract tests and their own extras).

I folded in four small post-merge fixes during review:

  • watsonx streaming hit the wrong endpoint — stream_with_messages POSTed to /ml/v1/text/chat with a "stream": true body field, but watsonx.ai only streams from the dedicated /ml/v1/text/chat_stream endpoint (stream isn't in the chat schema). The respx mock hid it by serving SSE from the non-stream URL; the streaming contract test now asserts the chat_stream path. (bug(llm): watsonx streaming POSTs to non-streaming /ml/v1/text/chat endpoint #942)
  • OpenAI-compatible providers now forward config.timeout to AsyncOpenAI (was silently dropped).
  • watsonx IAM token refreshes 60s before expiry so a request can't 401 on a token that lapses in flight.
  • watsonx/Cortex/NIM tool-arg parsing now degrades to {} on a malformed json.loads instead of raising.

All four are separate atomic commits crediting you as co-author. Full suite green (5162 passed). Closes #887.

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.

[Epic] LLM provider expansion pack (NVIDIA NIM, watsonx, Cortex, DeepInfra, …)

2 participants