How tokens are counted
The total tokens for a job is:client.fine_tuning.retrieve(id=<JOB_ID>).
If you disable packing, training tokens are computed as dataset_length × max_seq_length instead.
Estimate job cost
There are three ways to estimate the cost of a fine-tuning job before launching it:- CLI: When you submit a job with
tg fine-tuning create, the CLI prints the estimated price and asks for confirmation before the job is submitted. - Web interface: On the new fine-tuning job page, the estimate appears once you select a model and dataset.
- API/SDK: Call the estimate price endpoint with the same parameters you plan to submit to the create job endpoint. The response includes the estimated total price, the estimated training and evaluation token counts, your credit limit, and whether you are allowed to proceed:
The cost estimate is only available after your input datasets pass server-side validation.