There is no Upfyn SDK package, and that is on purpose. The API speaks the OpenAI dialect, so the official openai client works — a widely used, well-tested library rather than one we would maintain in our spare time.
Install#
pip install openai
Point it at Upfyn#
Two settings: the base URL and your key.
from openai import OpenAIclient = OpenAI(base_url="https://ai.upfyn.com/v1",api_key=os.environ["UPFYN_API_KEY"],)
What works#
| SDK method | Supported |
|---|---|
chat.completions.create | Yes — streaming and non-streaming, tools, structured outputs. |
models.list | Yes. |
files.* | Yes — create, list, retrieve, content, delete. |
images.generate | Yes. |
images.edit | Yes. |
audio.speech.create | Yes. |
audio.transcriptions.create | Yes. |
responses.* | Yes. |
What is not there
embeddings, moderations, batches, legacy completions, fine_tuning, assistants and vector_stores do not exist. Calling any of them returns a 404.Sending Upfyn-only fields#
session_id, persist_session, chat_ref and upfyn_tag are not in the OpenAI schema, so a typed client will not let you pass them directly. Use the escape hatch.
Python
client.chat.completions.create(model="upfyn-yuva",messages=messages,extra_body={"persist_session": True, "upfyn_tag": "billing-bot"},)
Where to go next
Python and TypeScript have full worked examples; OpenAI compatibility lists every difference that could surprise you.