推理提供商文档

Together

Hugging Face's logo
加入 Hugging Face 社区

并获得增强的文档体验

开始使用

Together

您可以在 这里 找到所有支持的 Together 模型

Together 的去中心化云服务赋能各种规模的组织中的开发人员和研究人员,让他们能够训练、微调和部署生成式 AI 模型。

支持的任务

聊天补全 (LLM)

了解更多关于聊天补全 (LLM) 的信息,请点击这里

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://router.huggingface.co/v1",
    api_key=os.environ["HF_TOKEN"],
)

completion = client.chat.completions.create(
    model="openai/gpt-oss-120b:together",
    messages=[
        {
            "role": "user",
            "content": "What is the capital of France?"
        }
    ],
)

print(completion.choices[0].message)

聊天补全 (VLM)

了解更多关于聊天补全 (VLM) 的信息,请点击这里

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://router.huggingface.co/v1",
    api_key=os.environ["HF_TOKEN"],
)

completion = client.chat.completions.create(
    model="moonshotai/Kimi-K2.5:together",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Describe this image in one sentence."
                },
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
                    }
                }
            ]
        }
    ],
)

print(completion.choices[0].message)

文本到图像

详细了解文本到图像 此处

import os
from huggingface_hub import InferenceClient

client = InferenceClient(
    provider="together",
    api_key=os.environ["HF_TOKEN"],
)

# output is a PIL.Image object
image = client.text_to_image(
    "Astronaut riding a horse",
    model="black-forest-labs/FLUX.1-dev",
)
在 GitHub 上更新

© . This site is unofficial and not affiliated with Hugging Face, Inc.