Every model, one key.
An OpenAI-compatible API for text, embeddings, images, and video. Point the client you already use at Bayle and keep going.
curl https://api.bayle.ai/chat/completions \ -H "Authorization: Bearer $BAYLE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "MODEL_ID", "messages": [{"role": "user", "content": "In one sentence, what is an embedding?"}] }'import osfrom openai import OpenAI
client = OpenAI( api_key=os.environ["BAYLE_API_KEY"], base_url="https://api.bayle.ai",)
completion = client.chat.completions.create( model="MODEL_ID", messages=[{"role": "user", "content": "In one sentence, what is an embedding?"}],)print(completion.choices[0].message.content)import OpenAI from 'openai'
const client = new OpenAI({ apiKey: process.env.BAYLE_API_KEY, baseURL: 'https://api.bayle.ai',})
const completion = await client.chat.completions.create({ model: 'MODEL_ID', messages: [{ role: 'user', content: 'In one sentence, what is an embedding?' }],})console.log(completion.choices[0].message.content)Endpoints
API referenceWhere to go next
Section titled “Where to go next”Bayle serves an HTTP API shaped like OpenAI’s, at https://api.bayle.ai. If you already have code
talking to an OpenAI-compatible endpoint, changing the base URL and the API key is usually the
whole integration.
Quickstart gets a first response back. Authentication covers the header and which endpoints need it.
OpenAI compatibility shows the base URL change per language, and the three places behaviour differs from OpenAI’s own API.
Text and streaming, embeddings, images, and video.
Errors lists every code the API returns, with the message and the OpenAI error type it maps to.
See what’s available, with capabilities and current status, at
the Models page. The /models guide covers
listing and filtering the same catalogue from the API itself.
Got a consent error?
Section titled “Got a consent error?”If a video request came back with 409 and "code": "needs_consent", that model needs a consent
attestation before it will generate media containing a face. Nothing was charged.
Resend the same request with a consents object added. The full walkthrough, including what to
show the person whose likeness appears in the media, is in
the video guide.