본문으로 건너뛰기

Together AI logo함께하는 AI

Mastra의 Model 라우터를 통해 35개의 Together AI Model에 액세스하세요. 인증은 다음을 사용하여 자동으로 처리됩니다.TOGETHER_API_KEY environment variable.

자세한 내용은 다음에서 확인하세요.Together AI documentation.

.env
TOGETHER_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: "togetherai/LiquidAI/LFM2-24B-A2B"
});

// 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);
}

Model
Model에 대한 직접 링크

ModelContextToolsReasoningImageAudioVideoInput $/1MOutput $/1M
togetherai/deepcogito/cogito-v2-1-671b164K$1$1
togetherai/deepseek-ai/DeepSeek-V4-Flash-07311.0M$0.14$0.28
togetherai/deepseek-ai/DeepSeek-V4-Pro512K$2$3
togetherai/google/gemma-3n-E4B-it33K$0.06$0.12
togetherai/google/gemma-4-31B-it262K$0.39$0.97
togetherai/LiquidAI/LFM2-24B-A2B33K$0.03$0.12
togetherai/meta-llama/Llama-3.3-70B-Instruct-Turbo131K$1$1
togetherai/meta-llama/Meta-Llama-3-8B-Instruct-Lite8K$0.14$0.14
togetherai/MiniMaxAI/MiniMax-M2.7203K$0.30$1
togetherai/MiniMaxAI/MiniMax-M3524K$0.30$1
togetherai/moonshotai/Kimi-K2.6262K$1$5
togetherai/moonshotai/Kimi-K2.7-Code262K$0.95$4
togetherai/moonshotai/Kimi-K31.0M$3$15
togetherai/nvidia/nemotron-3-ultra-550b-a55b512K$0.60$4
togetherai/openai/gpt-oss-120b131K$0.15$0.60
togetherai/openai/gpt-oss-20b131K$0.05$0.20
togetherai/pearl-ai/gemma-4-31b-it32K$0.28$0.86
togetherai/Qwen/Qwen2.5-7B-Instruct-Turbo33K$0.30$0.30
togetherai/Qwen/Qwen3.5-9B262K$0.17$0.25
togetherai/Qwen/Qwen3.6-Plus1.0M$0.50$3
togetherai/Qwen/Qwen3.7-Max1.0M$1$4
togetherai/thinkingmachines/Inkling524K$1$4
togetherai/zai-org/GLM-5.2262K$1$4
23 available models

고급 구성
고급 구성에 대한 직접 링크

맞춤 헤더
맞춤 헤더에 대한 직접 링크

src/mastra/agents/my-agent.ts
const agent = new Agent({
id: "custom-agent",
name: "custom-agent",
model: {
id: "togetherai/LiquidAI/LFM2-24B-A2B",
apiKey: process.env.TOGETHER_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});

동적 Model 선택
동적 Model 선택에 대한 직접 링크

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
? "togetherai/zai-org/GLM-5.2"
: "togetherai/LiquidAI/LFM2-24B-A2B";
}
});

직접 공급자 설치
직접 공급자 설치에 대한 직접 링크

이 Provider는 Mastra Model 라우터 문자열 대신 사용할 수 있는 독립 실행형 패키지로 직접 설치할 수도 있습니다. 자세한 내용은 패키지 문서를 참조하세요.

npm install @ai-sdk/togetherai

자세한 공급자별 설명서는 다음을 참조하세요.AI SDK Together AI provider docs.