cURL option missing in "Get Code"

AI Studio’s “Get Code” button used to have a cURL option too. That seems to be missing now.

Any reason why this has been taken off, if done intentionally?

1 Like

Other developers have noticed that as well, and are not pleased with that change:

It would be best to bring that feature back.

I’ve noticed that too and I don’t know how to “make” the code for that. Do you know how i could implement the cURL option by myself?

Welcome to the forums!

Are you specifically trying to use cURL, or do you want the Gemini API REST protocol?

I have a copy of the curl command from another programme I used it for. You can fill in the variables and use it:

d=“{ ‘prompt’: { ‘text’: ‘$prompt’}, ‘temperature’: $TEMP, ‘top_k’: 40, ‘top_p’: 0.95, ‘candidate_count’: ${NUMBER}, ‘max_output_tokens’: 1024, ‘stop_sequences’: , ‘safety_settings’: [{‘category’:‘HARM_CATEGORY_DEROGATORY’,‘threshold’:1},{‘category’:‘HARM_CATEGORY_TOXICITY’,‘threshold’:1},{‘category’:‘HARM_CATEGORY_VIOLENCE’,‘threshold’:2},{‘category’:‘HARM_CATEGORY_SEXUAL’,‘threshold’:2},{‘category’:‘HARM_CATEGORY_MEDICAL’,‘threshold’:2},{‘category’:‘HARM_CATEGORY_DANGEROUS’,‘threshold’:2}]}”

output=$(curl
-H ‘Content-Type: application/json’
-X POST 'https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText?key='${API_KEY}
-d “${d}”)

Hi!

Thank you for helping. The issue that is discussed here is that the ease of use previously available to users of the REST API in AI Studio is no longer available, because the Get Code button removed that option from the tabbed display of available language options.

There still are code snippets available for people to use in the documentation Tutorial: Get started with the Gemini API  |  Google for Developers . And the Get Code feature made it easier to find or make more such snippets in the context the developer could best interact with.

1 Like