POST
/
v1
/
completions
import { AtomaSDK } from "atoma-sdk";

const atomaSDK = new AtomaSDK({
bearerAuth: process.env["ATOMASDK_BEARER_AUTH"] ?? "",
});

async function run() {
const completion = await atomaSDK.completions.completionsCreate({
model: "meta-llama/Llama-3.3-70B-Instruct",
prompt: "Hello, world!",
});

console.log(completion.choices[0]);
}

run();
{
  "choices": [
    {
      "text": "This is a test",
      "index": 0,
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "created": "2021-01-01T00:00:00.000Z",
  "id": "cmpl-1234567890",
  "model": "meta-llama/Llama-3.3-70B-Instruct",
  "object": "text_completion",
  "system_fingerprint": "system-fingerprint",
  "usage": {
    "completion_tokens": 10,
    "completion_tokens_details": {
      "accepted_prediction_tokens": 10,
      "audio_tokens": 0,
      "reasoning_tokens": 10,
      "rejected_prediction_tokens": 0
    },
    "prompt_tokens": 10,
    "prompt_tokens_details": {
      "audio_tokens": 0,
      "cached_tokens": 10
    },
    "total_tokens": 20
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
string
required

ID of the model to use

Example:

"meta-llama/Llama-3.3-70B-Instruct"

prompt
required

The prompt to generate completions for A single string prompt

best_of
integer | null
default:1
Example:

1

echo
boolean | null
default:false
Example:

false

frequency_penalty
number | null

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far

Example:

0

logit_bias
object | null

Modify the likelihood of specified tokens appearing in the completion.

Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.

Example:
{ "1234567890": 0.5, "1234567891": -0.5 }
logprobs
integer | null

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.

Example:

1

max_tokens
integer | null
default:16

The maximum number of tokens to generate in the chat completion

Example:

4096

n
integer | null

How many chat completion choices to generate for each input message

Example:

1

presence_penalty
number | null

Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far

Example:

0

seed
integer | null

If specified, our system will make a best effort to sample deterministically

Example:

123

stop
string[] | null

Up to 4 sequences where the API will stop generating further tokens

Example:

"json([\"stop\", \"halt\"])"

stream
boolean | null

Whether to stream back partial progress

Example:

false

stream_options
object | null

Options for streaming response. Only set this when you set stream: true.

suffix
string | null

The suffix that comes after a completion of inserted text.

Example:

"json(\"\\n\")"

temperature
number | null

What sampling temperature to use, between 0 and 2

Example:

0.7

top_p
number | null

An alternative to sampling with temperature

Example:

1

user
string | null

A unique identifier representing your end-user

Example:

"user-1234"

Response

Chat completions

choices
object[]
required

Array of completion choices response

Example:
[
{
"text": "This is a test",
"index": 0,
"logprobs": null,
"finish_reason": "stop"
}
]
created
integer
required

The creation time of the request

Example:

"2021-01-01T00:00:00.000Z"

id
string
required

The ID of the request

Example:

"cmpl-1234567890"

model
string
required

The model used for the request

Example:

"meta-llama/Llama-3.3-70B-Instruct"

object
string
required

The object type

Example:

"text_completion"

system_fingerprint
string
required

The system fingerprint

Example:

"system-fingerprint"

usage
object
required

The usage information for the request