Skip to content

Choose a quality

Set it when a call must stay on one grade, or when you want an llm-first answer. Leave it unset for the fastest answer.

Purpose

quality tells the API which grade you accept. The default is auto-latency. The response reports that choice and the grade that actually served.

When to use it

Set it when a call must stay on one grade, or when you want an llm-first answer. Leave it unset for the fastest answer.

Request

POSThttps://edge.harktranslate.com/api/v1/translator/text

Send Content-Type: application/json and authenticate with the x-hark-key header.

Request fields
FieldTypeRequiredDefaultAllowedDescription
fromstringyesnoneA supported language code. from also accepts auto.Source language code. The value auto asks the service to detect the source.
tostringyesnoneA supported language code. from also accepts auto.Language code to translate into.
textstringyesnone1 to 1,037,299 characters.The string to translate, or the text whose language should be identified.
qualitystringnoauto-latencyliteral, nmt, llm, auto-llm, auto-latency. Case-insensitive.The grade of answer you accept. llm, nmt and literal serve only that grade and respond 503 when it cannot be served. auto-latency (the default) returns the fastest answer of any grade. auto-llm prefers an LLM answer and returns the fastest other answer when the LLM one is late. meta.grade reports what actually served.

Payload

Full request

curl -X POST "https://edge.harktranslate.com/api/v1/translator/text" \
  -H "x-hark-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
  "from": "en",
  "to": "vi",
  "text": "Hello",
  "quality": "llm"
}
JSON

Success

HTTP 200. Strings written as ... are the response shape, not a captured translation. meta.quality is what you asked, meta.grade is what served, and meta.degraded_segments counts protected parts that could not be restored. literal, nmt, and llm serve only that grade and respond 503 when it cannot be served. auto-llm prefers an LLM answer and returns the fastest other answer when the LLM one is late. auto-latency returns the fastest answer of any grade. The value is case-insensitive.

200 body

{
  "trans": "...",
  "meta": {
    "quality": "llm",
    "grade": "llm",
    "degraded_segments": 0
  }
}

Common mistakes

  • A value outside the five names

    Allowed values are literal, nmt, llm, auto-llm, and auto-latency. Anything else is HTTP 400.

  • Reading the grade off the request

    meta.quality repeats the request. meta.grade is literal, nmt, or llm for the answer that served.

  • Expecting a connector name

    The public body has quality, grade, and degraded_segments. It does not name the connector that answered.

  • Treating strict llm as a fallback

    quality llm does not downgrade. If that grade cannot be served, the response is HTTP 503.