benepstein
09/20/2025, 9:53 PMopenai-generic i need to include custom headers to hardcode the gcloud auth print-access-token response into the client, which obviously doens't work. But if I try to use the vertex provider like this
client<llm> VertexGptOss120B2 {
provider "vertex-ai"
options {
model "openai/gpt-oss-120b-maas"
base_url "https://aiplatform.googleapis.com/v1/projects/{GCP_PROJECT}/locations/global/endpoints/openapi/chat/completions"
}
}
then baml includes the model in the URL, which is wrong, it needs to be included in the body, like so
curl \
-X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" https://$\{ENDPOINT\}/v1/projects/$\{PROJECT_ID\}/locations/$\{REGION\}/endpoints/openapi/chat/completions \
-d '{"model":"openai/gpt-oss-120b-maas", "stream":true, "messages":[{"role": "user", "content": "Summer travel plan to Paris"}]}'
can I include additional fields in the body?aaronv (BAML)
09/20/2025, 9:54 PMaaronv (BAML)
09/20/2025, 9:55 PMbenepstein
09/20/2025, 10:17 PMmodel but when you use vertex, that's a reserved word and it gets added to the url, because that's how it works for all their other deploymentsbenepstein
09/20/2025, 10:18 PMclient<llm> VertexGptOss120B2 {
provider "vertex-ai"
options {
model "openai/gpt-oss-120b-maas"
base_url "https://aiplatform.googleapis.com/v1/projects/{GCP_PROJECT}/locations/global/endpoints/openapi/chat/completions"
}
}
baml generates a url like this https://$\{ENDPOINT\}/v1/projects/$\{PROJECT_ID\}/locations/$\{REGION\}/endpoints/openapi/chat/completions/openai/gpt-oss-120b-maas because that's what the url setup for claude-vertex models areVaibhav (BAML ๐)
09/21/2025, 2:04 AMVaibhav (BAML ๐)
09/21/2025, 2:05 AMVaibhav (BAML ๐)
09/21/2025, 2:05 AMbenepstein
09/21/2025, 12:18 PMaaronv (BAML)
09/22/2025, 8:24 PMaaronv (BAML)
09/29/2025, 9:07 PMVaibhav (BAML ๐)
09/29/2025, 9:26 PMquiqueg
10/02/2025, 9:37 PMaaronv (BAML)
10/02/2025, 11:48 PMquiqueg
10/17/2025, 5:33 PMVaibhav (BAML ๐)
10/17/2025, 7:15 PMVaibhav (BAML ๐)
10/17/2025, 7:27 PMclient<llm> VertexGptOss120B2 {
provider "openai-generic"
options {
// deliberately empty
model ""
// actually fill these out
base_url "https://{GCP_REGION}-aiplatform.googleapis.com/v1beta1/{ENDPOINT_RESOURCE_NAME}"
api_key env.VERTEX_GPT_OSS_KEY
}
}
then when you call it:
python
import google.auth
creds, project = google.auth.default()
auth_req = google.auth.transport.requests.Request()
creds.refresh(auth_req)
# At runtime, overwrite the env var each time
result = b.MyFunctionName(..., baml_options={"env":{"VERTEX_GPT_OSS_KEY": creds.token}})
(technically this should work also via vertex ai, but to unblock you ๐Vaibhav (BAML ๐)
10/17/2025, 7:27 PMquiqueg
10/17/2025, 7:29 PMVaibhav (BAML ๐)
10/17/2025, 9:51 PMVaibhav (BAML ๐)
10/17/2025, 10:02 PMquiqueg
10/20/2025, 7:03 PMquiqueg
10/20/2025, 7:05 PM{"model":"openai/gpt-oss-120b-maas" in the request body