| 30 | const HOSTED_RATE_TOTAL_COST = HOSTED_RATE_INPUT_COST + HOSTED_RATE_OUTPUT_COST |
| 31 | |
| 32 | function makeAnthropicResponse(): ProviderResponse { |
| 33 | // Mirrors the shape produced by Anthropic core for a real BYOK execution |
| 34 | // (gross hosted-rate cost was written into time-segment cost by the trace |
| 35 | // enricher even though the block-level cost should be zeroed for BYOK). |
| 36 | return { |
| 37 | content: 'hello', |
| 38 | model: 'claude-opus-4-6', |
| 39 | tokens: { input: 68057, output: 1548, total: 69605 }, |
| 40 | cost: { |
| 41 | input: HOSTED_RATE_INPUT_COST, |
| 42 | output: HOSTED_RATE_OUTPUT_COST, |
| 43 | total: HOSTED_RATE_TOTAL_COST, |
| 44 | pricing: { input: 5.0, output: 25.0, updatedAt: '2026-04-01' }, |
| 45 | }, |
| 46 | timing: { |
| 47 | startTime: '2026-04-30T21:27:37.878Z', |
| 48 | endTime: '2026-04-30T21:28:19.836Z', |
| 49 | duration: 41958, |
| 50 | timeSegments: [ |
| 51 | { |
| 52 | type: 'model', |
| 53 | name: 'claude-opus-4-6', |
| 54 | startTime: 1777584457878, |
| 55 | endTime: 1777584499836, |
| 56 | duration: 41958, |
| 57 | tokens: { input: 68057, output: 1548, total: 69605 }, |
| 58 | cost: { |
| 59 | input: HOSTED_RATE_INPUT_COST, |
| 60 | output: HOSTED_RATE_OUTPUT_COST, |
| 61 | total: HOSTED_RATE_TOTAL_COST, |
| 62 | }, |
| 63 | }, |
| 64 | ], |
| 65 | }, |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | describe('executeProviderRequest — BYOK regression', () => { |
| 70 | beforeEach(() => { |