Get a price quote
Calculate the price
Section titled “Calculate the price”https://gptunnel.ru/api/v2/media/priceSend { model, prompt, params, inputs } to get the generation price. A quote is free and does not start a task. The API calculates the quote the same way it calculates the charge when you create the task.
For kling-v3, include prompt at the top level, alongside model. If you omit it or put it only inside params, the API returns 400 ERR_EMPTY_PROMPT.
For text-to-speech models, pricing depends on the voice and the length of the text. Send the same prompt and params.voice that you will use for the task. The API checks the voice just as it does when creating a task. An unknown or unavailable voice returns HTTP 400.
Use the full text you plan to submit. Quotes and task creation use the same rules for required prompts and length limits. For models that charge per prompt token, the text also affects the price. Check the model catalog for each model’s requirements.
Request body
| Parameter | Type | Required? | Description |
|---|---|---|---|
model | string | Required | Model identifier. |
prompt | string | For some models | Text to use for generation. The prompt field in the model catalog specifies whether it is required. If specified, max_length limits the number of characters and max_bytes limits the number of UTF-8 bytes. |
params | object | Optional | Generation settings, such as duration and resolution. These may affect the price. |
inputs | object | Optional | Input files grouped by role, in the same format as for task creation. The API counts attachments and may read linked files to measure their dimensions or duration and check limits. Send the same inputs that you will use for generation. |
For image-based generation with kling-image-v4-product, include both the text in prompt and the image URL in the inputs.image array. Without an image, the method returns HTTP 400 with details[].key: "image". If you supply an image but omit the text, the error points to prompt and contains ERR_EMPTY_PROMPT.
Example request
Section titled “Example request”The examples read the key from the GPTUNNEL_API_KEY environment variable. Choose 5 or 10 seconds. The copied request uses that value for params.duration.
import jsonimport osfrom urllib.request import Request, urlopen
body = { 'model': 'kling-v3', 'prompt': "A blue sky above the city's skyline.", 'params': {'resolution': '1080p', 'duration': 5, 'aspect_ratio': '16:9'},}request = Request( 'https://gptunnel.ru/api/v2/media/price', method='POST', headers={ 'Authorization': os.environ['GPTUNNEL_API_KEY'], 'Content-Type': 'application/json', }, data=json.dumps(body).encode('utf-8'),)with urlopen(request, timeout=30) as response: print(json.load(response))curl --fail-with-body --request POST \ --url 'https://gptunnel.ru/api/v2/media/price' \ --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \ --header 'Content-Type: application/json' \ --data '{ "model": "kling-v3", "prompt": "A blue sky above the city'\''s skyline.", "params": { "resolution": "1080p", "duration": 5, "aspect_ratio": "16:9" }}'const apiKey = process.env.GPTUNNEL_API_KEYif (!apiKey) throw new Error("Set GPTUNNEL_API_KEY")
const response = await fetch('https://gptunnel.ru/api/v2/media/price', { method: 'POST', headers: { Authorization: apiKey, 'Content-Type': 'application/json', }, body: JSON.stringify({ "model": "kling-v3", "prompt": "A blue sky above the city's skyline.", "params": { "resolution": "1080p", "duration": 5, "aspect_ratio": "16:9" }}),})
if (!response.ok) throw new Error('HTTP ' + response.status + ': ' + await response.text())
console.log(await response.json())import jsonimport osfrom urllib.request import Request, urlopen
body = { 'model': 'kling-v3', 'prompt': "A blue sky above the city's skyline.", 'params': {'resolution': '1080p', 'duration': 10, 'aspect_ratio': '16:9'},}request = Request( 'https://gptunnel.ru/api/v2/media/price', method='POST', headers={ 'Authorization': os.environ['GPTUNNEL_API_KEY'], 'Content-Type': 'application/json', }, data=json.dumps(body).encode('utf-8'),)with urlopen(request, timeout=30) as response: print(json.load(response))curl --fail-with-body --request POST \ --url 'https://gptunnel.ru/api/v2/media/price' \ --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \ --header 'Content-Type: application/json' \ --data '{ "model": "kling-v3", "prompt": "A blue sky above the city'\''s skyline.", "params": { "resolution": "1080p", "duration": 10, "aspect_ratio": "16:9" }}'const apiKey = process.env.GPTUNNEL_API_KEYif (!apiKey) throw new Error("Set GPTUNNEL_API_KEY")
const response = await fetch('https://gptunnel.ru/api/v2/media/price', { method: 'POST', headers: { Authorization: apiKey, 'Content-Type': 'application/json', }, body: JSON.stringify({ "model": "kling-v3", "prompt": "A blue sky above the city's skyline.", "params": { "resolution": "1080p", "duration": 10, "aspect_ratio": "16:9" }}),})
if (!response.ok) throw new Error('HTTP ' + response.status + ': ' + await response.text())
console.log(await response.json())Example response
Section titled “Example response”This five-second quote returned 210 RUB. Check price and currency in your own response for the amount that applies to your key. Kling returns params.duration as a string.
{ "code": 0, "model": "kling-v3", "price": 210, "currency": "RUB", "params": { "resolution": "1080p", "duration": "5", "aspect_ratio": "16:9" }, "breakdown": ["42 × 5 = 210.0000"]}