Skip to content

feat(cli): add deepinfra to the provider picker and model catalog - #9316

Open
Georgi Atsev (ats3v) wants to merge 2 commits into
crewAIInc:mainfrom
ats3v:feat/deepinfra-cli
Open

Georgi Atsev (ats3v) wants to merge 2 commits into
crewAIInc:mainfrom
ats3v:feat/deepinfra-cli

Conversation

@ats3v

@ats3v Georgi Atsev (ats3v) commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Related issue

Relates to #7455 (closed by #7459, which listed the CLI provider picker as a follow-up).

Summary

Offer DeepInfra in crewai create, in both the classic picker and the JSON crew wizard. crewAI already runs deepinfra/<org>/<model> natively (#7459) and the CLI already knows DEEPINFRA_API_KEY (#9232), so this adds the provider and its models to the lists people pick from.

  • Classic picker (constants.py): deepinfra joins PROVIDERS, with four models in MODELS. Its ENV_VARS entry moves out of the "not offered by the classic picker" group, unchanged.
  • Wizard (create_json_crew.py): DeepInfra joins _PROVIDERS with the same four models as its curated list, so --provider deepinfra resolves to deepinfra/deepseek-ai/DeepSeek-V4.1-Flash.
  • Live models (model_catalog.py): the wizard's picker reads DeepInfra's model list, as it does for OpenAI, Anthropic, Gemini, Groq, Cerebras and Ollama. GET https://api.deepinfra.com/v1/openai/models?filter=with_meta&sort_by=crewai is public, so it works without a key, and returns the catalog in the order DeepInfra ranks it for crewAI. Entries not tagged chat (embeddings, image, speech, video) are dropped and the order is kept. Any failure, or a catalog with no chat model, falls back to the curated list, as for every other vendor.
  • Deploy validation (deploy/validate.py): DEEPINFRA_API_KEY joins _KNOWN_API_KEY_HINTS, so validation warns when a project references the key but .env does not set it, and names DeepInfra in its missing-key warning.

No extra is needed: DeepInfra is one of crewAI's native OpenAI-compatible providers, so a project created with it depends on crewai[tools] alone.

The curated list is the first four chat models of that catalog on 2026-11-10: deepseek-ai/DeepSeek-V4.1-Flash, zai-org/GLM-5.3-Flash, deepseek-ai/DeepSeek-V4-Pro-0813 and zai-org/GLM-5.3. The first is small and generally available, as the default has to be.

Verification

  • Tests added or updated for the changed behavior

  • Relevant tests and quality checks pass locally

  • uv run pytest lib/cli/tests -q - 2246 passed, after uv sync --all-groups --all-extras. No test reaches DeepInfra's catalog: each one that lists DeepInfra models replaces the fetch.

  • New tests: the catalog order is kept and non-chat entries are dropped by tag, with the id heuristic for untagged entries, curated labels win, and an empty or fully filtered catalog falls back to the curated list (test_model_catalog.py); both pickers offer DeepInfra and --provider deepinfra takes the first listed model (test_constants.py); a model picked in the wizard reads deepinfra/<org>/<model> (test_create_crew.py).

  • Updated tests: the providers that need no extra, and the --provider error message that lists the wizard's providers. The existing invariants now cover DeepInfra too: the same models in both pickers, a curated list for every provider, and the extras crewAI needs for each listed model.

  • uv run ruff check, uv run ruff format --check and uv run mypy on the four changed source files - clean

  • live against api.deepinfra.com:

    • with no key set, the wizard's picker lists eight chat models in catalog order in about 1.5 s, the curated four first
    • each of the four curated models answers and makes a tool call through LLM(model="deepinfra/...")
    • CREWAI_DMN=true crewai create crew json_demo --provider deepinfra writes "llm": "deepinfra/deepseek-ai/DeepSeek-V4.1-Flash", depends on crewai[tools] and prints Set DEEPINFRA_API_KEY in .env before `crewai run`
    • crewai create crew classic_demo --classic lists 13. deepinfra and its four models, saves MODEL=deepinfra/deepseek-ai/DeepSeek-V4.1-Flash and names DEEPINFRA_API_KEY when the key prompt is skipped
  • branch rebased on current main

Additional context

The live list follows #6462: the interactive picker shows the vendor's current models, while --provider deepinfra and the classic picker stay on the hardcoded list.

DeepInfra's catalog needs no key, so the wizard fetches it whenever DeepInfra is picked, as it does for a local Ollama. The request carries no credentials, uses the catalog module's 6 s timeout and is cached for five minutes.

Docs are unchanged. The "most popular LLM providers" list in docs/edge/en/concepts/cli.mdx names five of the picker's providers as examples, so DeepInfra is not added there.

We (DeepInfra) maintain the API, the sort_by=crewai ordering and this integration. This is the last follow-up from #7455; the embeddings provider is in #7993.

The code was written with AI assistance (Claude Code), so per CONTRIBUTING the llm-generated label applies - I can't set labels on this repo, please add it.


Note

Low Risk
CLI-only provider listing and optional HTTP catalog fetch; no auth or core runtime changes beyond new picker entries and env hints.

Overview
Adds DeepInfra as a first-class option in both crewai create flows: the classic provider list and the JSON crew wizard now include deepinfra with a shared curated model set (deepinfra/org/model ids), DEEPINFRA_API_KEY env prompting, and no extra beyond crewai[tools].

The wizard’s live model picker now pulls DeepInfra’s public catalog (sort_by=crewai), keeps server ordering, drops non-chat entries via metadata tags, and falls back to the curated list when the fetch fails or has no chat models.

Deploy validation recognizes DEEPINFRA_API_KEY in missing-key warnings. Tests cover picker parity, catalog filtering/order, and wizard model id formatting.

Reviewed by Cursor Bugbot for commit a92f209. Bugbot is set up for automated code reviews on this repo. Configure here.

@strix-security

strix-security Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Strix Security Review

Warning

This pull request has 74 commits after the last Strix review (917e8da). Strix has not reviewed these changes.
Automatic review on push is off for this repository. To review the latest changes, tag @strix-security in a comment, or turn on re-review on push.

✅ No open security findings.

PR summary: Adds DeepInfra to the classic `crewai create` picker and the JSON crew wizard with four curated models, and extends the wizard's live model catalog to fetch DeepInfra's public model list, plus the `DEEPINFRA_API_KEY` hint for deploy validation.

Review summary

This PR registers DeepInfra in both CLI provider pickers and adds a keyless live fetch of DeepInfra's public model catalog, with non-chat entries filtered by tag and fallback to the curated list. The new fetch uses a hardcoded, TLS-verified HTTPS URL, sends no credentials, is bounded by the module's timeout, and its results are cached; picked model ids are only ever written as text into JSON-escaped config and an .env line, and no shell, template or path sink is reachable from them. The remaining provider wiring is literal table entries consumed by existing, already-covered code paths. No security issues were confirmed.

Ruled out (2)
  • Can a catalog-supplied model id inject terminal escape sequences into the interactive model picker?
    The picker renders labels raw, but the only producer is a fixed, TLS-verified vendor catalog that carries no request input, the same unsanitized rendering already applies to six pre-existing providers, and the live catalog's ids are plain org/model slugs.
  • Can a catalog-supplied model id inject extra lines into the generated project `.env` through the unquoted `MODEL=` write?
    The unquoted write exists but the value comes only from the hardcoded, credential-free, TLS-verified DeepInfra endpoint the user explicitly chose, and the pre-existing Ollama fetcher already feeds a configurable host's model names into the same sink.

Review 1 on this PR · 917e8da · requested Nov 10 08:18 UTC when the PR was opened


Reviewed by Strix
Re-run review · Configure security review settings

@iris-clawd iris-clawd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I could not confirm the minimum released runtime version.

The notes inline on model_catalog.py and test_model_catalog.py are what I'd want addressed before this merges.

Someone else should sign off on this too: the change expands the user-visible CLI provider contract and establishes a new default model for --provider deepinfra, which is persisted into generated project configuration.

Comment thread lib/cli/src/crewai_cli/model_catalog.py Resolved
Comment thread lib/cli/tests/test_model_catalog.py Resolved
Offer DeepInfra in crewai create, fetch live models from DeepInfra's public
catalog ranked for CrewAI without an API key, keep only chat-tagged entries,
and recognise DEEPINFRA_API_KEY in deploy validation.
An empty or fully filtered DeepInfra catalog was treated like a reachable
Ollama with nothing installed, so the wizard dropped the curated models and
asked for a model id. The hosted models stay usable, so the fetch now
raises and the picker falls back to the curated list.
@ats3v

Copy link
Copy Markdown
Contributor Author

João Moura (@joaomdmoura) could you re-run the review gate here? Its notes are addressed: an empty catalog now falls back to the curated models, with tests for it. CI is green. The gate also asked for a second sign-off. Thanks!

This branch has not been deployed

No deployments
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