Theme
Code Execution
POST
https://www.kkiai.com/v1beta/models/gemini-2.5-pro:generateContent
Official documentation: https://ai.google.dev/gemini-api/docs/document-processing?hl=zh-cn
Request Parameters
Authorization
Add the Authorization parameter to the Header. Its value is the Token concatenated after Bearer.
Example: Authorization: Bearer ********************
Query Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
key | string | Required | {{YOUR_API_KEY}} |
Header Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
Content-Type | string | Required | application/json |
Body Parameters (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
contents | array[object] | Required | |
└ parts | array[object] | Optional |
Request Example
json
{
"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": {}
}
]
}cURL Example
bash
curl --location -g --request POST 'https://www.kkiai.com/v1beta/models/gemini-2.5-pro:generateContent?key=' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"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": {}
}
]
}'Response
🟢 200 Success
Response Example
json
{}