TensaHub › Hugging Face Inference

Hy4 · Together

API for the model tencent/Hy4:together at Hugging Face Inference, $0.834 / $2.501 per million tokens, context 1,048,576 tokens. curl, Python and JavaScript samples, live testing.

Test and rate in the catalog

tencent/Hy4 served by Together through the Hugging Face router.

Type
Model
Provider
Hugging Face Inference
Host
Together
Model ID
tencent/Hy4:together
Pricing
Paid
Input / output price
$0.834 / $2.501 per million tokens
Keyless access
No
Key variable
HF_TOKEN
Base URL (OpenAI-compatible)
https://router.huggingface.co/v1
Context
1,048,576 tokens
Inputs
Text, Image
Features
Tool calling, JSON output
Response time
First token 52966 ms · 11 tokens/s · uptime 100%
Developer rating
Not rated yet
Documentation
https://huggingface.co/tencent/Hy4

Code samples

cURL

curl https://router.huggingface.co/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $HF_TOKEN" \
  -d '{"model":"tencent/Hy4:together","messages":[{"role":"user","content":"Hello, introduce yourself in one sentence."}]}'

Python

# pip install openai
import os
from openai import OpenAI

client = OpenAI(base_url="https://router.huggingface.co/v1", api_key=os.environ["HF_TOKEN"])
r = client.chat.completions.create(
    model="tencent/Hy4:together",
    messages=[{"role": "user", "content": "Hello, introduce yourself in one sentence."}],
)
print(r.choices[0].message.content)

JavaScript

// npm install openai
import OpenAI from 'openai'

const client = new OpenAI({ baseURL: 'https://router.huggingface.co/v1', apiKey: process.env.HF_TOKEN })
const r = await client.chat.completions.create({
  model: 'tencent/Hy4:together',
  messages: [{ role: 'user', content: 'Hello, introduce yourself in one sentence.' }],
})
console.log(r.choices[0].message.content)

Generate the integration code →

Popular searches

Frequently asked questions

Is the Hy4 · Together API free?

No: Hy4 · Together is a paid API ($0.834 / $2.501 per million tokens).

How do I call Hy4 · Together from my code?

Hy4 · Together exposes an OpenAI-compatible API at https://router.huggingface.co/v1: use any OpenAI SDK (Python, JavaScript…) with this base URL. Model identifier: tencent/Hy4:together. Ready-to-use code (streaming, JSON, retries) is available in the developer toolkit.

What is the context window of Hy4 · Together?

Hy4 · Together accepts up to 1,048,576 tokens of context (prompt and history).

What are the alternatives to Hy4 · Together?

Similar APIs listed in the catalog: Hy4-flash · Fireworks, Hy4-flash · Pearl Research, Hy4-flash · DeepInfra, Tencent: Hy4 flash, Tencent: Hy4.

Alternatives