POST
/
chat
/
completions
Proxy a chat completion request with automatic paywall enforcement
curl --request POST \
  --url https://api.paywalls.ai/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "<string>",
  "messages": [
    {
      "role": "system",
      "content": "<string>",
      "name": "<string>"
    }
  ],
  "user": "<string>",
  "stream": false
}'
{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "system",
        "content": "<string>",
        "name": "<string>"
      },
      "finish_reason": "stop"
    }
  ]
}

Authorizations

Authorization
string
header
required

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

Headers

X-Paywall-User
string

Optional user identifier provided by the developer. Can be used instead of the user property in the request body to associate the API call with a specific end user.

Body

application/json
model
string
required

The model to use for generating the response.

messages
object[]
required

A list of messages that make up the conversation.

Minimum length: 1
user
string

The unique identifier of the user making the request.

stream
boolean
default:false

Whether to stream the response back to the client.

Response

200 - application/json

successful operation

id
string

The completion identifier.

Example:

"chatcmpl-123"

object
string

The type of the returned object.

Example:

"chat.completion"

created
integer

The creation timestamp of the completion.

Example:

1677652288

choices
object[]

The list of choices returned by the model.