Skip to main content
POST
/
document
/
{documentId}
/
chat
/
completions
cURL
curl -X POST https://api.okrapdf.com/document/my-doc/chat/completions \
  -H "Authorization: Bearer okra_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [{"role": "user", "content": "What is the total revenue?"}]
  }'
{
  "id": "<string>",
  "choices": [
    {
      "message": {
        "role": "<string>",
        "content": "<string>"
      },
      "finish_reason": "<string>"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}
OpenAI compatible. Use the official OpenAI SDK by pointing base_url at https://api.okrapdf.com/document/{documentId}.

Authorizations

Authorization
string
header
required

API key as Bearer token: Authorization: Bearer okra_xxx

Path Parameters

documentId
string
required

Document ID

Body

application/json
messages
object[]
required
stream
boolean
default:false
model
string

Override model (default is platform default)

Response

Chat completion response (OpenAI format)

OpenAI-compatible chat completion response

id
string
choices
object[]
usage
object