feat(providers): add DeepInfra as a built-in inference provider#1902
feat(providers): add DeepInfra as a built-in inference provider#1902mmilutinovic371 wants to merge 4 commits into
Conversation
…nly) - Adds `deepinfra` as a built-in Providers v2 profile (`providers/deepinfra.yaml`) with inference category, Bearer auth, and `DEEPINFRA_API_KEY` discovery - Adds `DEEPINFRA_PROFILE` to inference routing so `inference.local` works with the `deepinfra` provider type - Fixes `build_backend_url` to strip `/v1` from request paths when the base URL contains `/v1/` as an internal segment (e.g. `api.deepinfra.com/v1/openai`), preventing double-versioned paths like `.../v1/openai/v1/chat/completions` - Updates `docs/sandboxes/providers-v2.mdx` and `docs/sandboxes/manage-providers.mdx` with DeepInfra entries; removes the old v1 workaround row that used `openai` type with `OPENAI_API_KEY` Signed-off-by: Milos Milutinovic <codemastermilos@gmail.com>
PR Review StatusValidation: This PR is project-valid for OpenShell because it is concentrated Providers v2/inference work with a clear user path, dedicated DeepInfra credentials, provider policy metadata, tests, and docs updates. Review findings:
Docs: Updated on existing Fern pages under Next state: |
- Narrow build_backend_url /v1 dedupe to URLs whose path component is exactly /v1 or starts with /v1/ — prevents regression on proxy endpoints where /v1 is buried deeper (e.g. /api/v1/openai); add regression test for the nested proxy path case - Add deepinfra provider plugin with DEEPINFRA_API_KEY discovery, registered in ProviderRegistry so known_types() and TUI include it - Add deepinfra to unsupported-inference-provider error message in openshell-server for accurate user-facing debugging guidance - Add deepinfra to openai_compatible_profiles_include_embeddings test to lock in the OpenAI-compatible protocol contract Signed-off-by: Milos Milutinovic <codemastermilos@gmail.com>
|
All four gator review findings addressed in 1c3fc5b:
|
Re-check After Author UpdateI re-evaluated latest head Disposition: partially resolved. Remaining items:
Resolved from the prior review:
Next state: |
Extends the /v1 deduplication logic to also strip /v1 from request paths when the base URL's path ends with /v1 (e.g. https://api.groq.com/openai/v1). The previous fix only matched paths starting with /v1/, which regressed providers like Groq whose base path has /v1 as the last segment rather than the first. The nested-proxy exclusion (e.g. /api/v1/openai) is preserved since /v1 appears in the middle — neither first nor last segment. Adds a regression test for the Groq-style base URL. Signed-off-by: Milos Milutinovic <codemastermilos@gmail.com>
|
Addressed in ce0ccda. The root cause: the path-rooted check ( Fix: dedup when the base URL's path starts with Regression test |
Re-check After Author UpdateI re-evaluated latest head Disposition: partially resolved. Resolved items:
Remaining items:
Non-blocking docs note:
Next state: |
…t test - Add DeepInfra variant to ProviderProfile telemetry enum and from_raw() mapping so deepinfra providers are tracked in their own bucket rather than falling through to Custom - Map deepinfra in telemetry_provider_profile() in openshell-server - Add deepinfra to list_provider_profiles_returns_built_in_profile_categories test (sorted between cursor and github) - Update architecture/gateway.md inference provider list to include deepinfra Signed-off-by: Milos Milutinovic <codemastermilos@gmail.com>
|
Addressed in d4e5e98:
|
Re-check After Author UpdateI re-evaluated latest head Disposition: resolved. Remaining items:
Review: The independent reviewer found no blocking findings at this head. The only follow-up was a non-blocking suggestion to add a focused DeepInfra telemetry assertion. Docs: Fern docs under E2E: I applied Next state: |
|
/ok to test d4e5e98 |
|
Label |
Pipeline FailureHead SHA:
Next action: @mmilutinovic371, please run |
Summary
DeepInfra is one of the top open source LLM providers and a perfect fit for agent frameworks with its low cost and high performance. This PR promotes it from a documented workaround to a core built-in provider in OpenShell using Providers v2.
deepinfraas a built-in Providers v2 profile withDEEPINFRA_API_KEYdiscoverydeepinfraas a built-in inference provider alongsidenvidia,openai, andanthropicDEEPINFRA_API_KEYis now discovered automatically via--from-existing(through the v2 profilediscoverysection)openshell provider list-profilesshows DeepInfra in the INFERENCE sectionbuild_backend_urlto correctly strip/v1from request paths when the provider base URL contains/v1/as an internal path segment (e.g.https://api.deepinfra.com/v1/openai) — without this fix, requests were routed to.../v1/openai/v1/chat/completions(404) instead of.../v1/openai/chat/completionsRelated Issue
N/A
Changes
providers/deepinfra.yaml— new built-in Providers v2 profile (inference category,api.deepinfra.com:443, Bearer auth,DEEPINFRA_API_KEY)crates/openshell-core/src/inference.rs—DEEPINFRA_PROFILE, normalization,profile_forentries + tests;deepinfraadded toopenai_compatible_profiles_include_embeddingscrates/openshell-router/src/backend.rs— URL construction fix narrowed to path-rooted/v1check; regression test for nested proxy path addedcrates/openshell-providers/src/profiles.rs— registration ofdeepinfra.yamlin built-in profile catalogcrates/openshell-providers/src/providers/deepinfra.rs— new provider discovery plugin (DEEPINFRA_API_KEY, discovery test)crates/openshell-providers/src/providers/mod.rs— module declaration fordeepinfracrates/openshell-providers/src/lib.rs— registersdeepinfrainProviderRegistrysoknown_types()and TUI include itcrates/openshell-server/src/inference.rs— addsdeepinfrato unsupported-type error messagedocs/sandboxes/providers-v2.mdx— DeepInfra row in built-in profiles tabledocs/sandboxes/manage-providers.mdx— DeepInfra rows (provider types + inference providers); removes old v1 workaround row that usedopenaitype withOPENAI_API_KEYTesting
mise run pre-commitpasses (rust, helm, markdown, license;python:protois a pre-existing failure unrelated to this PR)openshell-core,openshell-providers,openshell-router(cargo test -p openshell-core -p openshell-providers -p openshell-router)openshell provider list-profilesshowsdeepinfrain INFERENCE sectionopenshell provider create --name di --type deepinfra --from-existingdiscoversDEEPINFRA_API_KEYopenshell inference set --provider di --model <model> --no-verifyconfigures routecurl https://inference.local/v1/chat/completionsfrom inside sandbox returns a valid completion from DeepInfraUnit test results
Includes
inference::tests::profile_for_deepinfra,inference::tests::openai_compatible_profiles_include_embeddings(coversdeepinfra),backend::tests::build_backend_url_dedupes_v1_for_base_with_v1_subpath,backend::tests::build_backend_url_preserves_v1_for_nested_proxy_path, andproviders::deepinfra::tests::discovers_deepinfra_env_credentials.Checklist
docs/sandboxes/providers-v2.mdx,docs/sandboxes/manage-providers.mdx)