What You’ll Learn
How to run the exact same goal with three different providers. The model construction changes, butAgentClient usage is identical.
The Pattern
Provider-specific code is isolated to model construction. Everything afterAgentClient.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:AgentClient doesn’t know or care which provider is behind it.
Provider Differences
While the client API is portable, providers have different capabilities:| Capability | Claude | Codex | Gemini |
|---|---|---|---|
| Non-git directory | Works | Works (skipGitCheck=true) | Works |
| Structured output | JSON Schema | Not supported | Not supported |
| Session resume | Supported | Not supported | Not supported |
| Permission modes | Multiple | full-auto only | yolo only |
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
- Switching Providers — The Spring Boot profile pattern for zero-code provider switching
- Configuration Reference — All configuration options across providers
- Defaults Philosophy — Why LOOSE mode exists and how it affects each provider