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
| Provider | Documentation |
|---|---|
| Azure AI Foundry | Azure AI Foundry |
| Cerebras | Cerebras |
| Groq | Groq |
| Hugging Face | Hugging Face |
| Keywords AI | Keywords AI |
| Llama API | Llama API |
| LiteLLM | LiteLLM |
| LM Studio | LM Studio |
| Ollama | Ollama |
| OpenRouter | OpenRouter |
| Together AI | Together AI |
| Tinfoil | Tinfoil |
| Unify AI | Unify AI |
| Vercel AI Gateway | Vercel AI Gateway |
| vLLM | vLLM |
BAML-Specific Options
| Option | Type | Default | Description |
|---|---|---|---|
base_url | string | https://api.openai.com/v1 | API base URL |
api_key | string | (none) | API key for Authorization header |
headers | object | - | 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
| Option | Type | Description |
|---|---|---|
model | string | Model identifier |
temperature | float | Sampling temperature |
max_tokens | int | Maximum response tokens |
top_p | float | Nucleus sampling |
See the OpenAI API documentation for all options.