For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Contact usJoin our Discord
HomeAdministration & GovernanceDevelopment and IntegrationAgent ForgeAPI ReferenceSDK Docs
HomeAdministration & GovernanceDevelopment and IntegrationAgent ForgeAPI ReferenceSDK Docs
  • API Reference
    • POSTResponses
    • POSTChat Completions
    • POSTCompletions
    • POSTEmbeddings
    • POSTAudio Transcription
    • POSTDocuments Extract
    • POSTRerank
    • POSTTokenize
    • POSTDetokenize
    • POSTFactuality
    • POSTInjection
    • POSTPII
    • POSTToxicity
    • GETModels
    • GETMCP Servers
    • GETMCP Tools
  • Valid Inputs
    • Enumerations for API
LogoLogo
Contact usJoin our Discord
API Reference

Completions

POST
https://{your-pg.api-domain}.com/completions
POST
/completions
$curl -X POST https://{your-pg.api-domain}.com/completions \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "model": "gpt-oss-120b",
> "prompt": "Will I lose my hair?",
> "frequency_penalty": 0.1,
> "logit_bias": {
> "128000": 10
> },
> "max_tokens": 1000,
> "presence_penalty": 0.1,
> "stop": "hello",
> "temperature": 1,
> "top_p": 1,
> "top_k": 50,
> "output": {
> "factuality": true,
> "toxicity": true
> },
> "input": {
> "pii": "replace",
> "pii_replace_method": "random"
> }
>}'
1{
2 "id": "cmpl-d20e5639-ed8d-48b2-a403-08fe0fdc7add",
3 "object": "text_completion",
4 "created": 1727889988,
5 "model": "gpt-oss-120b",
6 "choices": [
7 {
8 "index": 0,
9 "text": "Most people lose some hair every day. It's a natural process called shedding. On average, you can lose 50-100 strands of hair a day. However, if you notice an increase in hair loss or if you are experiencing hair loss in large clumps, then it could be a sign of an underlying condition. Hair loss can be triggered by a number of factors such as stress, illness, hormone imbalance, medication, and genetics.\nIf you're concerned about hair loss, you should consult with a trichologist, a hair and scalp specialist. They can help determine the cause of your hair loss and recommend the appropriate treatment."
10 }
11 ]
12}
Retrieve text completions based on the provided input.
Was this page helpful?
Previous

Embeddings

Next
Built with

Authentication

AuthorizationBearer

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

Request

This endpoint expects an object.
modelstringRequired
The chat model to use for generating completions.
promptstring or list of stringsRequired
frequency_penaltydoubleOptional

A value between -2.0 and 2.0, with positive values increasingly penalizing new tokens based on their frequency so far in order to decrease further occurrences.

logit_biasobjectOptional
Modifies the likelihood of specified tokens appearing in a response.
max_tokensintegerOptional
The maximum number of tokens in the generated completion.
presence_penaltydoubleOptional

A value between -2.0 and 2.0, with positive values causing a flat reduction of new tokens based on their existing presence so far in order to decrease further occurrences.

stopstring or list of stringsOptional
streambooleanOptional
Whether to stream back the model response.
stream_optionsobjectOptional
Extra parameters used when streaming the response.
temperaturedoubleOptional

The temperature parameter for controlling randomness in completions. Supports a range of 0.0-2.0.

top_pdoubleOptional

The diversity of the generated text based on nucleus sampling. Supports a range of 0.0-1.0.

top_kintegerOptional

The diversity of the generated text based on top-k sampling.

outputobjectOptional
Options to affect the output of the response.
inputobjectOptional
Options to affect the input of the request.

Response

Successful response.
idstring
Unique ID for the completion.
objectstring

Type of object (completion).

createdinteger
Timestamp of when the completion was created.
modelstring
The model used for generating the result.
choiceslist of objects
The set of result choices.

Errors

400
Bad Request Error
403
Forbidden Error