Grok 4.1 Fast is Now Available in Puter.js
On this page
Puter.js now supports Grok 4.1 Fast, giving developers access to xAI's latest frontier model.
What is Grok 4.1 Fast?
Grok 4.1 Fast is xAI's best tool-calling model with a 2M context window. It reasons and completes agentic tasks accurately and rapidly, excelling at complex real-world use cases such as customer support and finance.
Key Capabilities
Superior Tool Calling - Frontier-level agentic tool use trained across dozens of domains for real-world enterprise workflows
Long Context Performance - Consistent performance across full 2M token context window through long-horizon reinforcement learning
Advanced Search & Research - State-of-the-art real-time information retrieval with native X integration and web-browsing
Improved Factuality - Hallucination rate cut in half compared to Grok 4 Fast while maintaining equivalent accuracy
Agent Tools API Integration - Built-in server-side tools (web search, X search, code execution, MCP) managed entirely by xAI infrastructure
Examples
Text generation
puter.ai.chat("Explain neural networks simply", { model: 'x-ai/grok-4.1-fast' });
Tool calling
function getWeather(location) {
const mockWeatherData = {
'Paris': '22°C, Partly Cloudy',
'London': '18°C, Rainy',
'New York': '25°C, Sunny',
'Tokyo': '28°C, Clear'
};
return mockWeatherData[location] || '20°C, Unknown';
}
const tools = [{
type: "function",
function: {
name: "get_weather",
description: "Get current weather for a given location",
parameters: {
type: "object",
properties: {
location: {
type: "string",
description: "City name e.g. Paris, London"
}
},
required: ["location"]
}
}
}];
// Make initial request with tools
const userInput = "What's the weather in Paris?"
const completion = await puter.ai.chat(userInput, {
model: 'x-ai/grok-4.1-fast',
tools,
});
// Check if AI wants to call a function
if (completion.message.tool_calls?.length > 0) {
const toolCall = completion.message.tool_calls[0];
if (toolCall.function.name === 'get_weather') {
// Parse arguments and call the function
const args = JSON.parse(toolCall.function.arguments);
const weatherData = getWeather(args.location);
// Send result back to AI for final response
const finalResponse = await puter.ai.chat([
{ role: "user", content: userInput },
completion.message,
{
role: "tool",
tool_call_id: toolCall.id,
content: weatherData
}
], { model: 'x-ai/grok-4.1-fast' });
console.log(finalResponse);
}
}
Complex reasoning
puter.ai.chat("Compare the benefits and drawbacks of solar vs wind energy",
{ model: 'x-ai/grok-4.1-fast' }
);
Image analysis
puter.ai.chat(
"What is in this image?",
"https://assets.puter.site/doge.jpeg",
{ model: 'x-ai/grok-4.1-fast' }
);
Get Started Now
Just add one script tag to your HTML:
<script src="https://js.puter.com/v2/"></script>
No API keys and no infrastructure setup. Start building with Grok 4.1 Fast immediately.
Learn more:
Free, Serverless AI and Cloud
Start creating powerful web applications with Puter.js in seconds!
Get Started Now