Code Execution
POST
/v1beta/models/gemini-2.5-pro:generateContent
- Enable
tools.codeExecutionso the model can generate and run code - Suitable for calculations, data analysis, and other scenarios that require executing code
- Execution results are incorporated into the model's reply
- Official docs: Code execution
Authorizations
bearer
Type
HTTP (bearer)
Request Body
application/json
contents
object[]
Required
tools
object[]
Tools (including codeExecution)
Responses
Success
application/json
object