ShareAI Platform Docs

Send chat requests with OAuth

Use an approved ShareAI OAuth access token for customer-funded chat completions and handle token expiry, consent and account boundaries.

View as Markdown
On this page

Choose this path when a customer has authorized your application to use their selected ShareAI account. First complete authorization code with PKCE and obtain a grant that includes surcharge.

POST https://api.shareai.now/api/v1/chat/completions

Run inference under the customer’s accepted application agreement.

Base URL
https://api.shareai.now
Authentication
Bearer OAuth access token
Required scope
surcharge

cURL

curl --fail-with-body https://api.shareai.now/api/v1/chat/completions \
  -H "Authorization: Bearer $SHAREAI_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"model":"MODEL_IDENTIFIER","messages":[{"role":"user","content":"Hello!"}],"stream":false}'

The access token goes in the Bearer header#

The chat endpoint and request body are the same as the API-key flow. The difference is the credential and its authorization lifecycle. A refresh token is sent only to the token endpoint; an ID token is used only for validated application sign-in.

Who pays and which plan applies?#

The accepted grant identifies the selected personal or organization account, application and usage plan. The service determines those values from the authorization. Do not send a payer ID, builder fee or another client’s subject in the chat body to change billing.

When the access token expires, use the refresh flow on your backend and store the replacement refresh token. When the grant is revoked or new consent is required, reconnect the customer through the browser flow.

Failure handling#

ResultAction
401 consent_requiredAsk the customer to reconnect if the authorization is no longer valid.
403Check granted inference permission and allowed model/provider access.
429Respect Retry-After and your application/account limits.
503 temporarily_unavailableShow a temporary service error; do not tell the customer that consent was revoked.

Last updated September 15, 2026

ShareAI Platform Docs
All documentation

Search by title or content.

Ask about this page

Choose an assistant to explore this page. You can also copy the page and paste it into your conversation.

Ask ChatGPTAsk ClaudeAsk GrokAsk ShareAI