Browse the docsImage

Image

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

Identical wire format to OpenWorld - so the OpenAI SDK works unchanged, just with base_url set to …/v1/extract. The difference is server-side: your text and system messages are discarded and the fixed extraction prompt runs against each image on its own.

Text is ignored

Sending "text": "only give me the invoice number" here does nothing - it is dropped before inference. If you need instruction-guided output, use OpenWorld.

import base64, mimetypes
from openai import OpenAI

API_KEY  = "Your API Key"
BASE_URL = "https://labs-api.petpooja.com/v1/extract"
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)