ProductReadyProductReady

AI Agent Providers

Switch AI models and providers in one line of code — no config files, no env juggling

AI Agent Providers

Want to switch from GPT to Claude? Try DeepSeek? Run a local model with Ollama? Change one line of code. That's it.

ProductReady bakes the provider choice directly into your app code, so every app can use a different AI without touching environment variables or config files.

Switching Providers

Open src/domains/agent/logic/chat-service.ts and find the 🔧 AGENT PROVIDER CONFIG block:

// ✅ Using GPT-4.1 today
const provider = new AiSdkProvider({
  model: "gpt-4.1",
  apiKey: process.env.OPENAI_API_KEY,
  baseURL: process.env.OPENAI_BASE_URL,
  tools: customTools,
});

// 💡 Want Claude instead? Comment the above, uncomment this:
// const provider = new AiSdkProvider({
//   model: "claude-sonnet-4-20250514",
//   apiKey: process.env.ANTHROPIC_API_KEY,
// });

// 💡 Want to run locally with Ollama? Set OPENAI_BASE_URL=http://localhost:11434/v1
// const provider = new AiSdkProvider({
//   model: "llama3",
//   apiKey: process.env.OPENAI_API_KEY,
// });

Your API keys stay in .env (they're secrets). Everything else — model, provider — lives in code where you can see and version-control it.

Which Provider Should I Use?

Both GaiaAgentProvider and AiSdkProvider are built on the same Vercel AI SDK foundation — same streaming, same resumable streams, same tool calling. The difference is what comes bundled.

GaiaAgentProvider — Start here (default)

GaiaAgentProvider = AI SDK + 16+ built-in tools (web search, code sandbox, browser automation, etc.) via @gaia-agent/sdk. Great when you want a capable agent without wiring up tools yourself.

What you wantModel to useKey needed
Best overall qualitygpt-4.1OPENAI_API_KEY
Fastest / cheapestgpt-5-nanoOPENAI_API_KEY
Run locally, no API costllama3 + Ollama
Cost-effective alternativedeepseek-chatOPENAI_API_KEY + DeepSeek URL

For advanced configuration (custom tools, providers, memory), see the Gaia Agent docs.

AiSdkProvider — When you want full control, or need Anthropic/Google natively

AiSdkProvider = AI SDK directly, only the tools you pass in. Use this when you want a lean setup, or when you need Claude or Gemini via their native SDKs (not OpenAI-compatible).

What you wantModel to useKey needed
Claude (great for writing)claude-sonnet-4-20250514ANTHROPIC_API_KEY
Google Geminigemini-2.0-flashGOOGLE_API_KEY

SandAgentProvider — For apps that execute code

Your agent can actually run code, terminal commands, and file operations inside a secure sandbox. Built on Claude. Great for developer tools, coding assistants, or any app where the AI needs to do things, not just say things.

Not Happy with Any of These? Build Your Own.

The provider interface is just two things: a name and a stream() method. You can wrap LangChain, a custom API, or anything else:

import type { AgentProvider } from "agentlib/providers";

export class MyProvider implements AgentProvider {
  readonly name = "my-provider";

  async stream(messages) {
    // call whatever AI backend you want
    // return an AgentStreamResponse
  }
}

Then drop it into chat-service.ts exactly like the built-in providers.

On this page