推理提供商文件

Together

Hugging Face's logo
加入 Hugging Face 社群

並獲得增強的文件體驗

開始使用

Together

所有支援的 Together 模型可以在這裡找到

Together 的去中心化雲服務助力各種規模的開發者和研究人員訓練、微調和部署生成式 AI 模型。

支援的任務

聊天完成(LLM)

瞭解更多關於聊天補全 (LLM) 的資訊,請點選這裡

import os
from huggingface_hub import InferenceClient

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

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

print(completion.choices[0].message)

聊天完成(VLM)

瞭解更多關於聊天補全 (VLM) 的資訊,請點選這裡

import os
from huggingface_hub import InferenceClient

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

completion = client.chat.completions.create(
    model="meta-llama/Llama-4-Scout-17B-16E-Instruct",
    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"],
)

completion = client.chat.completions.create(
    model="openai/gpt-oss-120b",
    messages="\"Can you please let us know more details about your \"",
)

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.