This endpoint proxies an OpenAI-compatible chat completion request and charges the user based on the configured monetization model (per request, per token, etc).
If the user is not connected to the paywall, the response will contain a connection link.
If the user is connected but has insufficient balance, a top-up link is returned.
On success, the request is forwarded to the underlying model provider and the result is returned.
POST
/
chat
/
completions
Proxy a chat completion request with automatic paywall enforcement
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.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Paywalls.ai Documentation","colors":{"primary":"#05B75E","light":"#05B75E","dark":"#05B75E"},"logo":{"light":"https://mintcdn.com/paywallsai/wvN_CB44MPu2Fpju/logo/light.svg?fit=max\u0026auto=format\u0026n=wvN_CB44MPu2Fpju\u0026q=85\u0026s=7886e14938e5f6bc116f7f19f186c102","dark":"https://mintcdn.com/paywallsai/wvN_CB44MPu2Fpju/logo/dark.svg?fit=max\u0026auto=format\u0026n=wvN_CB44MPu2Fpju\u0026q=85\u0026s=8f391f24042ad5bf0c487dc257bc5344"},"favicon":"/favicon.svg","navbar":{"links":[{"label":"GitHub","icon":"github","href":"https://github.com/paywalls-ai"}],"primary":{"type":"button","label":"Dashboard","href":"https://dashboard.paywalls.ai"}},"footer":{"socials":{"website":"https://paywalls.ai","x":"https://x.com/paywallsai","github":"https://github.com/paywalls-ai","linkedin":"https://www.linkedin.com/company/paywalls-ai"},"links":[{"header":"Legal","items":[{"label":"Privacy Policy","href":"https://docs.paywalls.ai/privacy"},{"label":"Terms of Service","href":"https://docs.paywalls.ai/terms"}]}]},"icons":{"library":"lucide"},"integrations":{"posthog":{"apiKey":"phc_KNPKUr5kEutoQTM4lxC6OU4ulMKdzn5sua4Q2Kmz1sC","apiHost":"https://eu.i.posthog.com"}},"navigation":{"global":{"anchors":[{"anchor":"Website","icon":"globe","href":"https://paywalls.ai"},{"anchor":"Dashboard","icon":"gauge","href":"https://dashboard.paywalls.ai"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"paywallsai","hasAudioNarration":false,"actualSubdomain":"paywallsai","customDomains":["docs.paywalls.ai"],"gitSource":{"type":"github","owner":"paywalls-ai","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a21f64fad503bdea06293f2","collectionId":"82784c3e-9e18-46cb-936e-760dcebc3282","schemaVersion":"v2"},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6a21f64fad503bdea06293f2:success","clientVersion":"0.0.4044","searchFilterCounts":[{"language":"default","tag":"API reference","count":41},{"language":"default","tag":"Documentation","count":35},{"language":"default","tag":"Webhook events","count":27},{"language":"default","tag":"How‑to guides","count":16},{"language":"default","tag":"More","count":8},{"language":"default","tag":"User","count":6},{"language":"default","tag":"Webhooks","count":5},{"language":"default","tag":"Core concepts","count":5},{"language":"default","tag":"SDKs \u0026 Integrations","count":4},{"language":"default","tag":"Getting started","count":2}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api-reference/chat/completions/post","slug":"/api-reference/chat/completions/post","pageMetadata":{"title":"Chat completion","openapi":"POST /chat/completions","description":"This endpoint proxies an OpenAI-compatible chat completion request and charges the user based on the configured monetization model (per request, per token, etc).\n\nIf the user is not connected to the paywall, the response will contain a connection link.\n\nIf the user is connected but has insufficient balance, a top-up link is returned.\n\nOn success, the request is forwarded to the underlying model provider and the result is returned.\n","href":"/api-reference/chat/completions/post"},"description":{"compiledSource":"\"use strict\";\nconst {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_Fragment, {\n children: [_jsx(_components.p, {\n children: \"This endpoint proxies an OpenAI-compatible chat completion request and charges the user based on the configured monetization model (per request, per token, etc).\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"If the user is not connected to the paywall, the response will contain a connection link.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"If the user is connected but has insufficient balance, a top-up link is returned.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"On success, the request is forwarded to the underlying model provider and the result is returned.\"\n })]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Chat completion","openapi":"POST /chat/completions","description":"This endpoint proxies an OpenAI-compatible chat completion request and charges the user based on the configured monetization model (per request, per token, etc).\n\nIf the user is not connected to the paywall, the response will contain a connection link.\n\nIf the user is connected but has insufficient balance, a top-up link is returned.\n\nOn success, the request is forwarded to the underlying model provider and the result is returned.\n","href":"/api-reference/chat/completions/post"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"summary":"Proxy a chat completion request with automatic paywall enforcement","description":"This endpoint proxies an OpenAI-compatible chat completion request and charges the user based on the configured monetization model (per request, per token, etc).\n\nIf the user is not connected to the paywall, the response will contain a connection link.\n\nIf the user is connected but has insufficient balance, a top-up link is returned.\n\nOn success, the request is forwarded to the underlying model provider and the result is returned.\n","tags":["Chat"],"parameters":["2fd8f868-c724-4c3f-896d-43f7c77190be"],"requestBody":"4dd0c591-0a2b-4dd0-9d73-feb3691da4b7","responses":{"200":"b149f72c-aac5-478e-b868-dfa1df9f758b"},"method":"post","type":"path","servers":["4c9727ae-33ae-4b30-9291-a6c80cf0ee48"],"security":["960f5d89-08e3-4b0e-a3a9-569112495159"],"path":"/chat/completions","baseUrlOptions":["https://api.paywalls.ai/v1"],"title":"Proxy a chat completion request with automatic paywall enforcement","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{"2fd8f868-c724-4c3f-896d-43f7c77190be":{"name":"X-Paywall-User","in":"header","required":false,"schema":{"type":"string","isRequired":false,"description":"Optional user identifier provided by the developer.\nCan be used instead of the `user` property in the request body to associate the API call with a specific end user.\n","uniqueKey":"","typeLabel":"string"},"description":"Optional user identifier provided by the developer.\nCan be used instead of the `user` property in the request body to associate the API call with a specific end user.\n"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","description":"The model to use for generating the response.","isRequired":true,"uniqueKey":"model","typeLabel":"string"},"messages":{"type":"array","description":"A list of messages that make up the conversation.","items":{"type":"object","description":"A single message exchanged in a chat conversation.","properties":{"role":{"type":"string","description":"The role of the message author in the conversation.","enum":["system","user","assistant"],"uniqueKey":"messages.items.[INDEX].role","typeLabel":"enum\u003cstring>"},"content":{"type":"string","description":"The text content of the message.","uniqueKey":"messages.items.[INDEX].content","typeLabel":"string"},"name":{"type":"string","pattern":"^[a-zA-Z0-9_]{1,64}$","description":"Optional name of the message author (e.g. function or tool name).\nCan contain letters, numbers, and underscores; max length is 64 characters.\n","uniqueKey":"messages.items.[INDEX].name","typeLabel":"string"}},"uniqueKey":"messages.items.[INDEX]","typeLabel":"object"},"minItems":1,"isRequired":true,"uniqueKey":"messages","typeLabel":"object[]"},"user":{"type":"string","description":"The unique identifier of the user making the request.","uniqueKey":"user","typeLabel":"string"},"stream":{"type":"boolean","description":"Whether to stream the response back to the client.","default":false,"uniqueKey":"stream","typeLabel":"boolean"}},"required":["model","messages"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"model":"\u003cstring>","messages":[{"content":"\u003cstring>","name":"\u003cstring>"}],"user":"\u003cstring>","stream":false}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"b149f72c-aac5-478e-b868-dfa1df9f758b":{"description":"successful operation","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","example":"chatcmpl-123","description":"The completion identifier.","uniqueKey":"id","typeLabel":"string"},"object":{"type":"string","example":"chat.completion","description":"The type of the returned object.","uniqueKey":"object","typeLabel":"string"},"created":{"type":"integer","example":1677652288,"description":"The creation timestamp of the completion.","uniqueKey":"created","typeLabel":"integer"},"choices":{"type":"array","description":"The list of choices returned by the model.","items":{"type":"object","properties":{"index":{"type":"integer","example":0,"description":"The index of the choice in the list.","uniqueKey":"choices.items.[INDEX].index","typeLabel":"integer"},"message":{"type":"object","description":"A single message exchanged in a chat conversation.","properties":{"role":{"type":"string","description":"The role of the message author in the conversation.","enum":["system","user","assistant"],"uniqueKey":"choices.items.[INDEX].message.role","typeLabel":"enum\u003cstring>"},"content":{"type":"string","description":"The text content of the message.","uniqueKey":"choices.items.[INDEX].message.content","typeLabel":"string"},"name":{"type":"string","pattern":"^[a-zA-Z0-9_]{1,64}$","description":"Optional name of the message author (e.g. function or tool name).\nCan contain letters, numbers, and underscores; max length is 64 characters.\n","uniqueKey":"choices.items.[INDEX].message.name","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX].message","typeLabel":"object"},"finish_reason":{"type":"string","example":"stop","description":"The reason why the model stopped generating further tokens.","uniqueKey":"choices.items.[INDEX].finish_reason","typeLabel":"string"}},"uniqueKey":"choices.items.[INDEX]","typeLabel":"object"},"uniqueKey":"choices","typeLabel":"object[]"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"id":"chatcmpl-123","object":"chat.completion","created":1677652288,"choices":[{"index":0,"message":{"role":"system","content":"\u003cstring>","name":"\u003cstring>"},"finish_reason":"stop"}]}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"960f5d89-08e3-4b0e-a3a9-569112495159":{"ApiKeyAuth":{"type":"http","scheme":"bearer","scopes":[]}}},"servers":{"4c9727ae-33ae-4b30-9291-a6c80cf0ee48":{"url":"https://api.paywalls.ai/v1","description":"Primary production server"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","scopes":[]},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your auth token.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"ApiKeyAuth","name":"Authorization"}],"title":"ApiKeyAuth"}]},"originalFileLocation":"api-reference/openapi.json"},"subdomain":"paywallsai","siteName":"Paywalls.ai Documentation","title":"Chat completion - Paywalls.ai Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2025-09-13T04:41:14.274Z","originalFileLocation":"api-reference/chat/completions/post.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"This endpoint proxies an OpenAI-compatible chat completion request and charges the user based on the configured monetization model (per request, per token, etc). If the user is not connected to the paywall, the response will contain a connection link. If the user is connected but has insufficient balance, a top-up link is returned. On success, the request is forwarded to the underlying model provider and the result is returned.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Paywalls.ai Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/paywallsai/tEaamW9kgYtywLhr/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/paywallsai/tEaamW9kgYtywLhr/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/paywallsai/tEaamW9kgYtywLhr/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/paywallsai/tEaamW9kgYtywLhr/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/paywallsai/tEaamW9kgYtywLhr/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/paywallsai/tEaamW9kgYtywLhr/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/paywallsai/tEaamW9kgYtywLhr/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/paywallsai/tEaamW9kgYtywLhr/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/paywallsai/tEaamW9kgYtywLhr/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Chat completion - Paywalls.ai Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"This endpoint proxies an OpenAI-compatible chat completion request and charges the user based on the configured monetization model (per request, per token, etc). If the user is not connected to the paywall, the response will contain a connection link. If the user is connected but has insufficient balance, a top-up link is returned. On success, the request is forwarded to the underlying model provider and the result is returned.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Paywalls.ai Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.paywalls.ai/api-reference/chat/completions/post\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://paywallsai.mintlify.app/_mintlify/api/og/v2?division=Chat+completion\u0026amp;title=Chat+completion\u0026amp;description=This+endpoint+proxies+an+OpenAI-compatible+chat+completion+request+and+charges+the+user+based+on+the+configured+monetization+model+%28per+request%2C+per+token%2C+etc%29\u0026amp;theme=5948c0662bc4c87b645bfb84\u0026amp;signature=8041b768ce64554cf2fdba36e4bd25c4c68820f143b5aa46ef603596d7d37bb6\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Chat completion - Paywalls.ai Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"This endpoint proxies an OpenAI-compatible chat completion request and charges the user based on the configured monetization model (per request, per token, etc). If the user is not connected to the paywall, the response will contain a connection link. If the user is connected but has insufficient balance, a top-up link is returned. On success, the request is forwarded to the underlying model provider and the result is returned.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://paywallsai.mintlify.app/_mintlify/api/og/v2?division=Chat+completion\u0026amp;title=Chat+completion\u0026amp;description=This+endpoint+proxies+an+OpenAI-compatible+chat+completion+request+and+charges+the+user+based+on+the+configured+monetization+model+%28per+request%2C+per+token%2C+etc%29\u0026amp;theme=5948c0662bc4c87b645bfb84\u0026amp;signature=8041b768ce64554cf2fdba36e4bd25c4c68820f143b5aa46ef603596d7d37bb6\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/paywallsai/tEaamW9kgYtywLhr/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Paywalls.ai Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#05B75E\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.paywalls.ai/api-reference/chat/completions/post\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/chat/completions/post.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.paywalls.ai/#organization\",\"name\":\"Paywalls.ai Documentation\",\"url\":\"https://docs.paywalls.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/paywallsai/wvN_CB44MPu2Fpju/logo/light.svg?fit=max\u0026auto=format\u0026n=wvN_CB44MPu2Fpju\u0026q=85\u0026s=7886e14938e5f6bc116f7f19f186c102\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.paywalls.ai#website\",\"name\":\"Paywalls.ai Documentation\",\"url\":\"https://docs.paywalls.ai\",\"publisher\":{\"@id\":\"https://docs.paywalls.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.paywalls.ai/api-reference/chat/completions/post#webpage\",\"url\":\"https://docs.paywalls.ai/api-reference/chat/completions/post\",\"name\":\"Chat completion\",\"description\":\"This endpoint proxies an OpenAI-compatible chat completion request and charges the user based on the configured monetization model (per request, per token, etc). If the user is not connected to the paywall, the response will contain a connection link. If the user is connected but has insufficient balance, a top-up link is returned. On success, the request is forwarded to the underlying model provider and the result is returned.\",\"dateModified\":\"2025-09-13T04:41:14.274Z\",\"isPartOf\":{\"@id\":\"https://docs.paywalls.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.paywalls.ai/api-reference/chat/completions/post#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.paywalls.ai/api-reference/chat/completions/post#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Paywalls.ai Documentation\",\"item\":\"https://docs.paywalls.ai\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Chat completion\",\"item\":\"https://docs.paywalls.ai/api-reference/chat/completions/post\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.paywalls.ai/api-reference/chat/completions/post#apireference\",\"headline\":\"Chat completion\",\"name\":\"Chat completion\",\"description\":\"This endpoint proxies an OpenAI-compatible chat completion request and charges the user based on the configured monetization model (per request, per token, etc). If the user is not connected to the paywall, the response will contain a connection link. If the user is connected but has insufficient balance, a top-up link is returned. On success, the request is forwarded to the underlying model provider and the result is returned.\",\"url\":\"https://docs.paywalls.ai/api-reference/chat/completions/post\",\"mainEntityOfPage\":{\"@id\":\"https://docs.paywalls.ai/api-reference/chat/completions/post#webpage\"},\"dateModified\":\"2025-09-13T04:41:14.274Z\",\"publisher\":{\"@id\":\"https://docs.paywalls.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.paywalls.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Paywalls.ai Documentation\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Paywalls.ai Documentation","nav":{"global":{"anchors":[{"anchor":"Website","icon":"globe","href":"https://paywalls.ai"},{"anchor":"Dashboard","icon":"gauge","href":"https://dashboard.paywalls.ai"}]},"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":""}]},{"tab":"API reference","groups":[{"group":"API documentation","pages":[{"title":"Introduction","description":"Here you’ll find detailed information on every endpoint, including request parameters, response formats, and examples.","icon":"book-open","href":"/api-reference/introduction"}]},{"group":"Chat completion","pages":[{"title":"Chat completion","openapi":"POST /chat/completions","href":"/api-reference/chat/completions/post"}]},{"group":"Models","pages":[{"title":"Models","description":"Lists all models available through the proxy, including pricing information per model.\n\nUseful for frontend model selectors or pricing calculators.\n","openapi":"GET /models","href":"/api-reference/models/get"}]},{"group":"User","pages":[{"title":"Get user balance","openapi":"GET /user/balance","href":"/api-reference/user/balance/get"},{"title":"Deposit credits","openapi":"POST /user/balance/deposit","href":"/api-reference/user/balance/deposit/post"},{"title":"Top up balance","openapi":"GET /user/balance/topup","href":"/api-reference/user/balance/topup/get"},{"title":"Charge user","openapi":"POST /user/charge","href":"/api-reference/user/charge/post"},{"title":"Authorize user","openapi":"GET /user/connect","href":"/api-reference/user/connect/get"},{"title":"Disconnect user","openapi":"GET /user/disconnect","href":"/api-reference/user/disconnect/get"}]},{"group":"Webhooks","pages":[{"title":"Subscribe to events","openapi":"POST /webhooks/subscriptions","href":"/api-reference/webhooks/subscriptions/post"},{"title":"List subscriptions","openapi":"GET /webhooks/subscriptions","href":"/api-reference/webhooks/subscriptions/get"},{"title":"Get a subscription","openapi":"GET /webhooks/subscriptions/{subscriptionId}","href":"/api-reference/webhooks/subscriptions/[subscriptionId]/get"},{"title":"Delete a subscription","openapi":"DELETE /webhooks/subscriptions/{subscriptionId}","href":"/api-reference/webhooks/subscriptions/[subscriptionId]/delete"},{"title":"Get delivery logs","openapi":"GET /webhooks/logs","href":"/api-reference/webhooks/logs/get"}]},{"group":"Webhook events","pages":[{"title":"Paywall updated","openapi":"Webhook paywall.updated","href":"/api-reference/webhooks/events/paywall-updated"},{"title":"Paywall archived","openapi":"Webhook paywall.archived","href":"/api-reference/webhooks/events/paywall-archived"},{"title":"Paywall secret rotated","openapi":"Webhook paywall.secret.rotated","href":"/api-reference/webhooks/events/paywall-secret-rotated"},{"title":"Integration connected","openapi":"Webhook paywall.integration.connected","href":"/api-reference/webhooks/events/paywall-integration-connected"},{"title":"Integration disconnected","openapi":"Webhook paywall.integration.disconnected","href":"/api-reference/webhooks/events/paywall-integration-disconnected"},{"title":"Stripe webhook rotated","openapi":"Webhook paywall.integration.stripe.webhook.rotated","href":"/api-reference/webhooks/events/paywall-integration-stripe-webhook-rotated"},{"title":"Authorization requested","openapi":"Webhook paywall.authorization.requested","href":"/api-reference/webhooks/events/paywall-authorization-requested"},{"title":"Authorization completed","openapi":"Webhook paywall.authorization.completed","href":"/api-reference/webhooks/events/paywall-authorization-completed"},{"title":"Authorization revoked","openapi":"Webhook paywall.authorization.revoked","href":"/api-reference/webhooks/events/paywall-authorization-revoked"},{"title":"Authorization declined","openapi":"Webhook paywall.authorization.declined","href":"/api-reference/webhooks/events/paywall-authorization-declined"},{"title":"Balance deposit recorded","openapi":"Webhook paywall.balance.deposit.created","href":"/api-reference/webhooks/events/paywall-balance-deposit-created"},{"title":"Top-up link created","openapi":"Webhook paywall.balance.topup.link.created","href":"/api-reference/webhooks/events/paywall-balance-topup-link-created"},{"title":"Trial credits granted","openapi":"Webhook paywall.balance.trial.granted","href":"/api-reference/webhooks/events/paywall-balance-trial-granted"},{"title":"Manual charge created","openapi":"Webhook paywall.balance.charge.created","href":"/api-reference/webhooks/events/paywall-balance-charge-created"},{"title":"Manual charge completed","openapi":"Webhook paywall.balance.charge.completed","href":"/api-reference/webhooks/events/paywall-balance-charge-completed"},{"title":"Manual charge failed","openapi":"Webhook paywall.balance.charge.failed","href":"/api-reference/webhooks/events/paywall-balance-charge-failed"},{"title":"Usage charge created","openapi":"Webhook paywall.usage.charge.created","href":"/api-reference/webhooks/events/paywall-usage-charge-created"},{"title":"Usage charge deferred","openapi":"Webhook paywall.usage.charge.deferred","href":"/api-reference/webhooks/events/paywall-usage-charge-deferred"},{"title":"Usage rate limited","openapi":"Webhook paywall.usage.rate.limited","href":"/api-reference/webhooks/events/paywall-usage-rate-limited"},{"title":"Balance depleted","openapi":"Webhook paywall.balance.depleted","href":"/api-reference/webhooks/events/paywall-balance-depleted"},{"title":"Request blocked","openapi":"Webhook paywall.request.blocked","href":"/api-reference/webhooks/events/paywall-request-blocked"},{"title":"Stripe checkout completed","openapi":"Webhook paywall.stripe.checkout.session.completed","href":"/api-reference/webhooks/events/paywall-stripe-checkout-session-completed"},{"title":"Proxy request started","openapi":"Webhook paywall.proxy.request.started","href":"/api-reference/webhooks/events/paywall-proxy-request-started"},{"title":"Proxy request completed","openapi":"Webhook paywall.proxy.request.completed","href":"/api-reference/webhooks/events/paywall-proxy-request-completed"},{"title":"Proxy request failed","openapi":"Webhook paywall.proxy.request.failed","href":"/api-reference/webhooks/events/paywall-proxy-request-failed"},{"title":"Proxy request canceled","openapi":"Webhook paywall.proxy.request.canceled","href":"/api-reference/webhooks/events/paywall-proxy-request-canceled"},{"title":"Proxy request blocked","openapi":"Webhook paywall.proxy.request.blocked","href":"/api-reference/webhooks/events/paywall-proxy-request-blocked"}]}]}]},"basePath":"","title":"Chat completion - Paywalls.ai Documentation","buildId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","deploymentId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-CS552b7R.js","utils-DDTCYAF2.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-De8ttokP.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-DrwRDvAh.js","snippetPresets-DtAN0nWx.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-D5rWArI6.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-O2i12wsz.js","shallow-DV8xABTt.js","getApiPlaygroundDisplay-DBZ0B5Jx.js","CodeSnippet-BVi0tPUX.js","CodeSnippets-CqASbIwY.js","Page-m07pfKpT.js","getPastedJson-DG9vsMS8.js","icon-CXzRSCr8.js","MethodPill-BdKVtEuX.js","DuplicateIcon-CZlmBrJI.js","createIcon-biFEUKPL.js","DynamicMarkdown-B54_zNBF.js","SectionHeading-DwwHK3Pt.js","axios-vUo_bRtp.js","Markdown-DfhCTwyA.js","clsx-xpJZXxdP.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-BTZUMDnx.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-DqdKa2R4.js"]}