> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# Together AI

## 概述

[Together AI](https://www.together.ai/) 提供 AI 加速云，可让你以极快速度、低成本和生产级规模训练、微调及运行 AI 模型推理。

可立即运行包括 DeepSeek、Llama3、Mixtral 和 Stable Diffusion 在内的 [200 多个模型](https://together.xyz/models)，并针对延迟、吞吐量和上下文长度进行优化。

## 选择模型

要充分发挥 ElevenLabs Agents 的功能，需要使用支持工具调用和结构化输出的模型。Together AI 为[这些模型](https://docs.together.ai/docs/function-calling)支持函数调用：

* meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo
* meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo
* meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo
* meta-llama/Llama-3.3-70B-Instruct-Turbo
* mistralai/Mixtral-8x7B-Instruct-v0.1
* mistralai/Mistral-7B-Instruct-v0.1

因此，建议为 ElevenLabs Agents 智能体至少使用 `meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo`。

## 在 Together AI 上设置 Llama 3.1

前往 [api.together.xyz/settings/api-keys](https://api.together.xyz/settings/api-keys)，创建新的 API 密钥。

![添加密钥](/docs/_fern-img/97323ef6ffb761b54a7b5c4183054bc1fd621d1069a38cbeb474444e84de75f4.webp)

获取 API 密钥后，可运行以下 curl 命令进行测试：

```bash
curl https://api.together.xyz/v1/chat/completions -s \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"model": "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
"messages": [{
    "role": "user",
    "content": "Hello, how are you?"
}]
}'
```

前往 [AI 智能体](https://elevenlabs.io/app/agents)，向下滚动至“密钥”部分并选择“添加密钥”。添加密钥后，请务必点击“保存”，使智能体可以使用该密钥。

![添加密钥](/docs/_fern-img/43e5478a3c62f31d2d9f66f9919e7c4c1b5878e3b79681d08741221ce3e689d8.webp)

从下拉菜单中选择“自定义 LLM”。

![选择自定义 LLM](/docs/_fern-img/45ec75f558a5c8e5070bd3170d96cbc54ef63e15d9f04ac472a45854a22a17ac.webp)

在服务器 URL 中指定 Together AI 兼容 OpenAI 的 API 端点：`https://api.together.xyz/v1`。在模型 ID 中指定前文所述的 `meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo`，然后从下拉菜单中选择 API 密钥。

![输入 URL](/docs/_fern-img/94d7f96a16d483327751195b306431b5d7c0e4df237510b74d7e98f28b58efe1.webp)

现在可点击“测试 AI 智能体”，与自定义 Llama 3.1 模型聊天。