Getting Started!

Getting Started with Hyperbolic AI Inference

👋 Welcome to the Hyperbolic AI inference docs!

Get your Hyperbolic API Key

In order to try our inference services yourself, you'll first need to obtain an API key.

  1. Visit the Hyperbolic AI Dashboard and register a new account.
  2. Once registered, navigate to the Settings page on the dashboard.
  3. You'll be able to view and copy your Hyperbolic API Key from there.

Getting Started With Text Generation

curl -X POST "https://api.hyperbolic.xyz/v1/chat/completions" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $HYPERBOLIC_API_KEY" \
    -d '{
        "messages": [
            {
                "role": "system",
        	"content": "You are a helpful and polite assistant."
            },
            {
                "role": "user",
                "content": "What is Chinese hotpot?"
            }
        ],
        "model": "meta-llama/Meta-Llama-3.1-70B-Instruct",
        "presence_penalty": 0,
        "temperature": 0.1,
        "top_p": 0.9,
        "stream": false
    }'
import os
import openai

system_content = "You are a gourmet. Be descriptive and helpful."
user_content = "Tell me about Chinese hotpot"

client = openai.OpenAI(
    api_key="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqb2huZG9lIn0.adqb-sj6G4xl7w7t9A4oRUBf1jNmcrc-0IcHjGhbz3o",
    base_url="https://api.hyperbolic.xyz/v1",
    )

chat_completion = client.chat.completions.create(
    model="meta-llama/Meta-Llama-3.1-70B-Instruct",
    messages=[
        {"role": "system", "content": system_content},
        {"role": "user", "content": user_content},
    ],
    temperature=0.7,
    max_tokens=1024,
)

response = chat_completion.choices[0].message.content
print("Response:\n", response)
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqb2huZG9lIn0.adqb-sj6G4xl7w7t9A4oRUBf1jNmcrc-0IcHjGhbz3o',
  baseURL: 'https://api.hyperbolic.xyz/v1',
});

async function main() {
  const response = await client.chat.completions.create({
    messages: [
      {
        role: 'system',
        content: 'You are an expert travel guide.',
      },
      {
        role: 'user',
        content: 'Tell me fun things to do in San Francisco.',
      },
    ],
    model: 'meta-llama/Meta-Llama-3.1-70B-Instruct',
  });

  const output = response.choices[0].message.content;
  console.log(output);
}

main();

Getting Started With Image Generation

curl -X POST "https://api.hyperbolic.xyz/v1/image/generation" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $HYPERBOLIC_API_KEY" \
    -d '{
      "model_name": "SDXL1.0-base",
      "prompt": "a photo of an astronaut riding a horse on mars",
      "height": 1024,
      "width": 1024,
      "backend": "auto"
    }' | jq -r ".images[0].image" | base64 -d > result.jpg

Getting Started With Audio Generation

curl -X POST "https://api.hyperbolic.xyz/v1/audio/generation" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $HYPERBOLIC_API_KEY" \
    -d '{
      "text": "Hi! Welcome to Hyperbolic. I am an AI speaker. I am happy to help you today."
    }' | jq -r ".audio" | base64 -d > result.mp3