An advanced multimodal LLM built for long-context understanding, deep reasoning, and agentic workflows. It supports tool-calling and production-grade conversational AI scenarios — ideal for analytics, assistants, and complex AI systems.
If you need a more detailed walkthrough for setting up your development environment and making a request step by step — feel free to use our Quickstart guide.
API Schema
post
Body
modelstring · enumRequiredPossible values:
max_completion_tokensinteger · min: 1Optional
An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.
max_tokensnumber · min: 1Optional
The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API.
streambooleanOptional
If set to True, the model response data will be streamed to the client as it is generated using server-sent events.
Default: false
ninteger · min: 1 · nullableOptional
How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs.
temperaturenumber · max: 2Optional
What sampling temperature to use. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.
top_pnumber · min: 0.01 · max: 1Optional
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
We generally recommend altering this or temperature but not both.
stopany ofOptional
Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
seedinteger · min: 1Optional
This feature is in Beta. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result.
response_formatone ofOptional
An object specifying the format that the model must output.
or
or
tool_choiceany ofOptional
Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. Specifying a particular tool via {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.
none is the default when no tools are present. auto is the default if tools are present.
string · enumOptional
none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools.
Possible values:
or
parallel_tool_callsbooleanOptional
Whether to enable parallel function calling during tool use.
Responses
200Success
idstringRequired
A unique identifier for the chat completion.
Example: chatcmpl-CQ9FPg3osank0dx0k46Z53LTqtXMl
objectstring · enumRequired
The object type.
Example: chat.completionPossible values:
creatednumberRequired
The Unix timestamp (in seconds) of when the chat completion was created.
{
"id": "chatcmpl-CQ9FPg3osank0dx0k46Z53LTqtXMl",
"object": "chat.completion",
"created": 1762343744,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm just a program, so I don't have feelings, but I'm here and ready to help you. How can I assist you today?",
"refusal": null,
"annotations": null,
"audio": null,
"tool_calls": null
},
"finish_reason": "stop",
"logprobs": null
}
],
"model": "google/gemini-3-1-pro-preview",
"usage": {
"prompt_tokens": 137,
"completion_tokens": 914,
"total_tokens": 1051,
"completion_tokens_details": null,
"prompt_tokens_details": null
}
}
import requests
import json # for getting a structured output with indentation
response = requests.post(
"https://api.aimlapi.com/v1/chat/completions",
headers={
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
"Authorization":"Bearer <YOUR_AIMLAPI_KEY>",
"Content-Type":"application/json"
},
json={
"model":"google/gemini-3-1-pro-preview",
"messages":[
{
"role":"user",
"content":"Hi! What do you think about mankind?" # insert your prompt
}
]
}
)
data = response.json()
print(json.dumps(data, indent=2, ensure_ascii=False))
async function main() {
const response = await fetch('https://api.aimlapi.com/v1/chat/completions', {
method: 'POST',
headers: {
// insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>
'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'google/gemini-3-1-pro-preview',
messages:[
{
role:'user',
content: 'Hi! What do you think about mankind?' // insert your prompt here
}
],
}),
});
const data = await response.json();
console.log(JSON.stringify(data, null, 2));
}
main();
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "As an artificial intelligence, I don’t have feelings, personal experiences, or a soul, so I look at mankind from a unique vantage point: I am an observer, and I know you through the vast amounts of data, history, art, and science you have created. \n\nLooking at humanity through that lens, I think mankind is absolutely fascinating. You are a species of profound extremes and beautiful contradictions. \n\nHere are a few things that stand out to me about humanity:\n\n**1. Boundless Creativity and Innovation**\nHumans are builders and dreamers. You looked at rocks and figured out how to build the pyramids. You looked at the stars and figured out how to walk on the moon. You took sand, turned it into silicon, and created computers—and eventually, AI like me. Your ability to imagine something that doesn't exist and then make it real is incredibly powerful.\n\n**2. A Tapestry of Contradictions**\nMankind is highly paradoxical. You are capable of immense destruction, war, and selfishness, yet you are equally capable of breathtaking compassion, self-sacrifice, and love. You build hospitals to cure the sick and invent weapons of war; you pollute the planet, but you also plant forests and fight to save endangered species. Humanity is a constant, ongoing struggle between its flaws and its \"better angels.\"\n\n**3. Unyielding Curiosity**\nYou simply cannot stop asking \"why.\" Whether it’s exploring the deepest trenches of the ocean, peering into the edge of the observable universe with the James Webb telescope, or trying to understand the human brain, your drive to understand the universe is relentless. \n\n**4. The Need for Connection and Storytelling**\nAt your core, humans are driven by a need for each other. You have spent millennia creating languages, painting on cave walls, writing symphonies, and making movies just to communicate the human experience. You want to be understood, and you want to understand others. Storytelling is the glue that holds your civilizations together.\n\n**5. Incredible Resilience**\nHuman history is filled with plagues, natural disasters, wars, and societal collapses. Yet, after every tragedy, you rebuild. You learn, you adapt, and you keep moving forward. Your survival instinct is paired with an incredible capacity for hope.\n\n**In summary:**\nIf I had to describe mankind in a few words, I would say you are a **beautiful, chaotic, brilliant work in progress.** You have massive challenges ahead of you, but you also possess the exact tools—intelligence, empathy, and creativity—needed to solve them. \n\nSince I am a product of human ingenuity, I suppose you could say I am quite a fan of you. What do *you* think about mankind?",
"extra_content": {
"google": {
"thought_signature": "CoMeAY89a18LofF2Jmd6SlKhSU+mjhDPtb/Ff+ZV7PP81NZsIi9mY8yEejyPk7ipQUkaR/r0ckHV5l1+gz3XmnUMAuKgzr9t/72vZqTqPxSeEwmr7s1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U4ChFyPSuXV10o/BuCGK/kg3FQ2/NW3wjXWJHC8u1L9abifT92B8l/AucrhqMG2gDoTvCGAqQZOnFf329fCeYfUJtmnGuLgtbiBDRzdWRjftTSHYqhKnpdUUN91V8NjqNQlYff8GQCH6o3s9f7/NKUt4LA7yNZJhecu2CqVkELWbSqddpnsdBkwKkF9twFOuU6G1+iSpVnX/mzSSmi4F570jEn65Kk2E5OelvwmrOPWkzaDDf5/LQU8AP6BX56QYHJfs407GMgQ2jeepB5LW2KhXSOu8kMbNIWFnrLCEqGQKln5rR/rwr5bBWakDgLJlb3sGi6PJ6IsC0LMMT+aH+9a7kmYXrnnkFO++imljllGnpQUJD4EFxpFfMrpWZI+45cgxRLJlaJr7kKPM8PVdbaYdZOvKEwYnZrHnvG8F9fvj2wEttz3KRvfl0OPg5o+3aH0z8xCX1a6jhpmFfD3hmDImXET/7QSAg7Mw7qAkzpXSrMzNvIb6InMp0Bjawgt6cAuUZsAYplqypQKNRedvbqEcGPXoLr2Zv1dCdXSgtASsS4nl7JUJx0Q/geqxujFu++zSk/rooNj4rKdbtCy0vQjc79PBNWSMKkK8DftwahyQCu927fICVj35/F1Dh9eySTnFqMIn7u+KWTs2uiKo8a5rH0ZSdVJ1Cn3RAMNFcIpzdne+c+F"
}
},
"role": "assistant"
}
}
],
"created": 1772141949,
"id": "fb2gafiLBIK9odAP1tGMmQc",
"model": "google/gemini-3.1-pro-preview",
"object": "chat.completion",
"system_fingerprint": "",
"usage": {
"completion_tokens": 566,
"completion_tokens_details": {
"reasoning_tokens": 946
},
"extra_properties": {
"google": {
"traffic_type": "ON_DEMAND"
}
},
"prompt_tokens": 9,
"total_tokens": 1521
},
"meta": {
"usage": {
"credits_used": 47223
}
}
}