v1

latestOpenAPI 3.1.0Apache 2.02026-07-264001921002.3 KB
OpenAI Integration

Create chat completion (OpenAI format)

Creates a chat completion using OpenAI-compatible format. Supports streaming via SSE.

Async inference: Send x-bf-async: true to submit the request as a background job and receive a job ID immediately. Poll with x-bf-async-id: <job-id> to retrieve the result. When the job is still processing, the response will have an empty choices array. When completed, choices will contain the full result. See Async Inference for details.

Note: This endpoint also works without the /v1 prefix (e.g., /openai/chat/completions).

post/openai/v1/chat/completions

Headers

x-bf-async'true'

Set to true to submit this request as an async job. Returns immediately with a job ID. Not compatible with streaming.

x-bf-async-idstring

Poll for results of a previously submitted async job by providing the job ID returned from the initial async request.

x-bf-async-job-result-ttlinteger

Override the default result TTL in seconds. Results expire after this duration from completion time.

Request body

modelstring required

Model identifier (e.g., gpt-4, gpt-3.5-turbo)

streamboolean

Whether to stream the response

max_tokensinteger

Maximum tokens to generate (legacy, use max_completion_tokens)

max_completion_tokensinteger

Maximum tokens to generate

temperaturenumber
top_pnumber
frequency_penaltynumber
presence_penaltynumber
logit_biasobject
logprobsboolean
top_logprobsinteger
ninteger
seedinteger
userstring
parallel_tool_callsboolean
response_formatobject

Format for the response

reasoning_effort'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh'

OpenAI reasoning effort level

service_tierstring
fallbacksstring[]

Fallback models

Example request

{
  "model": "gpt-4"
}

Response

Successful response

idstring
createdinteger
modelstring
objectstring
service_tierstring
system_fingerprintstring
citationsstring[]