Skip to main content
POST
/
v1
/
async
/
completions
Create async text completion
curl --request POST \
  --url http://localhost:8080/v1/async/completions \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "prompt": "<string>",
  "fallbacks": [
    "<string>"
  ],
  "stream": true,
  "best_of": 123,
  "echo": true,
  "frequency_penalty": 123,
  "logit_bias": {},
  "logprobs": 123,
  "max_tokens": 123,
  "n": 123,
  "presence_penalty": 123,
  "seed": 123,
  "stop": [
    "<string>"
  ],
  "suffix": "<string>",
  "temperature": 123,
  "top_p": 123,
  "user": "<string>"
}
'
{
  "id": "<string>",
  "status": "pending",
  "created_at": "2023-11-07T05:31:56Z",
  "expires_at": "2023-11-07T05:31:56Z",
  "completed_at": "2023-11-07T05:31:56Z",
  "status_code": 123,
  "result": "<unknown>",
  "error": {
    "event_id": "<string>",
    "type": "<string>",
    "is_bifrost_error": true,
    "status_code": 123,
    "error": {
      "type": "<string>",
      "code": "<string>",
      "message": "<string>",
      "param": "<string>",
      "event_id": "<string>"
    },
    "extra_fields": {
      "provider": "openai",
      "model_requested": "<string>",
      "request_type": "<string>"
    }
  }
}

Headers

x-bf-async-job-result-ttl
integer
default:3600

Time-to-live in seconds for the job result after completion. Defaults to 3600 (1 hour). After expiry, the job result is automatically cleaned up.

Body

application/json
model
string
required

Model in provider/model format

prompt
required

Prompt input - can be a string or array of strings

fallbacks
string[]
stream
boolean
best_of
integer
echo
boolean
frequency_penalty
number
logit_bias
object
logprobs
integer
max_tokens
integer
n
integer
presence_penalty
number
seed
integer
stop
string[]
suffix
string
temperature
number
top_p
number
user
string

Response

Job accepted for processing

Response returned when creating or polling an async job

id
string
required

Unique identifier for the async job

status
enum<string>
required

The status of an async job

Available options:
pending,
processing,
completed,
failed
created_at
string<date-time>
required

When the job was created

expires_at
string<date-time>

When the job result expires and will be cleaned up

completed_at
string<date-time>

When the job completed (successfully or with failure)

status_code
integer

HTTP status code of the completed operation

result
any

The result of the completed operation (shape depends on the request type)

error
object

Error response from Bifrost