Skip to main content
POST
/
v1
/
chat
/
completions
Chat Completions API
curl --request POST \
  --url https://extraction-api.nanonets.com/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "nanonets/Nanonets-OCR-s",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "file_url",
          "file_url": {
            "url": "https://example.com/doc.pdf"
          }
        },
        {
          "type": "text",
          "text": "Extract the text from the document."
        }
      ]
    }
  ]
}
'
{}

Authorizations

Authorization
string
header
required

API key as Bearer token: Authorization: Bearer YOUR_API_KEY

Body

application/json

OpenAI chat completions payload. Provide model, messages, and optional stream.

model
string
required

Model identifier (e.g., nanonets/Nanonets-OCR-s)

messages
object[]
required

Chat messages array

stream
boolean
default:false

Enable SSE streaming

Response

Chat completion response (JSON) or SSE stream when stream=true.

OpenAI-compatible chat completion response.