OpenAI compatibility
Bayle’s API is shaped like OpenAI’s, so an OpenAI SDK works against it once you change the base
URL and the key. Error responses use OpenAI’s envelope and its type vocabulary too, which means
an SDK’s exception mapping keeps working without changes.
Changing the base URL
Section titled “Changing the base URL”import osfrom openai import OpenAI
client = OpenAI( api_key=os.environ["BAYLE_API_KEY"], base_url="https://api.bayle.ai",)import OpenAI from 'openai'
const client = new OpenAI({ apiKey: process.env.BAYLE_API_KEY, baseURL: 'https://api.bayle.ai',})import ( "os"
"github.com/openai/openai-go" "github.com/openai/openai-go/option")
client := openai.NewClient( option.WithAPIKey(os.Getenv("BAYLE_API_KEY")), option.WithBaseURL("https://api.bayle.ai"),)# Many tools read these directly, so no code change is needed at all.export OPENAI_API_KEY="$BAYLE_API_KEY"export OPENAI_BASE_URL="https://api.bayle.ai"The last tab is worth knowing about: agentic CLIs and editor integrations that speak to an
OpenAI-compatible endpoint usually pick up OPENAI_BASE_URL and OPENAI_API_KEY without any
configuration of their own.
Where behaviour differs
Section titled “Where behaviour differs”Three of these will surprise a client written against OpenAI’s defaults. All three are on the images endpoint.
| OpenAI | Bayle | |
|---|---|---|
| Images per request | n up to 10, model depending |
At most 1; a higher n is rejected |
response_format: "url" |
A fetchable https:// link |
A base64 data: URI in the url field |
response_format omitted |
Defaults to url |
Returns b64_json, with no url field at all |
Extra fields in responses
Section titled “Extra fields in responses”Bayle returns a few fields beyond OpenAI’s published schema. An SDK ignores what it doesn’t recognize, so these are additive rather than breaking:
cost, an object breaking out what the request cost by the balance it was drawn from.service_tier, the tier that served the request.reasoning_contentandthought_signatureinside a streameddelta, for reasoning-capable models. Both are null for models that don’t reason.
What Bayle does not serve
Section titled “What Bayle does not serve”The API surface is exactly the eight operations in the reference. There is no assistants API, no files API, no fine-tuning, no moderations endpoint, and no audio endpoints. A call to anything not listed there will not find a route.
Beyond the OpenAI surface
Section titled “Beyond the OpenAI surface”Video generation has no equivalent in OpenAI’s API, so it doesn’t come along with an SDK. It’s a queue you poll, over four endpoints, and it is covered in the video guide.