import base64
from openai import OpenAI
client = OpenAI(
base_url="https://hub.oxen.ai/api/ai",
api_key="YOUR_API_KEY",
)
with open("report.pdf", "rb") as f:
file_data = "data:application/pdf;base64," + base64.standard_b64encode(f.read()).decode()
response = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[
{
"role": "user",
"content": [
{"type": "file", "file": {"filename": "report.pdf", "file_data": file_data}},
{"type": "text", "text": "Summarize the key findings."},
],
}
],
)
print(response.choices[0].message.content)