|
52 | 52 | - [Per-Request Customization](#per-request-customization) |
53 | 53 | - [LLM Providers](#llm-providers) |
54 | 54 | - [Anthropic Messages API](#anthropic-messages-api) |
| 55 | + - [Google Gemini](#google-gemini) |
55 | 56 | - [OpenAI Responses API](#openai-responses-api) |
56 | 57 | - [ChatGPT Subscription (OAuth)](#chatgpt-subscription-oauth) |
57 | 58 | - [Proxy Mode](#proxy-mode) |
@@ -459,10 +460,10 @@ let client = OpenAIClient( |
459 | 460 | reasoningConfig: .high |
460 | 461 | ) |
461 | 462 |
|
462 | | -// Via OpenAI Responses API (native reasoning with GPT-5.2) |
| 463 | +// Via OpenAI Responses API (native reasoning with GPT-5.4) |
463 | 464 | let client = ResponsesAPIClient( |
464 | 465 | apiKey: apiKey, |
465 | | - model: "gpt-5.2", |
| 466 | + model: "gpt-5.4", |
466 | 467 | baseURL: ResponsesAPIClient.openAIBaseURL, |
467 | 468 | reasoningConfig: .medium |
468 | 469 | ) |
@@ -1303,14 +1304,31 @@ The header closure is evaluated per request, enabling dynamic values. |
1303 | 1304 |
|
1304 | 1305 | </details> |
1305 | 1306 |
|
| 1307 | +### Google Gemini |
| 1308 | + |
| 1309 | +`GeminiClient` speaks the [Gemini REST API](https://ai.google.dev/api/generate-content) natively — thinking, tool calling, structured output, and streaming. |
| 1310 | + |
| 1311 | +```swift |
| 1312 | +let client = GeminiClient( |
| 1313 | + apiKey: ProcessInfo.processInfo.environment["GEMINI_API_KEY"]!, |
| 1314 | + model: "gemini-3.1-pro-preview", |
| 1315 | + reasoningConfig: .high |
| 1316 | +) |
| 1317 | + |
| 1318 | +let agent = Agent<EmptyContext>(client: client, tools: [myTool]) |
| 1319 | +let result = try await agent.run(userMessage: "Analyze this data", context: EmptyContext()) |
| 1320 | +``` |
| 1321 | + |
| 1322 | +Works with any Gemini model — 2.5 Flash, 2.5 Pro, 3 Flash, 3.1 Pro, 3.1 Flash-Lite, and the `customtools` variant. Thinking budget and effort levels map to Gemini's native `thinkingConfig`. |
| 1323 | + |
1306 | 1324 | ### OpenAI Responses API |
1307 | 1325 |
|
1308 | 1326 | `ResponsesAPIClient` speaks OpenAI's [Responses API](https://platform.openai.com/docs/api-reference/responses) — a newer endpoint with native support for reasoning models, server-side conversation state, and structured tool calling. |
1309 | 1327 |
|
1310 | 1328 | ```swift |
1311 | 1329 | let client = ResponsesAPIClient( |
1312 | 1330 | apiKey: ProcessInfo.processInfo.environment["OPENAI_API_KEY"]!, |
1313 | | - model: "gpt-5.2", |
| 1331 | + model: "gpt-5.4", |
1314 | 1332 | baseURL: ResponsesAPIClient.openAIBaseURL, |
1315 | 1333 | reasoningConfig: .medium |
1316 | 1334 | ) |
@@ -1341,7 +1359,7 @@ let auth = try JSONDecoder().decode(CodexAuth.self, from: authData) |
1341 | 1359 |
|
1342 | 1360 | // 2. Create client pointing at ChatGPT backend |
1343 | 1361 | let client = ResponsesAPIClient( |
1344 | | - model: "gpt-5.2", |
| 1362 | + model: "gpt-5.4", |
1345 | 1363 | maxOutputTokens: nil, // not supported on this endpoint |
1346 | 1364 | baseURL: ResponsesAPIClient.chatGPTBaseURL, |
1347 | 1365 | additionalHeaders: { |
@@ -1369,7 +1387,7 @@ The ChatGPT backend enforces specific constraints: |
1369 | 1387 | | `max_output_tokens` | Not supported — set `maxOutputTokens: nil` | |
1370 | 1388 | | `instructions` | Required — always provide a system prompt | |
1371 | 1389 |
|
1372 | | -Reasoning models (GPT-5.2, GPT-5.2-codex) work fully, including interleaved thinking with opaque reasoning block echo-back across tool-calling turns. |
| 1390 | +Reasoning models (GPT-5.4, GPT-5.3-Codex) work fully, including interleaved thinking with opaque reasoning block echo-back across tool-calling turns. |
1373 | 1391 |
|
1374 | 1392 | ### Proxy Mode |
1375 | 1393 |
|
@@ -1472,8 +1490,9 @@ The client bridges `AnyTool` definitions to Apple's `Tool` protocol at runtime v |
1472 | 1490 | |------|-------------| |
1473 | 1491 | | `LLMClient` | Protocol for LLM implementations | |
1474 | 1492 | | `AnthropicClient` | Anthropic Messages API client (Claude Sonnet, Opus, Haiku) | |
| 1493 | +| `GeminiClient` | Google Gemini API client (2.5 Flash/Pro, 3 Flash, 3.1 Pro/Flash-Lite) | |
1475 | 1494 | | `OpenAIClient` | Chat Completions client (OpenAI, OpenRouter, Groq, etc.) | |
1476 | | -| `ResponsesAPIClient` | OpenAI Responses API client (GPT-5.2, GPT-5.2-codex) | |
| 1495 | +| `ResponsesAPIClient` | OpenAI Responses API client (GPT-5.4, GPT-5.3-Codex) | |
1477 | 1496 | | `MLXClient` | On-device inference via MLX on Apple Silicon (Qwen 3.5, Liquid LFM2.5, etc.) | |
1478 | 1497 | | `FoundationModelsClient` | On-device inference via Apple Foundation Models (iOS 26+ / macOS 26+) | |
1479 | 1498 | | `ThinkTagParser` | Streaming `<think>` tag parser with configurable delimiters | |
|
0 commit comments