OpenAI-compatible config generator
The base URL, model and key variable for an OpenAI-compatible endpoint, written for the OpenAI SDK, LangChain, LlamaIndex, the Vercel AI SDK and cURL.
What it does
Many libraries speak OpenAI's API and take a base URL, so they can be pointed at any endpoint that speaks it too. Each one names the setting differently: base_url, baseURL, api_base or configuration.baseURL, with its own environment variables. Choose an endpoint and a library, and the tool writes the few lines that library needs:
- OpenAI SDK, Python and TypeScript;
- LangChain,
ChatOpenAIin Python and TypeScript; - LlamaIndex,
OpenAILike; - Vercel AI SDK,
createOpenAICompatible; - Environment variables, for code that reads its settings from the environment;
- cURL.
Try it: any endpoint with the OpenAI SDK, Gemini with LangChain, or Salyro with LlamaIndex.
The endpoints
- Another OpenAI-compatible endpoint: its base URL and a model id, as you enter them.
- OpenAI:
https://api.openai.com/v1, the OpenAI SDK's own default. - Anthropic (OpenAI SDK compatibility):
https://api.anthropic.com/v1/. Anthropic's page says this layer is primarily meant for testing and comparing models, not as a long-term or production solution for most uses. The tool says so too. - Google Gemini (OpenAI compatibility):
https://generativelanguage.googleapis.com/v1beta/openai/, from Google's own Gemini cookbook. - Salyro:
https://api.salyro.com/v1, as the API docs give it, with a model from Salyro's catalogue and the key inSALYRO_API_KEY.
xAI's OpenAI-compatible address could not be read from its documentation when these facts were compiled, so there is no xAI preset. Enter it as another endpoint.
Where the settings come from
What each library calls its base URL, key and model settings, and which environment variables it reads, is read off the library's own source at a named release. Each source is listed under the code with the date it was read:
- openai 3.19.2 (Python) and 7.23.0 (Node);
- langchain-openai 1.6.6 and @langchain/openai 1.5.13;
- llama-index-llms-openai-like 0.8.0;
- @ai-sdk/openai-compatible 3.0.57.
For example, LangChain reads OPENAI_API_BASE before OPENAI_BASE_URL. OpenAILike needs is_chat_model=True for an endpoint that serves only chat completions. The Vercel AI SDK reads no variable at all, so its code passes the key itself.
These are the settings each library takes. This tool does not say that a library is supported by an endpoint, or an endpoint by a library. Whether an endpoint serves everything a library asks of it is for the endpoint and the library to say.
The key
The tool never takes a key, only the name of the variable you keep it in. Every snippet reads the key from that variable. An address with a user and password, a query or anything shaped like a key in it is refused. A share link holds the settings; the address you entered is dropped from a "settings only" link.
What it does not know
- It does not call the endpoint, so it cannot tell whether the address or the model id is right.
- It covers chat models. Embeddings, images and audio are configured elsewhere in each library, and Salyro does not serve them.
- A library's newer release may name a setting differently. The release each snippet was checked against is listed with it.
Sources
The library facts are Reference Data, each with its source and the date it was read. The provider addresses come from OpenAI's SDK source, Anthropic's OpenAI SDK compatibility page and Google's Gemini cookbook. Salyro's address and key variable come from its API docs and Getting started, and its model ids from its catalogue.
Where the numbers come from
- Facts about models and providers that are not in that catalogue carry their own source and the date they were checked, and are shown as unknown where no reliable source exists.
- Model and pricing data is a snapshot of the catalogue Salyro itself uses, taken when this site was built.
