Recipes AI Prompt

AI Prompt (Multi-Provider)

Full Screen Demo

A single prompt endpoint that talks to OpenAI, Anthropic, Google or Perplexity by changing one string.

The trick: ReqLLM.generate_text/3 accepts a provider:model spec like openai:gpt-4o-mini or anthropic:claude-haiku-4-5-20251001. Swap providers without rewriting the call site.

The demo below is rude on purpose. Channel your inner 10 year old, then read the code.

Why this matters

  • One call site. Any LLM. Swap openai:gpt-4o-mini for anthropic:claude-haiku-4-5-20251001 without touching the call.
  • A/B test models in production by toggling a config value — useful when a provider has an outage.
  • Wraps cleanly into a Jido.Action if you want tool calling — see the tool calling recipe.