promptdojo_

Write estimate_call_cost(prompt, expected_output, in_rate, out_rate) that:

  • Uses the estimate_tokens helper (chars / 4) to convert both strings to token counts.
  • Applies in_rate (per 1M) to the prompt tokens.
  • Applies out_rate (per 1M) to the expected_output tokens.
  • Returns the per-call cost as a float rounded to 6 decimals (these are fractions of a cent — precision matters when you multiply by a million calls).

Two scenarios run for you. Expected output:

sonnet 4.6 cost: $0.000360
opus 4.7 cost:   $0.000600

this step needs the editor

on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.

open this same url on a laptop to keep going today.