Skip to main content

What You’ll Learn

How to run the exact same goal with three different providers. The model construction changes, but AgentClient usage is identical.

The Pattern

Provider-specific code is isolated to model construction. Everything after AgentClient.create(model) is portable:

Step 1: Run with Claude

Step 2: Run with Codex

Swap the model — the client code is identical:
skipGitCheck(true) lets Codex work in any directory. Without it, Codex requires a git repository. See Codex Reference for details.

Step 3: Run with Gemini

What Stayed the Same

Across all three providers, these two lines are identical:
The only difference is which model you construct. That’s the portable API — AgentClient doesn’t know or care which provider is behind it.

Provider Differences

While the client API is portable, providers have different capabilities:

With Spring Boot

In Spring Boot applications, you don’t construct models manually. Use starter dependencies and Maven profiles to switch providers without changing code at all — see the Switching Providers how-to guide.

Next Steps