research: evaluate GPT-4.1 Mini via SAM AI Gateway#913
Merged
simple-agent-manager[bot] merged 3 commits intomainfrom May 6, 2026
Merged
research: evaluate GPT-4.1 Mini via SAM AI Gateway#913simple-agent-manager[bot] merged 3 commits intomainfrom
simple-agent-manager[bot] merged 3 commits intomainfrom
Conversation
Run focused experiment against gpt-4.1-mini through SAM's existing AI Gateway (/openai path with cf-aig-authorization / Unified Billing). Compare tool-call behavior, token efficiency, latency, and response shape against the merged Gemma 4 26B baseline. Key findings: - Two-tool loop PASS with tool_choice: "auto" (zero workarounds) - 1.9x more token-efficient than Gemma 4 (606 vs 1,159 tokens) - ~1.5x faster latency (~2.6s vs ~4.0s total) - No reasoning field (unlike Gemma's free CoT traces) - gpt-4.1-nano NOT recommended (duplicate tool calls observed) - Validates existing SAM proxy code path works without changes - Unified Billing required (cf-aig-authorization header) Recommendation: keep Gemma 4 as free default, add GPT-4.1 Mini as paid fallback tier for latency/efficiency-sensitive workloads. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
low-costWorkers AI tier with current per-token costs.Findings
reasoningfieldRecommendation: Keep Gemma 4 as the low-cost default and continue evaluating small OpenAI fallbacks. GPT-4.1 Mini is strong for latency/efficiency-sensitive workloads; GPT-5 Mini is the next cost-aligned candidate to test. GPT-4.1 Nano is not recommended because duplicate tool calls were observed.
Test Evidence
content: nullhandling (works, native OpenAI format)pnpm --filter @simple-agent-manager/shared test -- ai-model-registrypnpm --filter @simple-agent-manager/api test -- ai-proxypnpm --filter @simple-agent-manager/web typecheckpnpm exec playwright test tests/playwright/admin-ai-proxy-audit.spec.tsSpecialist Review Evidence
Staging
deploy-staging.ymlrun25413180777from branchsam/use-skill-continue-sam-01kqx7.GET https://api.sammy.party/api/admin/ai-proxy/configreturns Workers AI models withtier: "low-cost"and nonzero per-1K token costs; Gemma 4 returns0.0001input /0.0003output.Agent Preflight (Required)
Classification
External References
Official documentation consulted for current pricing before changing metadata:
Codebase Impact Analysis
Cross-component impact is limited to pricing/tier metadata and surfaces that display or test it:
packages/shared/src/constants/ai-services.ts,packages/shared/tests/unit/ai-model-registry.test.ts,apps/api/tests/unit/routes/ai-proxy.test.ts,apps/web/src/lib/api/admin.ts,apps/web/src/pages/AdminAIProxy.tsx, andapps/web/tests/playwright/admin-ai-proxy-audit.spec.ts.Documentation & Specs
Updated harness and architecture docs that previously described Workers AI/Gemma as free:
experiments/ai-gateway-tool-call/FINDINGS.md,experiments/ai-gateway-tool-call/FINDINGS-gemma.md,experiments/ai-gateway-tool-call/FINDINGS-openai.md, anddocs/architecture/agent-harness-integration.md.Constitution & Risk Check
Checked Principle XI for hardcoded values risk. Pricing metadata remains centralized in the platform model registry and is explicitly approximate for budget estimation, with actual usage expected from AI Gateway logs. Risk is pricing staleness, mitigated by documenting official sources and updating tests to prevent future zero-cost Workers AI assumptions.