Code Execution
Official Documentation: https://ai.google.dev/gemini-api/docs/document-processing?hl=zh-cn
Endpoint
POST http://v98store.com/v1beta/models/gemini-2.5-flash:generateContent cURL Command
curl -X POST 'http://v98store.com/v1beta/models/gemini-2.5-flash:generateContent' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_TOKEN' \ -d '{ "contents": [ { "role": "user", "parts": [ { "text": "What is the sum of the first 50 prime numbers? Generate and run code for the calculation, and make sure you get all 50." } ] } ], "tools": [ { "codeExecution": {} } ] }' Parameters
| Name | In | Description | Required |
|---|---|---|---|
| key | query | Yes | |
| Content-Type | header | Yes |
Request Body
Example
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "What is the sum of the first 50 prime numbers? Generate and run code for the calculation, and make sure you get all 50."
}
]
}
],
"tools": [
{
"codeExecution": {}
}
]
} Responses
200 -
Example
undefined