Impossibl
Access 76 Impossibl models through Mastra's model router. Authentication is handled automatically using the IMPOSSIBL_API_KEY environment variable.
Learn more in the Impossibl documentation.
.env
IMPOSSIBL_API_KEY=your-api-key
src/mastra/agents/my-agent.ts
import { Agent } from "@mastra/core/agent";
const agent = new Agent({
id: "my-agent",
name: "My Agent",
instructions: "You are a helpful assistant",
model: "impossibl/anthropic/claude-fable-5"
});
// Generate a response
const response = await agent.generate("Hello!");
// Stream a response
const stream = await agent.stream("Tell me a story");
for await (const chunk of stream) {
console.log(chunk);
}
info
Mastra uses the OpenAI-compatible /chat/completions endpoint. Some provider-specific features may not be available. Check the Impossibl documentation for details.
ModelsDirect link to Models
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|---|---|---|---|---|---|---|---|---|
impossibl/anthropic/claude-fable-5 | 1.0M | $10 | $50 | |||||
impossibl/anthropic/claude-haiku-4-5 | 200K | $1 | $5 | |||||
impossibl/anthropic/claude-opus-4-5 | 200K | $5 | $25 | |||||
impossibl/anthropic/claude-opus-4-6 | 1.0M | $5 | $25 | |||||
impossibl/anthropic/claude-opus-4-7 | 1.0M | $5 | $25 | |||||
impossibl/anthropic/claude-opus-4-8 | 1.0M | $5 | $25 | |||||
impossibl/anthropic/claude-sonnet-4-5 | 200K | $3 | $15 | |||||
impossibl/anthropic/claude-sonnet-4-6 | 1.0M | $3 | $15 | |||||
impossibl/anthropic/claude-sonnet-5 | 1.0M | $2 | $10 | |||||
impossibl/cerebras/gpt-oss-120b | 131K | $0.35 | $0.75 | |||||
impossibl/deepseek/deepseek-v4-flash | 1.0M | $0.19 | $0.51 | |||||
impossibl/deepseek/deepseek-v4-pro | 1.0M | $2 | $3 | |||||
impossibl/fireworks/glm-5.2 | 1.0M | $1 | $4 | |||||
impossibl/fireworks/gpt-oss-120b | 131K | $0.15 | $0.60 | |||||
impossibl/fireworks/gpt-oss-20b | 131K | $0.07 | $0.30 | |||||
impossibl/google/gemini-2.5-flash | 1.0M | $0.30 | $3 | |||||
impossibl/google/gemini-2.5-flash-lite | 1.0M | $0.10 | $0.40 | |||||
impossibl/google/gemini-2.5-pro | 1.0M | $1 | $10 | |||||
impossibl/google/gemini-3.1-flash-lite | 1.0M | $0.25 | $2 | |||||
impossibl/google/gemini-3.1-pro-preview | 1.0M | $2 | $12 | |||||
impossibl/google/gemini-3.5-flash | 1.0M | $2 | $9 | |||||
impossibl/google/gemini-3.5-flash-lite | 1.0M | $0.30 | $3 | |||||
impossibl/google/gemini-3.6-flash | 1.0M | $2 | $8 | |||||
impossibl/groq/gpt-oss-120b | 131K | $0.15 | $0.60 | |||||
impossibl/groq/gpt-oss-20b | 131K | $0.07 | $0.30 | |||||
impossibl/moonshotai/kimi-k3 | 1.0M | $3 | $15 | |||||
impossibl/openai/gpt-3.5-turbo | 16K | $0.50 | $2 | |||||
impossibl/openai/gpt-4-turbo | 128K | $10 | $30 | |||||
impossibl/openai/gpt-4.1 | 1.0M | $2 | $8 | |||||
impossibl/openai/gpt-4.1-mini | 1.0M | $0.40 | $2 | |||||
impossibl/openai/gpt-4.1-nano | 1.0M | $0.10 | $0.40 | |||||
impossibl/openai/gpt-4o | 128K | $3 | $10 | |||||
impossibl/openai/gpt-4o-mini | 128K | $0.15 | $0.60 | |||||
impossibl/openai/gpt-5 | 400K | $1 | $10 | |||||
impossibl/openai/gpt-5-codex | 400K | $1 | $10 | |||||
impossibl/openai/gpt-5-mini | 400K | $0.25 | $2 | |||||
impossibl/openai/gpt-5-nano | 400K | $0.05 | $0.40 | |||||
impossibl/openai/gpt-5-pro | 400K | $15 | $120 | |||||
impossibl/openai/gpt-5.1 | 400K | $1 | $10 | |||||
impossibl/openai/gpt-5.1-codex | 400K | $1 | $10 | |||||
impossibl/openai/gpt-5.1-codex-mini | 400K | $0.25 | $2 | |||||
impossibl/openai/gpt-5.2 | 400K | $2 | $14 | |||||
impossibl/openai/gpt-5.2-codex | 400K | $2 | $14 | |||||
impossibl/openai/gpt-5.3-codex | 400K | $2 | $14 | |||||
impossibl/openai/gpt-5.4 | 1.1M | $3 | $15 | |||||
impossibl/openai/gpt-5.4-mini | 400K | $0.75 | $5 | |||||
impossibl/openai/gpt-5.4-nano | 400K | $0.20 | $1 | |||||
impossibl/openai/gpt-5.4-pro | 1.1M | $30 | $180 | |||||
impossibl/openai/gpt-5.5 | 1.1M | $5 | $30 | |||||
impossibl/openai/gpt-5.5-pro | 1.1M | $30 | $180 | |||||
impossibl/openai/gpt-5.6-luna | 1.1M | $0.20 | $1 | |||||
impossibl/openai/gpt-5.6-sol | 1.1M | $5 | $30 | |||||
impossibl/openai/gpt-5.6-terra | 1.1M | $2 | $12 | |||||
impossibl/openai/o1 | 200K | $15 | $60 | |||||
impossibl/openai/o3 | 200K | $2 | $8 | |||||
impossibl/openai/o3-mini | 200K | $1 | $4 | |||||
impossibl/openai/o4-mini | 200K | $1 | $4 | |||||
impossibl/qwen/qwen3.6-flash | 1.0M | $0.25 | $2 | |||||
impossibl/qwen/qwen3.7-max | 1.0M | $3 | $8 | |||||
impossibl/qwen/qwen3.7-plus | 1.0M | $0.40 | $2 | |||||
impossibl/qwen/qwen3.8-max-preview | 1.0M | $3 | $8 | |||||
impossibl/thinkingmachines/inkling | 66K | $2 | $5 | |||||
impossibl/xai/grok-4.20-0309-non-reasoning | 1.0M | $1 | $3 | |||||
impossibl/xai/grok-4.20-0309-reasoning | 1.0M | $1 | $3 | |||||
impossibl/xai/grok-4.3 | 1.0M | $1 | $3 | |||||
impossibl/xai/grok-4.5 | 500K | $2 | $6 | |||||
impossibl/xai/grok-build-0.1 | 256K | $1 | $2 | |||||
impossibl/xiaomi/mimo-v2.5 | 1.0M | $0.14 | $0.28 | |||||
impossibl/zai/glm-4.5 | 131K | $0.60 | $2 | |||||
impossibl/zai/glm-4.5-air | 131K | $0.20 | $1 | |||||
impossibl/zai/glm-4.6 | 205K | $0.60 | $2 | |||||
impossibl/zai/glm-4.7 | 205K | $0.60 | $2 | |||||
impossibl/zai/glm-5 | 205K | $1 | $3 | |||||
impossibl/zai/glm-5-turbo | 200K | $1 | $4 | |||||
impossibl/zai/glm-5.1 | 200K | $1 | $4 | |||||
impossibl/zai/glm-5.2 | 1.0M | $1 | $4 |
Advanced configurationDirect link to Advanced configuration
Custom headersDirect link to Custom headers
src/mastra/agents/my-agent.ts
const agent = new Agent({
id: "custom-agent",
name: "custom-agent",
model: {
url: "https://api.impossibl.com/v1",
id: "impossibl/anthropic/claude-fable-5",
apiKey: process.env.IMPOSSIBL_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});
Dynamic model selectionDirect link to Dynamic model selection
src/mastra/agents/my-agent.ts
const agent = new Agent({
id: "dynamic-agent",
name: "Dynamic Agent",
model: ({ requestContext }) => {
const useAdvanced = requestContext.task === "complex";
return useAdvanced
? "impossibl/zai/glm-5.2"
: "impossibl/anthropic/claude-fable-5";
}
});