Gemini 3.1 Pro Preview Custom Tools overview
Gemini 3.1 Pro Preview Custom Tools specs
- Model ID
google/gemini-3.1-pro-preview-customtools- Developer
- Context window
- 1,048,756 tokens
- Max output
- 65,536 tokens
- Input
- Image, Text
- Output
- Text
- API
- OpenAI-compatible, base URL
https://api.aimlapi.com/v1
What is Gemini 3.1 Pro Preview Custom Tools API?
Where to Use Gemini 3.1 Pro Preview Custom Tools
Coding and code review
Generate, debug, and review code across languages, reading whole files or repos in a single prompt.
Agentic and multi-step workflows
Reliable tool-calling and instruction-following suit agent loops that plan, call tools, and iterate.
Use cases
Gemini 3.1 Pro Preview Custom Tools is suited to agentic workflows that use custom tools and bash, especially when the model should prioritize registered custom tools like file or code-search tools.
It is documented as a good fit for AI coding assistants that rely on structured tools such as file viewing and editing, rather than defaulting to bash.
It is also suited to DevOps agents that need to call CI/CD systems through tools, as well as MCP workflows that orchestrate multi-step tool-based processes.
Another documented use case is agent applications that require permission-controlled tools and structured logging for auditing or compliance.
Capabilities
- Function calling
- Reasoning
- Streaming
- Structured outputs
- Web search
Gemini 3.1 Pro Preview Custom Tools API pricing
| Usage | Price | Unit |
|---|---|---|
| Input | $2.12 | 1M tokens |
| Output | $12.7 | 1M tokens |
| Cached input | $0.2116 | 1M tokens |
Prices from the AI/ML API price list, checked on Nov 4, 2026.
Gemini 3.1 Pro Preview Custom Tools vs other models: token prices
AI/ML API input and output rates for 5 models, per million tokens.
| Model | Input | Output |
|---|---|---|
| $2.12 | $12.7 | |
| $0.3 | $2.5 | |
| $0.75 | $3.75 | |
| $0.75 | $3.75 | |
| $2 | $10 |
How to use the Gemini 3.1 Pro Preview Custom Tools API
View docsBuild with your agent
Give your agent the model details, code and documentation.
1Get your API key
Create API keyexport AIMLAPI_KEY="8f2b4c7d9a1e6b3f…"2Make your first request
curl 'https://api.aimlapi.com/v1/chat/completions' \
-H "Authorization: Bearer $AIMLAPI_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "google/gemini-3.1-pro-preview-customtools",
"messages": [
{
"role": "user",
"content": "Write a haiku about the ocean."
}
]
}'import os
import requests
headers = {
"Authorization": f"Bearer {os.environ['AIMLAPI_KEY']}",
"Content-Type": "application/json",
}
payload = {
"model": "google/gemini-3.1-pro-preview-customtools",
"messages": [
{
"role": "user",
"content": "Write a haiku about the ocean."
}
]
}
response = requests.post("https://api.aimlapi.com/v1/chat/completions", headers=headers, json=payload, timeout=120)
response.raise_for_status()
print(response.json())const response = await fetch("https://api.aimlapi.com/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AIMLAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "google/gemini-3.1-pro-preview-customtools",
"messages": [
{
"role": "user",
"content": "Write a haiku about the ocean."
}
]
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());Related articles
Gemini 3.1 Pro Preview Custom Tools FAQ
What is the context window of Gemini 3.1 Pro Preview Custom Tools?
Gemini 3.1 Pro Preview Custom Tools has a 1,048,756 tokens context window and can return up to 65,536 tokens.
What inputs and outputs does Gemini 3.1 Pro Preview Custom Tools support?
Gemini 3.1 Pro Preview Custom Tools takes image, text as input and returns text.
What is the model ID for Gemini 3.1 Pro Preview Custom Tools?
Use google/gemini-3.1-pro-preview-customtools as the model id. Requests go to https://api.aimlapi.com/v1/chat/completions.
How much does Gemini 3.1 Pro Preview Custom Tools cost?
Gemini 3.1 Pro Preview Custom Tools costs $2.12 input and $12.7 output per 1M tokens on AI/ML API, billed as you go with no subscription.
Does Gemini 3.1 Pro Preview Custom Tools support streaming?
Yes, Gemini 3.1 Pro Preview Custom Tools can stream responses as they are generated.
Can Gemini 3.1 Pro Preview Custom Tools read images?
Yes, Gemini 3.1 Pro Preview Custom Tools accepts image input alongside text.
Who created Gemini 3.1 Pro Preview Custom Tools?
Gemini 3.1 Pro Preview Custom Tools was built by Google.
What kinds of tasks is Gemini 3.1 Pro Preview Custom Tools suited for?
It supports function calling, reasoning, structured outputs, web search, and parallel tool calls, making it suited for tasks that combine multi-step reasoning with tool use.

