Browse the docsOpenWorld

Image

POSThttps://labs-api.petpooja.com/v1/chat/completions

Send the image as a base64 data URI inside an image_url content part, alongside a text part describing the output you want. The text part is what makes this endpoint OpenWorld - ask for JSON with seller, buyer and line items, and that is what you get back.

Request body

FieldTypeDescription
modelstringrequiredMust be chitragupta. Anything else returns 404 model_not_found.
messagesarrayrequiredRoles user and assistant only. A system message returns 422 system_message_not_allowed - the system prompt is owned server-side so behaviour stays consistent for every caller.
messages[].content[]arrayrequiredMix of text parts and image_url parts. Each image_url.url is a data URI: data:image/jpeg;base64,…. Up to 10 images per request.
max_tokensintegerOptional. Defaults to 40000, which is also the ceiling.
import base64, mimetypes
from openai import OpenAI

API_KEY  = "Your API Key"
BASE_URL = "https://labs-api.petpooja.com/v1/"
MODEL    = "chitragupta"

client = OpenAI(api_key=API_KEY, base_url=BASE_URL)

IMAGE_PATH = "<IMAGE_PATH>"

mime = mimetypes.guess_type(IMAGE_PATH)[0] or "image/jpeg"
img_b64 = base64.b64encode(open(IMAGE_PATH, "rb").read()).decode()
image_data_uri = f"data:{mime};base64,{img_b64}"

response = client.chat.completions.create(
  model=MODEL,
  messages=[{
    "role": "user",
    "content": [
      {"type": "text", "text": ""},
      {"type": "image_url", "image_url": {"url": image_data_uri}},
    ],
  }],
)
print(response)

PDF

POSThttps://labs-api.petpooja.com/v1/chat/completions

Send the PDF as a base64 data URI inside a file content part. Every page is rendered to an image server-side and sent to the model in a single call, so the model can reason across pages - carry-forward totals, continuation tables, a summary on page 3 that refers to page 1.

Page budget

Rendered PDF pages and loose images share one budget of 10 per request. A 7-page PDF leaves room for 3 images. Exceed it and the request returns 413 page_limit_exceeded - split it, or use Default, which allows 25.

Request body

FieldTypeDescription
modelstringrequiredMust be chitragupta.
file.file_datastringrequiredData URI of the PDF: data:application/pdf;base64,….
file.filenamestringOptional label echoed into logs. Useful when you send more than one document.
import base64
from openai import OpenAI

API_KEY  = "Your API Key"
BASE_URL = "https://labs-api.petpooja.com/v1/"
MODEL    = "chitragupta"

client = OpenAI(api_key=API_KEY, base_url=BASE_URL)

PDF_PATH = "<PDF_PATH>"

pdf_b64 = base64.b64encode(open(PDF_PATH, "rb").read()).decode()
pdf_data_uri = f"data:application/pdf;base64,{pdf_b64}"

response = client.chat.completions.create(
  model=MODEL,
  messages=[{
    "role": "user",
    "content": [
      {"type": "text", "text": "Extract the invoice information from this document as JSON."},
      {"type": "file", "file": {"filename": "invoice.pdf", "file_data": pdf_data_uri}},
    ],
  }],
)

print(response)