[Bug]: Cannot use Prompt Management w/ API Gateway & Gemini
What happened?
Hello,
I linked my Gemini Provider API Key in Helicone and I can use it for normal use-cases with the OpenAI Client. However, I cannot use the Prompt Management feature, because I get the following error: TypeError: Missing required arguments; Expected either ('messages' and 'model') or ('messages', 'model' and 'stream') arguments to be given.
This is my code:
import openai
import os
from dotenv import load_dotenv
load_dotenv()
client = openai.OpenAI(
base_url="https://ai-gateway.helicone.ai",
api_key=os.environ.get("HELICONE_API_KEY")
)
response = client.chat.completions.create(
model="gemini-2.5-flash",
prompt_id="my_id",
environment="production",
inputs={"name": "John Doe"}
)
The prompt exists in my dashboard, and I can use it on the playground. I am using the latest OpenAI version (2.8.1) but I also tried older versions up to 0.28.1 and had no success. Why is this?
Relevant log output
Twitter / LinkedIn details
No response
Hi @konrad-brueggemann-liqid , pass the prompt_id, environment, and inputs in extra_body.
@connortbot in a similar sitation, using google studio ai byok. This is the code -
const response = await heliconeClient.chat.completions.create({
model: "gemini-2.5-pro",
prompt_id: "Eha5Ss",
environment: getPromptEnvironment(),
inputs: {
email_body: emailBody,
},
} as any,
{
headers: {
"Helicone-Property-SupplierId": '',
},
}
);
Throws -
[
{
"error": {
"code": 400,
"message": "* GenerateContentRequest.contents: contents is not specified\n",
"status": "INVALID_ARGUMENT"
}
}
]
I was under the impression that converting the open AI format to google format would be handled by helicone AI gateway, so this should be handled right?
The prompt i am using has the input type as string ( could this be an issue?). Is it because the whole prompt is withing system and I need to add something to user?
Also the other place in same codebase I am using helicone it works -
const response = await heliconeClient.chat.completions.create(
{
model: "gemini-2.5-pro/google-ai-studio",
prompt_id: "oTfUzo",
environment: getPromptEnvironment(),
messages: [
{
role: "user",
content: [
{
type: "image_url",
image_url: {
url: `data:${mimeType};base64,${base64Image}`,
},
},
],
},
],
} as any,
{
headers: {
"Helicone-Property-SupplierId": '',
},
}
);
@foxy17 see the above comment, you should be placing the prompt parameters in extra_body. The errors should be clearer though, will work on that :)