Skip to main content

Ofox logoOfox

Access 13 Ofox models through Mastra's model router. Authentication is handled automatically using the OFOX_API_KEY environment variable.

Learn more in the Ofox documentation.

.env
OFOX_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: "ofox/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 Ofox documentation for details.

Models
Direct link to Models

ModelContextToolsReasoningImageAudioVideoInput $/1MOutput $/1M
ofox/anthropic/claude-fable-51.0M$10$50
ofox/anthropic/claude-opus-4.81.0M$5$25
ofox/anthropic/claude-sonnet-51.0M$2$10
ofox/bailian/qwen3.7-max1.0M$3$8
ofox/deepseek/deepseek-v4-pro1.0M$0.45$0.88
ofox/google/gemini-3.1-pro-preview1.0M$2$12
ofox/moonshotai/kimi-k2.6262K$0.95$4
ofox/openai/gpt-5.51.1M$5$30
ofox/openai/gpt-5.6-luna1.1M$1$6
ofox/openai/gpt-5.6-sol1.1M$5$30
ofox/openai/gpt-5.6-terra1.1M$3$15
ofox/x-ai/grok-4.31.0M$1$3
ofox/z-ai/glm-5.21.0M$1$4
13 available models

Advanced configuration
Direct link to Advanced configuration

Custom headers
Direct link to Custom headers

src/mastra/agents/my-agent.ts
const agent = new Agent({
id: "custom-agent",
name: "custom-agent",
model: {
url: "https://api.ofox.ai/v1",
id: "ofox/anthropic/claude-fable-5",
apiKey: process.env.OFOX_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});

Dynamic model selection
Direct 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
? "ofox/z-ai/glm-5.2"
: "ofox/anthropic/claude-fable-5";
}
});
On this page