Skip to content

Commit 96b70fe

Browse files
authored
chore(ai): use Claude 5.5 models throughout (#608)
1 parent bf9e5f7 commit 96b70fe

11 files changed

Lines changed: 26 additions & 21 deletions

File tree

‎layers/identity/server/tasks/send-digests.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { renderDigest } from '../utils/digest-template'
1717
import { sendEmailWithEnv, signUnsubToken } from '../utils/email'
1818

1919
const CRON = '0 9 1 * *'
20-
// Kill switch: the per-repo digest sentence runs `anthropic/claude-haiku-4.5`,
20+
// Kill switch: the per-repo digest sentence runs `anthropic/claude-sonnet-5.5`,
2121
// a partner model brokered through the Workers AI binding, so every call bills
2222
// against AI Gateway credits. Those credits are exhausted, so each monthly run
2323
// returned `provider_failure: 2021: Insufficient AI Gateway credits`, delivered

‎layers/identity/server/utils/digest-summary.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ export interface AiBinding {
1515
messages: Array<{ role: 'user' | 'assistant', content: string }>
1616
max_tokens: number
1717
system?: string
18-
temperature?: number
18+
thinking?: { type: 'between_tools' }
1919
}) => Promise<unknown>
2020
}
2121

22-
// Anthropic Haiku 4.5 brokered through Workers AI. The binding handles auth;
22+
// Anthropic Sonnet 5.5 brokered through Workers AI. The binding handles auth;
2323
// no Anthropic key or gateway token needed. Swap to a llama/qwen if cost or
2424
// latency need to drop later — caller doesn't care which model produced
2525
// `response`.
26-
const MODEL = 'anthropic/claude-haiku-4.5'
26+
const MODEL = 'anthropic/claude-sonnet-5.5'
2727

2828
export interface SubscriptionContext {
2929
owner: string
@@ -133,6 +133,7 @@ Output JSON only, no prose, with this exact shape:
133133
system: systemPrompt,
134134
messages: [{ role: 'user', content: userPrompt }],
135135
max_tokens: 1024,
136+
thinking: { type: 'between_tools' },
136137
}).then(
137138
value => ({ _tag: 'response' as const, value }),
138139
error => ({

‎layers/registry/server/jobs/generate-faqs.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export async function generateFaqs(ctx: FaqContext, skill: FaqSkill): Promise<Fa
7373
if (items.length < 3)
7474
return null
7575

76-
const payload: FaqPayload = { items: items.slice(0, 6), model: 'claude-haiku-4-5-20251001' }
76+
const payload: FaqPayload = { items: items.slice(0, 6), model: 'claude-haiku-5-5' }
7777

7878
await putGenerated(ctx.db, {
7979
owner: skill.owner,

‎layers/registry/server/jobs/generate-summary.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export async function generateSummary(ctx: SummaryContext, skill: SummarySkill):
8787
tagline: tagline.slice(0, 140),
8888
blurb: blurb.slice(0, 400),
8989
useCases,
90-
model: 'claude-haiku-4-5-20251001',
90+
model: 'claude-haiku-5-5',
9191
}
9292

9393
await putGenerated(ctx.db, {

‎layers/registry/server/jobs/generate-tags.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export async function generateTags(ctx: TagContext, skill: TagSkill): Promise<Ta
6464
if (!tags.length)
6565
return null
6666

67-
const payload: TagPayload = { tags, model: 'claude-haiku-4-5-20251001' }
67+
const payload: TagPayload = { tags, model: 'claude-haiku-5-5' }
6868

6969
await putGenerated(ctx.db, {
7070
owner: skill.owner,

‎layers/registry/server/tasks/ai-generate-poll.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ interface BatchResultLine {
3939
}
4040
}
4141

42-
// Haiku 4.5 batch pricing per million tokens (50% discount off realtime).
43-
const HAIKU_BATCH_INPUT_USD_PER_MTOK = 0.50
44-
const HAIKU_BATCH_OUTPUT_USD_PER_MTOK = 2.50
42+
// Haiku 5.5 batch pricing per million tokens for prompts under 100k tokens.
43+
const HAIKU_BATCH_INPUT_USD_PER_MTOK = 0.05
44+
const HAIKU_BATCH_OUTPUT_USD_PER_MTOK = 0.25
4545

4646
interface BatchStatusResponse {
4747
id: string

‎layers/registry/server/tasks/ai-generate-submit.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const BATCH_LIMIT = 50
3838
// ceiling observed in production; wall time goes 7s → ~18s, still well
3939
// under the scheduled-handler budget.
4040
const AI_CONCURRENCY = 3
41-
const HAIKU_MODEL = 'claude-haiku-4-5-20251001'
41+
const HAIKU_MODEL = 'claude-haiku-5-5'
4242
// Kill switch: pause Anthropic Haiku batch spend while we investigate the
4343
// scaled-content-abuse deindexing (10k AI pages → 0.6% indexed, sitewide
4444
// demotion late Apr 2026). Embeddings/abstractness (Workers AI, ~free) keep
@@ -265,6 +265,7 @@ async function runSubmit(db: D1Database, ai: AiBinding | undefined, vectorize: V
265265
params: {
266266
model: HAIKU_MODEL,
267267
max_tokens: kind === 'faq' ? 1024 : kind === 'tags' ? 256 : 512,
268+
thinking: { type: 'disabled' },
268269
system: [{
269270
type: 'text',
270271
text: SHARED_SYSTEM_PROMPT,

‎layers/registry/server/utils/ai-prompts.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Anthropic's prompt caching (5-min ephemeral TTL) materially cuts cost when
44
* a batch submits dozens of skills in one request.
55
*
6-
* Three derivation kinds run through Haiku 4.5 Batch API:
6+
* Three derivation kinds run through Haiku 5.5 Batch API:
77
* - `summary` plain text, 2-3 sentences
88
* - `tags` JSON array of 5-10 lowercase tags
99
* - `faq` JSON array of 3-5 { question, answer } objects

‎shared/server/anthropic.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { spawn } from 'node:child_process'
1616
const ANTHROPIC_URL = 'https://api.anthropic.com/v1/messages'
1717
const ANTHROPIC_VERSION = '2023-06-01'
1818

19-
export type HaikuModel = 'claude-haiku-4-5-20251001'
19+
export type HaikuModel = 'claude-haiku-5-5'
2020

2121
export interface ClaudeUsage {
2222
input_tokens: number
@@ -61,7 +61,7 @@ export async function callHaikuApi(opts: CallHaikuOpts & { apiKey: string }): Pr
6161
systemPrompt,
6262
userPrompt,
6363
apiKey,
64-
model = 'claude-haiku-4-5-20251001',
64+
model = 'claude-haiku-5-5',
6565
maxTokens = 1024,
6666
cacheSystem = true,
6767
} = opts
@@ -80,6 +80,7 @@ export async function callHaikuApi(opts: CallHaikuOpts & { apiKey: string }): Pr
8080
body: JSON.stringify({
8181
model,
8282
max_tokens: maxTokens,
83+
thinking: { type: 'disabled' },
8384
system,
8485
messages: [{ role: 'user', content: userPrompt }],
8586
}),
@@ -105,7 +106,7 @@ export async function callHaikuApi(opts: CallHaikuOpts & { apiKey: string }): Pr
105106
* so we can read structured usage info. Returns the same shape as the API call.
106107
*/
107108
export async function callHaikuCli(opts: CallHaikuOpts): Promise<ClaudeTextResponse> {
108-
const { systemPrompt, userPrompt, model = 'claude-haiku-4-5-20251001' } = opts
109+
const { systemPrompt, userPrompt, model = 'claude-haiku-5-5' } = opts
109110

110111
// CC wraps/injects its own framing around --system-prompt, so Haiku tends
111112
// to stay conversational. For batch jobs we fold the system prompt into the

‎workers/skill-harness/src/gateway.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ export async function forwardSandboxRequest(
9090
if (!await options.consumeModelCall())
9191
return Response.json({ code: 'MODEL_CALL_LIMIT' }, { status: 403 })
9292
const standardInput = { ...input }
93-
delete standardInput.speed
93+
for (const field of ['speed', 'temperature', 'top_p', 'top_k'])
94+
delete standardInput[field]
9495
const thinking = input.thinking && typeof input.thinking === 'object' && 'type' in input.thinking && input.thinking.type === 'enabled'
95-
? { type: 'enabled', budget_tokens: 2048 }
96+
? { type: 'adaptive' }
9697
: input.thinking
9798
return fetchClient('https://api.anthropic.com/v1/messages', {
9899
method: 'POST',

0 commit comments

Comments
 (0)