Clatter LabsHelp Center

Can I use OpenAI and the Model API in the same Python program?

How-toUpdated
import os
from openai import OpenAI

clatter = OpenAI(
    base_url="https://api.gateway.clatterlabs.xyz/v1",
    api_key=os.environ["CLATTER_API_KEY"],
    default_headers={"X-Clatter-Account": os.environ["CLATTER_ACCOUNT_ID"]},
)
other = OpenAI()  # reads its own key from OPENAI_API_KEY

r = clatter.chat.completions.create(model="supercosmos-flash", messages=[{"role": "user", "content": "Hi"}])

Keep the clients separate so a Clatter Labs key is never sent to another provider by accident, and vice versa.

Good to know#

Still need help?#

We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Related articles

Still need help?

Tried the steps above and still stuck? Email us. We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Infrastructure questions, or permanent deletion of your data
infrastructure@clatterlabs.xyz
For deleting your whole account or the data of one service.