#11547

Add Modular as a built-in provider

Opentommyjtlopened 10d ago

What do you want to change?

I'm on the team at Modular that runs Modular Cloud, our hosted inference for open models, with an OpenAI-compatible API at https://api.modular.com/v1. I'd like to add Modular as a built-in provider, so a user only needs MODULAR_API_KEY to pick one of our models in /model.

Our entry is now on models.dev (anomalyco/models.dev#11645), with the four models on our pay-as-you-go API (price per 1M input / output tokens):

  • MiniMax M3.1 Flash (MiniMaxAI/MiniMax-M3.1-Flash): 1M context, $0.15 / $0.60
  • MiniMax M3 (minimax/minimax-m3): 1M context, $0.30 / $1.20
  • DeepSeek V4.1 Flash (deepseek/deepseek-v4.1-flash-1017): 1M context, $0.17 / $1.20
  • Gemma 4 31B (google/gemma-4-31b-it): 256K context, $0.25 / $0.65

The full list of models we serve is at https://docs.modular.com/models.

Why?

Today a Pi user who wants to try us has to write a custom provider by hand and look up model IDs, context limits and prices themselves.

On speed: Artificial Analysis benchmarks every host serving the same model. For MiniMax M3.1 Flash, the newest model we serve, we're currently third of 14 providers on both output speed and time to first answer token. For Gemma 4 31B, we're first of 11 on time to first answer token and second on output speed. Pi goes back to the model after every tool call, so faster responses make a whole session feel more responsive.

We'll also take care of keeping things up to date on our end. Since Pi pulls its models from models.dev, we're keeping our models.dev entry in sync upstream: price changes and retired models sync over automatically (anomalyco/models.dev#11887), and we'll send PRs there whenever we add new models. So there shouldn't be any extra maintenance on the Pi side.

How? (optional)

Same shape as Fireworks and Together with the new provider definitions: a catalog/providers/modular.ts that pulls our models.dev entry with modelsDevModels() on openai-completions (base URL https://api.modular.com/v1), MODULAR_API_KEY auth, a default model, and the docs rows.

The one Modular-specific part is the reasoning controls, which differ per model: MiniMax M3.1 Flash and DeepSeek V4.1 Flash take an effort level (reasoning.effort), while MiniMax M3 and Gemma 4 31B switch reasoning on and off (reasoning.enabled). So each model gets its own thinkingFormat and thinkingLevelMap, which is the setup I tested with.

I've run all four models end to end in Pi 1.4.0 using this as a custom provider, including tool calls, and I'm happy to open the PR.

Thanks for building Pi and for taking a look at this!

Activity

0

No activity yet.