Billing

How Expression Measurement usage is billed and how to check it.

Expression Measurement bills for the media you send it, in seconds. Usage is counted per run: one upload request or one realtime session. Time spent connected is not billed, so a realtime session that stays open between frames is billed only for the media the server takes in.

EndpointBilled for
Audio uploadThe length of the audio
Audio realtimeThe length of the audio you stream, except frames the server rejects
Image uploadOne third of a second for each image
Video realtimeOne third of a second for each frame that passes the send-rate check

A run that is billed for any media is billed at least 10 seconds. See Minimum charge.

Audio

Audio is billed for its full length, including silence and stretches with no speech. A 60-second recording bills 60 seconds whether it contains one utterance or none.

Video

Each image or frame is billed as one third of a second, whatever rate you send frames at and whether or not a face is found in it. Sending 3 frames per second for 30 seconds bills 30 seconds, and sending 1 frame per second for 60 seconds bills 20 seconds. The number of frames sets the billed time, not the length of the video they come from, so sending fewer frames per second lowers it.

A realtime frame is billed once it passes the send rate check, even if it is then rejected with invalid_image_frame because it is not a JPEG or has more pixels than the limit. To avoid paying for frames that return no result, encode each frame as a JPEG within the frame limits before sending it.

Minimum charge

Every upload request that succeeds, and every realtime session that is billed for any media, is billed at least 10 seconds. The minimum is applied when the run ends, however a session ends. A 4-second audio upload bills 10 seconds, and so does an image upload of 30 images or fewer.

The minimum applies to each run, so measuring many short clips in separate requests or sessions bills at least 10 seconds for each one.

What is not billed

  1. Frames rejected with rate_limited, on either realtime endpoint.
  2. Audio frames rejected with invalid_audio_frame.
  3. Empty video frames, which are rejected with invalid_image_frame before the send-rate check.
  4. A realtime session that sends no media, or whose every frame is one of the above. The minimum charge does not apply to it.
  5. An upload request that fails. On image upload, one rejected image fails the whole request, so none of its images are billed. A run recorded for a failed request reports metered_seconds as 0.

Checking usage

The metered_seconds field of a run holds its billable seconds. GET /v1/expression/run returns it for each of your organization’s runs, and GET /v1/expression/run/{run_id} for one run. See Run IDs for how to find a run’s ID.

  1. During a realtime session, the value grows as the server takes in media. The minimum charge is added when the run ends.
  2. Video values are not rounded to whole seconds. They are counted with limited precision, so a run of 180 frames reads as 59.99999994 rather than 60.

Examples

EndpointWhat you sendBilled
Audio upload4 seconds of audio10 seconds, the minimum
Audio upload2 minutes of audio, mostly silence120 seconds
Audio realtime90 seconds of audio90 seconds
Image upload12 images10 seconds, the minimum
Image upload90 images30 seconds
Image upload20 images, one of them a PNGNot billed; the request fails
Video realtime3 frames per second for 30 seconds30 seconds
Video realtime6 PNG frames10 seconds, the minimum
Either realtime endpointNo media before the session closesNot billed

Next steps