Add a custom provider
add_providerRegister any OpenAI-compatible image endpoint, auto-discover its image models, and save it for reuse in image generation.
Instructions
Register any OpenAI-compatible image endpoint and remember it for later.
Use this when the user names an endpoint like https://api.example.com/v1.
The server probes {base_url}/models, figures out which models can produce
images, saves the provider to the config file, and makes it available to
generate_image immediately and on every future run.
Parameters
id:
Short handle used in provider:model specs (e.g. example).
Lowercase letters, digits, - and _.
base_url:
The OpenAI-compatible API root, e.g. https://api.example.com/v1.
api_key:
Optional bearer token, stored in the gitignored config file so it
survives restarts. Prefer api_key_env if you would rather keep the
secret in an environment variable.
api_key_env:
Name of an env var holding the key (ignored when api_key is given).
Leave both unset for endpoints that need no auth.
default_model:
Model id to use by default. If omitted and exactly one image model is
found, it is selected automatically.
dialect:
auto (default), images (/images/generations) or chat
(/chat/completions with image modalities). auto uses the Images
API and transparently falls back to chat-completions on 404/405.
make_default:
Also set this provider's model as the global default model.
discover:
Set false to skip the /models probe (required for endpoints
that do not implement it).
Returns the discovered models plus any warnings; inspect models and, if
there are several, call set_default_model to choose one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| api_key | No | ||
| dialect | No | auto | |
| base_url | Yes | ||
| discover | No | ||
| size_style | No | ||
| api_key_env | No | ||
| make_default | No | ||
| default_model | No | ||
| extra_headers | No | ||
| exclude_models | No | ||
| include_models | No | ||
| aspect_ratio_mode | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||