Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/multiagent-textual/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Approval(pydantic.BaseModel):
# Model
# ---------------------------------------------------------------------------

MODEL = ai.get_model("gateway:anthropic/claude-sonnet-4")
MODEL = ai.get_model("gateway:anthropic/claude-sonnet-4.6")


# ---------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/samples/agent_custom_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def loop(self, context: ai.Context) -> AsyncGenerator[ai.events.AgentEvent


async def main() -> None:
model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")

my_agent = CustomAgent()

Expand Down
2 changes: 1 addition & 1 deletion examples/samples/agent_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def contact_mothership(query: str) -> str:


async def main() -> None:
model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")

my_agent = ai.Agent(tools=[contact_mothership])

Expand Down
2 changes: 1 addition & 1 deletion examples/samples/agent_hooks_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async def loop(self, context: ai.Context) -> AsyncGenerator[ai.events.AgentEvent


async def main() -> None:
model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")

my_agent = ApprovalAgent()

Expand Down
2 changes: 1 addition & 1 deletion examples/samples/agent_hooks_serverless.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def audit_log(message: str) -> str:


async def main() -> None:
model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")

my_agent = ai.Agent(tools=[delete_file, audit_log])

Expand Down
2 changes: 1 addition & 1 deletion examples/samples/agent_nested.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import ai

model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")


@ai.tool
Expand Down
2 changes: 1 addition & 1 deletion examples/samples/agent_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async def get_weather(city: str) -> str:


async def main() -> None:
model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")

my_agent = ai.agent(tools=[get_weather])

Expand Down
4 changes: 2 additions & 2 deletions examples/samples/check_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import ai

PROVIDERS: list[tuple[str, ai.Provider, str]] = [
("ai_gateway", ai.get_provider("vercel"), "anthropic/claude-sonnet-4"),
("anthropic", ai.get_provider("anthropic"), "claude-sonnet-4-20250514"),
("ai_gateway", ai.get_provider("vercel"), "anthropic/claude-sonnet-4.6"),
("anthropic", ai.get_provider("anthropic"), "claude-sonnet-4-6"),
("openai", ai.get_provider("openai"), "gpt-5.4-mini"),
]

Expand Down
2 changes: 1 addition & 1 deletion examples/samples/mcp_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


async def main() -> None:
model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")

context7_tools: list[ai.AgentTool] = await ai.mcp.get_http_tools(
"https://mcp.context7.com/mcp",
Expand Down
2 changes: 1 addition & 1 deletion examples/samples/model_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import ai

model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")

messages = [
ai.system_message("Be concise."),
Expand Down
2 changes: 1 addition & 1 deletion examples/samples/multimodal_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import ai

model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")

image_path = pathlib.Path(__file__).parent / "sample_image.jpg"
image_data = image_path.read_bytes()
Expand Down
11 changes: 5 additions & 6 deletions examples/samples/prompt_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

Cache stats are surfaced on ``Stream.usage``:
``cache_write_tokens`` on the first call, ``cache_read_tokens`` on the
second. If the prefix is below the model's minimum (1024 tokens for
Sonnet 4 / 3.7, 2048 for Sonnet 4.6, 4096 for Opus 4.x / Haiku 4.5),
caching silently no-ops — no error, just zeros.
second. Each model has a minimum prefix size below which caching
silently no-ops — no error, just zeros.

See https://vercel.com/docs/ai-gateway/models-and-providers/automatic-caching
"""
Expand All @@ -18,14 +17,14 @@

import ai

model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")

# A NOTE FROM A HUMAN: Opus originally generated this example with a
# system prompt for a "senior incident-response engineer". I told it
# to try something more lighthearted, and it turned it into this.

# Long static prefix — kept well above Sonnet 4's 1024-token minimum so
# the cache breakpoint Anthropic adds actually sticks.
# Long static prefix — kept well above the model's minimum so the
# cache breakpoint Anthropic adds actually sticks.
SYSTEM_PROMPT = """\
You are the Chief Naptime Coordinator for a council of eleven extremely
opinionated house cats. Your job is to mediate disputes between the
Expand Down
2 changes: 1 addition & 1 deletion examples/samples/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import ai

model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")

messages = [
ai.system_message("Be concise."),
Expand Down
2 changes: 1 addition & 1 deletion examples/samples/streaming_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def talk_to_mothership(question: str) -> ai.StreamingStatusTool[str]:


async def main() -> None:
model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")

my_agent = ai.agent(tools=[talk_to_mothership])

Expand Down
2 changes: 1 addition & 1 deletion examples/samples/tools_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import ai

model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")

# Define a schema-only tool.
get_weather = ai.Tool(
Expand Down
4 changes: 2 additions & 2 deletions examples/temporal-direct/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class LLMResult:
@temporalio.activity.defn
async def llm_call_activity(params: LLMParams) -> LLMResult:
"""Call the LLM, drain the stream, return the final message."""
model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")
messages = [ai.messages.Message.model_validate(m) for m in params.messages]
tools = [
ai.Tool(
Expand Down Expand Up @@ -209,7 +209,7 @@ async def _call() -> ai.events.ToolCallResult:
class WeatherWorkflow:
@temporalio.workflow.run
async def run(self, user_query: str) -> str:
model = ai.get_model("gateway:anthropic/claude-sonnet-4")
model = ai.get_model("gateway:anthropic/claude-sonnet-4.6")
messages: list[ai.messages.Message] = [
ai.system_message(
"Answer questions using the weather and population tools."
Expand Down
Loading