Browse the docsAuthentication

Authentication

Every request carries your key in an Authorization: Bearer header. There are no other auth schemes, and keys are scoped to a single workspace.

HeaderDirectionDescription
AuthorizationstringrequestBearer <your_api_key>. Missing, malformed, or revoked keys return 401 invalid_api_key.
Content-TypestringrequestAlways application/json.
X-Request-IdstringresponseReturned on every response, success or failure. Log it - it is the handle our support team traces.
Retry-AftersecondsresponseSent with 429. Wait this long before retrying.
Keep it server-side

Usage is billed per page against the key that signs the request. Never ship a key to a browser or mobile client - proxy through your own backend.

import os
from openai import OpenAI

API_KEY  = os.environ["PETPOOJA_API_KEY"]      # <- set this env var, don't paste the key here
BASE_URL = "https://labs-api.petpooja.com/v1"
MODEL    = "chitragupta"

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

def show(r):
    """Pretty-print a response: request_id (for support), finish_reason, usage, content."""
    print("request_id   :", r.id.replace("chatcmpl-", ""))
    print("finish_reason:", r.choices[0].finish_reason,
          "  ('length' = answer was cut off by max_tokens)")
    print("usage        :", r.usage)
    print("=" * 78)
    print(r.choices[0].message.content)

print("Client ready ->", BASE_URL)