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

# FriendliAI

> Use Linkup as a web search tool for LLMs served by FriendliAI

FriendliAI provides fast AI inference. Linkup adds real-time web search to models served by FriendliAI, so your application can ground answers in current facts with cited sources.

## FriendliAI's Playground

Linkup's web search can be turned on directly in FriendliAI's API playground.

![Playground](https://mintcdn.com/linkup-8b5c238e/NgcY_e-KwQ9dAfRR/pages/integrations/friendliai/assets/playground.png?fit=max\&auto=format\&n=NgcY_e-KwQ9dAfRR\&q=85\&s=eca45271a2fe0c2f3c8cf55812667f7d)

## FriendliAI's API Integitgration

Linkup's web search can be integrated as a default tool in calls made to the FriendliAI serverless APIs, simply by adding `"tools": [{ "type": "linkup:search" }]` in your OpenAI format API call.

To that end, follow these steps:

**1. Create your FriendliAI account**

Create a new [FriendliAI account](https://friendli.ai/) if you don't have one yet.

**2. Subscribe to the free trial**

You need to enroll in the Serverless Endpoints product free trial. Information can be found [here](https://friendli.ai/docs/guides/free_credits?_gl=1*12pdpy8*_gcl_au*MTMwNDY4MzczNS4xNzU1MDc1NDA5#receiving-when-you-start).

**3. Add your Linkup API key to your FriendliAI account**

> **[Get your API key](https://app.linkup.so)**
>
> Create a Linkup account for free to get your API key.

In Friendli Suite, open Personal settings > Integrations and add your Linkup API key.

**4. Make your first API call**

In the following code snippet, `FRIENDLI_TOKEN` refers to your Personal Access Token, which you can obtain from Personal settings > Settings > Tokens [(guide)](https://friendli.ai/docs/guides/personal_access_tokens?_gl=1*bqbtwa*_gcl_au*MTMwNDY4MzczNS4xNzU1MDc1NDA5).
\[!NOTE] Make sure your Linkup integration is enabled in your Friendli account before calling the API, otherwise the `linkup:search` tool will error.

```python python theme={"system"}
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("FRIENDLI_TOKEN"),
    base_url="https://api.friendli.ai/serverless/tools/v1",
)

completion = client.chat.completions.create(
    model="meta-llama-3.1-8b-instruct",
    messages=[
        {
            "role": "user",
            "content": "Find information on the popular movies currently showing in theaters and provide their ratings."
        }
    ],
    tools=[{"type": "linkup:search"}],
    stream=False
)

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

```shell curl theme={"system"}
curl --request POST \
  --url https://api.friendli.ai/serverless/tools/v1/chat/completions \
  --header 'Authorization: Bearer <FRIENDLI_TOKEN>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "meta-llama-3.1-8b-instruct",
    "messages": [
      {
        "content": "Find information on the popular movies currently showing in theaters and provide their ratings.",
        "role": "user"
      }
    ],
    "tools": [
      { "type": "linkup:search" }
    ]
  }'
```

> [!NOTE]
>
> **Need help?** Email `support@linkup.so`, ping us on [Discord](https://discord.com/invite/9q9mCYJa86), or [talk to us](https://calendar.app.google/zNUZz7RxgMMk9pKW7).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.