Skip to main content
POST
Create a text completion

Authorizations

Authorization
string
header
required

Nscale bearer token supplied in the Authorization header.

Headers

X-Organization-Id
string

Selects the caller's public-cloud organization. Required when the caller belongs to multiple public-cloud organizations and the URL does not select an organization; omission then returns 400. With one public-cloud organization, omission selects it automatically. An explicitly supplied value, including an empty value, that is not one of the caller's public-cloud organizations returns 403. On /organizations/{organization_id}/endpoints, the path organization_id takes precedence over this header.

Minimum string length: 1
X-Request-Id
string

Optional correlation identifier. Use the X-Request-Id returned in the response when contacting support. The response ID may differ from this value. Supplying this header does not make a request idempotent.

Body

application/json
model
string
required

Model ID from GET /v1/models. Capabilities depend on the selected model.

Minimum string length: 1
prompt
Required range: x >= 0
echo
boolean | null
default:false
frequency_penalty
number | null
logit_bias
object | null
logprobs
integer | null
max_tokens
integer | null
default:16
n
integer
default:1
presence_penalty
number | null
seed
integer
Required range: -9223372036854776000 <= x <= 9223372036854776000
stop
default:[]
stream
boolean | null
default:false
stream_options
object | null
suffix
string | null
temperature
number | null
top_p
number | null
user
string | null
top_k
integer | null
min_p
number | null
repetition_penalty
number | null
watermarking
boolean | null
length_penalty
number
default:1
stop_token_ids
integer[] | null
include_stop_str_in_output
boolean
default:false
ignore_eos
boolean
default:false
min_tokens
integer
default:0
skip_special_tokens
boolean
default:true
spaces_between_special_tokens
boolean
default:true
truncate_prompt_tokens
integer | null
Required range: -1 <= x <= 9223372036854776000
truncation_side
enum<string> | null

Which side to truncate from when truncate_prompt_tokens is active. 'right' keeps the first N tokens. 'left' keeps the last N tokens.

Available options:
left,
right
allowed_token_ids
integer[] | null
prompt_logprobs
integer | null
logprob_token_ids
integer[] | null

Specific vocab token IDs to return logprobs for at each generated position, in addition to the sampled token. More efficient than requesting the full vocab when only a small fixed label set is needed (e.g. multilabel scoring where each label corresponds to a known vocab id). When set, this explicit token selection takes precedence over the natural top-k selected by logprobs. Requires logprobs to be set.

bad_words
string[]
prompt_embeds
add_special_tokens
boolean
default:true

If true (the default), special tokens (e.g. BOS) will be added to the prompt.

response_format
object

Similar to chat completion, this parameter specifies the format of output. Only {'type': 'json_object'}, {'type': 'json_schema'}, {'type': 'structural_tag'}, or {'type': 'text' } is supported.

structured_outputs
object | null

Additional kwargs for structured outputs

priority
integer
default:0

Scheduling priority; lower values are handled first. Non-zero priorities require support from the selected model.

Required range: -9223372036854776000 <= x <= 9223372036854776000
request_id
string

Identifier for the generation request. Generated when omitted. This is separate from the X-Request-Id HTTP correlation header.

session_id
string | null

Stable session identity shared by related requests. Unlike request_id, this value is expected to remain stable across multiple requests in the same conversation or agent session.

return_tokens_as_token_ids
boolean | null

If specified with 'logprobs', tokens are represented as strings of the form 'token_id:{token_id}' so that tokens that are not JSON-encodable can be identified.

return_token_ids
boolean | null

If specified, the result will include token IDs alongside the generated text. In streaming mode, prompt_token_ids is included only in the first chunk, and token_ids contains the delta tokens for each chunk. This is useful for debugging or when you need to map generated text back to input tokens.

cache_salt
string

If specified, the prefix cache will be salted with the provided string to prevent an attacker to guess prompts in multi-user environments. The salt should be random, protected from access by 3rd parties, and long enough to be unpredictable (e.g., 43 characters base64-encoded, corresponding to 256 bit).

Required string length: 1 - 1024
vllm_xargs
object | null

Additional request parameters with (list of) string or numeric values, used by custom extensions.

repetition_detection
object | null

Parameters for detecting repetitive N-gram patterns in output tokens. If such repetition is detected, generation will be ended early. LLMs can sometimes generate repetitive, unhelpful token patterns, stopping only when they hit the maximum output length (e.g. 'abcdabcdabcd...' or '\emoji \emoji \emoji ...'). This feature can detect such behavior and terminate early, saving time and tokens.

thinking_token_budget
integer | null

Maximum number of tokens allowed for thinking operations (reasoning models). Non-negative integer sets the limit; -1 means unlimited (treated as unset).

Required range: x >= -1
stream_interval
integer | null

Minimum number of tokens per streamed chunk. The first and last chunks are sent immediately. The effective interval may be higher than requested. Ignored for non-streaming requests.

Required range: x >= 1

Response

Successful inference. Feature availability depends on the selected model.

model
string
required
choices
object[]
required
usage
object
required
id
string
object
enum<string>
default:text_completion
Available options:
text_completion
created
integer
service_tier
enum<string> | null
Available options:
auto,
default,
flex,
scale,
priority
system_fingerprint
string | null
metrics
object | null