Skip to content
Hayonix

API reference · Fine-tuning

Price estimate for fine-tuning on a validated dataset

GET/v1/fine-tunes/estimate
API keyfine_tune_job:readProject
TypeScript
client.fineTuning.estimate()
Python
client.fine_tuning.estimate()
CLI
hayonix fine-tunes estimate

Checks the model, files and settings as creating a job would, and returns the estimated billable tokens, their cost and the credit a job would reserve. Nothing is created or charged; the files must have finished validation.

Project API key (Authorization: Bearer sk_…), or a console session. Requires the fine_tune_job:read permission (a key's scope, or a role that includes it).

Examples

The samples read API_KEY and API_BASE_URL from the environment (see Setup). Values are examples.

curl -sS "$API_BASE_URL/fine-tunes/estimate?model=%3Cmodel%3E&training_file_id=file_01jc5zq4m8k3v6x9t2w7r0b1e4" \
  -H "Authorization: Bearer $API_KEY"

Request

Headers
HeaderRequiredDescription
AuthorizationyesBearer and your API key. The key implies its project.
X-Project-Idsession onlyThe project to act in, for console sessions. Requests with an API key leave it out.

Query parameters

  • modelstringrequired

    A fine-tunable base model: slug or ID

    1–200 characters

  • training_file_idstringrequired

    ID of the training file

    ID with prefix file_

  • validation_file_idstring

    ID of the validation file

    ID with prefix file_

  • methodstring

    Training method (default supervised)

    One ofsupervisedpreference

  • adapterstring

    Adapter type (default lora)

    One oflorafull

  • epochsinteger

    Passes over the training file (default 1)

    1–20

  • evals_per_epochinteger | null

    Evaluations of the validation file per epoch (default 1)

    0–20

  • skustring

    Hardware SKU the job would train on (default: the base model's first listed SKU); checked, but it does not change the price

    1–64 characters

Response

200 FineTuneEstimate — The estimate, from the price book in force

  • objectstringrequired

    Always `fine_tune_estimate`: the type of this object

    One offine_tune_estimate

  • modelstringrequired

    Model ID (`publisher/name`)

  • training_tokensintegerrequired

    epochs × training-file tokens

  • evaluation_tokensintegerrequired

    epochs × evaluations per epoch × validation-file tokens

  • billable_tokensintegerrequired

    `training_tokens` plus `evaluation_tokens`: what the estimate prices

  • priceTrainingPricerequired
    Show 5 fields of price
    • unit_pricestringrequired

      Integer nano-USD as a decimal string

      pattern ^-?[0-9]+$

    • unit_quantitystringrequired

      Tokens the unit price is for

    • per_million_tokensstringrequired

      Integer nano-USD as a decimal string

      pattern ^-?[0-9]+$

    • display_unitstring | nullrequired

      Label of the unit for display; null when none is set

    • price_book_versionintegerrequired

      Version of the price book the price comes from

  • estimated_coststringrequired

    Integer nano-USD as a decimal string

    pattern ^-?[0-9]+$

  • reservationstringrequired

    Credit reserved when the job is created (released down to the actual charge at the end)

    pattern ^-?[0-9]+$

  • token_estimate_methodstringrequired

    How file tokens were estimated: characters divided by 4, plus the model's per-example template overhead. The job is billed on the exact count.

    One ofcharacters_div_4

Example response
Example response
{
  "object": "fine_tune_estimate",
  "model": "string",
  "training_tokens": 1,
  "evaluation_tokens": 1,
  "billable_tokens": 1,
  "price": {
    "unit_price": "1500000000",
    "unit_quantity": "string",
    "per_million_tokens": "1500000000",
    "display_unit": "string",
    "price_book_version": 1
  },
  "estimated_cost": "1500000000",
  "reservation": "1500000000",
  "token_estimate_method": "characters_div_4"
}

Errors

Errors use the standard envelope. What this operation can answer:

Errors
StatusTypeWhen
400invalid_request_errorA parameter or body field is missing or not allowed; param names it.
401authentication_errorThe key or session is missing, revoked or expired.
403permission_errorThe credential lacks the permission this needs, or the organization is suspended.
402insufficient_credit_errorThe organization is out of credit or over a spend limit.
429rate_limit_error rate_limitedToo many requests; retry after retry-after seconds.