Can I use OpenAI and the Model API in the same Python program?
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#
- If calls fail unexpectedly, check status.clatterlabs.com before debugging further.
- Your key's account is responsible for your end users' text under the Abuse policy. What it means for apps
- Every call shows in Console › Logs and Usage as Model API, with its price. See what you spent
Still need help?#
- General support: support@clatterlabs.com or team@clatterlabs.xyz
- Infrastructure questions, or permanent deletion of your data (your whole account or one service): infrastructure@clatterlabs.xyz
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.xyzFor deleting your whole account or the data of one service.