> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hyperbolic.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrations

> Integrate Hyperbolic with OpenAI SDK, LangChain, Hugging Face, and more

# Integrations

Hyperbolic's OpenAI-compatible API makes it easy to integrate with your existing tools and frameworks. Simply change the base URL and API key to start using Hyperbolic models with your favorite libraries.

## OpenAI SDK

The fastest way to integrate with Hyperbolic. Just change `base_url` and `api_key`.

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(
        api_key="YOUR_HYPERBOLIC_API_KEY",
        base_url="https://api.hyperbolic.xyz/v1"
    )

    response = client.chat.completions.create(
        model="meta-llama/Llama-3.3-70B-Instruct",
        messages=[
            {"role": "user", "content": "Hello!"}
        ]
    )

    print(response.choices[0].message.content)
    ```
  </Tab>

  <Tab title="Node.js">
    ```javascript theme={null}
    import OpenAI from 'openai';

    const client = new OpenAI({
      apiKey: process.env.HYPERBOLIC_API_KEY,
      baseURL: 'https://api.hyperbolic.xyz/v1'
    });

    const response = await client.chat.completions.create({
      model: 'meta-llama/Llama-3.3-70B-Instruct',
      messages: [
        { role: 'user', content: 'Hello!' }
      ]
    });

    console.log(response.choices[0].message.content);
    ```
  </Tab>
</Tabs>

### Installation

<Tabs>
  <Tab title="Python">
    ```bash theme={null}
    pip install openai
    ```
  </Tab>

  <Tab title="Node.js">
    ```bash theme={null}
    npm install openai
    ```
  </Tab>
</Tabs>

## LangChain

Build AI applications, chains, and agents with LangChain.

```python theme={null}
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    openai_api_key="YOUR_HYPERBOLIC_API_KEY",
    openai_api_base="https://api.hyperbolic.xyz/v1",
    model_name="meta-llama/Llama-3.3-70B-Instruct"
)

response = llm.invoke("What is the capital of France?")
print(response.content)
```

### Installation

```bash theme={null}
pip install langchain langchain-openai
```

## LlamaIndex

Build RAG applications and knowledge-augmented AI with LlamaIndex.

```python theme={null}
from llama_index.llms.openai_like import OpenAILike

llm = OpenAILike(
    api_key="YOUR_HYPERBOLIC_API_KEY",
    api_base="https://api.hyperbolic.xyz/v1",
    model="meta-llama/Llama-3.3-70B-Instruct"
)

response = llm.complete("Explain quantum computing in simple terms")
print(response.text)
```

### Installation

```bash theme={null}
pip install llama-index llama-index-llms-openai-like
```

## Hugging Face

Access Hyperbolic models through the Hugging Face ecosystem.

```python theme={null}
from huggingface_hub import InferenceClient

client = InferenceClient(
    provider="hyperbolic",
    api_key="YOUR_HYPERBOLIC_API_KEY"
)

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-R1",
    messages=[
        {"role": "user", "content": "What is the capital of France?"}
    ],
    max_tokens=500
)

print(response.choices[0].message.content)
```

### Authentication Options

| Method     | API Key            | Billing                        |
| ---------- | ------------------ | ------------------------------ |
| **Direct** | Hyperbolic API key | Billed to Hyperbolic account   |
| **Routed** | Hugging Face token | Billed to Hugging Face account |

### Installation

```bash theme={null}
pip install huggingface_hub>=0.29.0
```

<Info>
  Browse all [Hyperbolic models on Hugging Face](https://huggingface.co/models?inference_provider=hyperbolic\&sort=trending).
</Info>

## Gradio

Build interactive ML demos with Gradio.

```python theme={null}
import gradio as gr
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_HYPERBOLIC_API_KEY",
    base_url="https://api.hyperbolic.xyz/v1"
)

def chat(message, history):
    response = client.chat.completions.create(
        model="meta-llama/Llama-3.3-70B-Instruct",
        messages=[{"role": "user", "content": message}]
    )
    return response.choices[0].message.content

demo = gr.ChatInterface(chat)
demo.launch()
```

### Installation

```bash theme={null}
pip install gradio openai
```

## Other Compatible Frameworks

Hyperbolic's OpenAI-compatible API works with any framework that supports the OpenAI API format:

* **AutoGen** - Multi-agent conversations
* **CrewAI** - AI agent orchestration
* **Semantic Kernel** - Microsoft's AI orchestration SDK
* **Haystack** - NLP pipelines and RAG
* **DSPy** - Programming with language models

<Tip>
  To use any OpenAI-compatible framework with Hyperbolic, set the base URL to `https://api.hyperbolic.xyz/v1` and use your Hyperbolic API key.
</Tip>

## Next Steps

<CardGroup cols={3}>
  <Card title="Text APIs" icon="message" href="/docs/inference/text-apis">
    Explore chat completions
  </Card>

  <Card title="Image APIs" icon="image" href="/docs/inference/image-apis">
    Generate images from text
  </Card>

  <Card title="Audio APIs" icon="volume-high" href="/docs/inference/audio-apis">
    Text-to-speech generation
  </Card>
</CardGroup>
