The same call in Gemini and Claude
Multi-provider literacy is a 2026 must. Outages, price changes, and capability differences all favor engineers who can swap providers in an hour, not a month.
Three taxi apps in your city. The button is in slightly different places but the trip is the same. You should not become loyal to one because of the button.
All three APIs follow the same pattern with slight syntactic differences. The mental model is identical: messages in, response out, usage tracked.
Google Gemini:
import os
from google import genai
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="Explain RAG to a beginner in 2 sentences.",
)
print(response.text)
Anthropic Claude:
import os
from anthropic import Anthropic
client = Anthropic()
message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=200,
system="You are a tutor. Reply in 2 sentences.",
messages=[{"role": "user", "content": "Explain RAG to a beginner."}],
)
print(message.content[0].text)
Key differences:
| Aspect | OpenAI | Gemini | Anthropic |
|---|---|---|---|
| SDK name | openai | google-genai | anthropic |
| System message | role in messages | system_instruction | top-level system param |
| Response access | .choices[0].message.content | .text | .content[0].text |
| Streaming | yes | yes | yes |
| JSON Schema | yes | yes | yes (tools) |
Quick recall
3 prompts · think before you flip
Prompt 1 of 3
Where does Claude take the system instruction?
Quiz time
1 question · tap an answer to check it
1. Anthropic Claude's system instruction is sent as
Finished lesson 5.4?
Mark complete to update your module progress and unlock the streak.