Skip to content
Try chatGet API key

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.

import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["BAYLE_API_KEY"],
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.

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

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_content and thought_signature inside a streamed delta, for reasoning-capable models. Both are null for models that don’t reason.

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.

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.