Skip to main content

OpenAI Generic

The openai-generic provider supports any API using OpenAI's request/response format.

Basic Example​

client<llm> MyClient {
provider "openai-generic"
options {
base_url "https://api.provider.com"
model "<provider-specified-format>"
}
}

Compatible Providers​

ProviderDocumentation
Azure AI FoundryAzure AI Foundry
CerebrasCerebras
GroqGroq
Hugging FaceHugging Face
Keywords AIKeywords AI
Llama APILlama API
LiteLLMLiteLLM
LM StudioLM Studio
OllamaOllama
OpenRouterOpenRouter
Together AITogether AI
TinfoilTinfoil
Unify AIUnify AI
Vercel AI GatewayVercel AI Gateway
vLLMvLLM

BAML-Specific Options​

OptionTypeDefaultDescription
base_urlstringhttps://api.openai.com/v1API base URL
api_keystring(none)API key for Authorization header
headersobject-Additional request headers

Custom Headers​

client<llm> MyClient {
provider "openai-generic"
options {
base_url "https://api.provider.com"
model "model-name"
headers {
"X-My-Header" "my-value"
}
}
}

Reasoning Models​

warning

For reasoning models (o1, o1-mini), use max_completion_tokens instead of max_tokens:

client<llm> ReasoningClient {
provider "openai-generic"
options {
model "o4-mini"
max_tokens null
}
}

Provider Parameters​

OptionTypeDescription
modelstringModel identifier
temperaturefloatSampling temperature
max_tokensintMaximum response tokens
top_pfloatNucleus sampling

See the OpenAI API documentation for all options.

See Also​