Skip to content
ACS Infra
Completions

Create Completion

POST
/v1/completions

Continue a prompt on a Base model. With stream: true, Server-Sent Events: one CompletionChunk per event, then [DONE]; with output_residual_stream, the last chunk has no choices and has the activations. If Inference fails, the error object with type upstream_error, the code that names the failure, and retryable; during a stream, that error is the last event before [DONE].

Authorization

bearer
headerAuthorizationBearer <token>

An API key: Authorization: Bearer sk-acs-..., or a key of the old platform, acs-bm-.... A User makes and revokes keys in the App.

Header Parameters

idempotency-key?string

A key of your choice, 1 to 255 characters, such as a UUID. A retry with the same key and the same request does the work once: it gets the first answer, and is never charged twice. Kept 24 hours, one set for each User across all their API keys.

Length1 <= length <= 255

Request Body

application/json
  1. body
model?string

The Base model: an id from GET /v1/models, such as llama-8b. Left out, the model that GET /v1/models marks default.

Match^[^\u0000]*$
prompt*|array<integer>|array<>|array<array<integer>>

Text or a list of token ids, or a list of several such prompts. Each prompt gets n choices: choice i of prompt p has the index p * n + i.

max_tokens?|

Generate at most this many tokens for each choice, at most 32000 in all: the number of prompts × n × max_tokens. Without stream, at most 15600, what Inference finishes within the API's 14-minute window. Left out, it is the model's context left after the prompt, at most 32000 (15600 without stream); a request of more than one prompt, or with n above 1, must set it. Near the end of your token budget, the API lowers it to what fits and says so in X-Acs-Max-Tokens-Clamped. null is the same as leaving it out.

Rangevalue <= 32000
temperature?number

Sample less likely tokens more often; 0 takes the most likely token each time. From 0 to 2, as vLLM takes it.

Range0 <= value <= 2
n?integer

How many choices to generate for each prompt; at most 128 in all.

Rangevalue <= 128
echo?boolean

Put the prompt before the generated text.

logprobs?|

Return the log probabilities of this many top tokens; at most 100.

Range0 <= value <= 100
prompt_logprobs?|

vLLM: log probabilities of the prompt tokens, and of this many top tokens at each, at most 100, and 33554432 in all: prompt tokens × n × (this + 1), and logprobs + 1 more with echo. -1 for the whole vocabulary, for at most 256 prompt tokens in all × n (16 with output_residual_stream). The API counts a text's tokens with the model's tokenizer, as Inference does, and token ids exactly. Not with stream: true.

Range-1 <= value <= 100
top_p?number

Sample from the most likely tokens up to this probability; more than 0 and at most 1, as OpenAI and vLLM take it.

Range0 < value <= 1
top_k?integer

vLLM: sample from this many most likely tokens; 0 or -1 for all.

Range-1 <= value
min_p?number

vLLM: leave out tokens less likely than this fraction of the most likely; from 0 to 1.

Range0 <= value <= 1
presence_penalty?number

Make a token that is already in the text less likely; from -2 to 2.

Range-2 <= value <= 2
frequency_penalty?number

Make a token less likely each time it is already in the text; from -2 to 2.

Range-2 <= value <= 2
repetition_penalty?number

vLLM: divide the scores of repeated tokens by this, more than 0; 1 for none.

Range0 < value
seed?|

From 0. The same seed samples the same tokens; vLLM can still change one now and then when it batches requests.

Range0 <= value
stop?|array<>|

Stop before any of these texts; at most 4.

stream?boolean

Send Server-Sent Events as tokens arrive.

stream_options?|

Only with stream: true.

priority?|||

vLLM: a lower number runs first, from 0. Requests of equal priority wait in order of arrival. null is 0; a text of digits and true or false count as their number.

user?|

Your id for the person who asked.

Match^[^\u0000]*$
add_special_tokens?boolean

vLLM: add the model's special tokens, such as BOS, to text.

output_residual_stream?|||array<>

vllm-lens: return the residual stream at these layers, in any order, each once, or true for every layer of the model, or false for none. Layer 0 is the first, and the last is capabilities.n_layers - 1 in GET /v1/models. A capture is at most 33554432 numbers (64 MiB as bfloat16): layers × tokens × the model's hidden size, where the tokens are the prompt's (as the model's tokenizer counts them) and max_tokens. So layers × tokens is at most 8192 for llama-8b (hidden size 4096), 2048 for llama-405b (hidden size 16384), 10922 for trinity-truebase (hidden size 3072); a model that the catalogue does not have counts as its largest hidden size, 16384.

apply_steering_vectors?array<>|

vllm-lens: add these vectors to the residual stream. At most 8 vectors, and 2097152 numbers in all (8 MiB as float32): layers × positions × the model's hidden size.

Response Body

Completion

  1. response
id*string
object*"text_completion"
Value in"text_completion"
created*integer
model*string
choices*array<>
usage*
activations?|null
Example Request
curl -X POST 'https://api.v2.infra.acsresearch.org/v1/completions' \  -H 'Authorization: Bearer <API_KEY>' \  -H 'Content-Type: application/json' \  -d '{  "prompt": "string"}'
Example Response
{  "id": "string",  "object": "text_completion",  "created": 0,  "model": "string",  "choices": [    {      "index": 0,      "text": "string",      "logprobs": {        "text_offset": [          0        ],        "token_logprobs": [          0        ],        "tokens": [          "string"        ],        "top_logprobs": [          {            "property1": 0,            "property2": 0          }        ]      },      "finish_reason": "string",      "stop_reason": "string",      "prompt_logprobs": [        {          "property1": {            "logprob": 0,            "rank": 0,            "decoded_token": "string"          },          "property2": {            "logprob": 0,            "rank": 0,            "decoded_token": "string"          }        }      ]    }  ],  "usage": {    "prompt_tokens": 0,    "completion_tokens": 0,    "total_tokens": 0  },  "activations": {    "residual_stream": {      "data": "string",      "dtype": "string",      "original_dtype": "string",      "shape": [        0      ],      "compression": "zstd"    }  }}