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

# Get Started with FriendliAI

> Get started with FriendliAI. Create an API key, send your first request with Model APIs, and set up your favorite coding agent or SDK.

export const CreateApiKeySteps = ({openingParagraph, closingParagraph}) => <section>
    <p>
      {openingParagraph ?? "Before you can start building with FriendliAI, you must create a FriendliAI API key:"}
    </p>

    <Steps>
      <Step title="Create a Friendli Suite Account">
        <p>
          If you haven't already, <a href="https://auth.friendli.ai/sign-up">sign up</a> for an account.
        </p>
      </Step>

      <Step title="Sign In">
        <p>
          Then, <a href="https://auth.friendli.ai">sign in</a>. Friendli Suite opens your dashboard.
        </p>
      </Step>

      <Step title="Create a FriendliAI API Key">
        <ol>
          <li>
            In the left sidebar, click <Icon icon="gear" size={12} /> <strong>Settings</strong>. Then, click <strong><a href="https://friendli.ai/suite/~/setting/keys">API Keys</a></strong>.
          </li>

          <li>
            In the upper-right corner, click <Icon icon="plus" size={12} /> <strong>Create API Key</strong>.
          </li>

          <li>
            Click <Icon icon="copy" size={12} /> <strong>Copy</strong>.
          </li>
        </ol>
      </Step>
    </Steps>

    <p>
      {closingParagraph ?? "You can use your API key to start building with FriendliAI."}
    </p>
  </section>;

Create an API key and send your first request. Once you complete these steps, you're ready to [use your favorite agent or SDK with FriendliAI](/integrate/overview).

With [Friendli Model APIs](/guides/model-apis/introduction), you get access to a curated set of popular, open-weight models that are ready for you today. If you want to run any model -- including your own -- on dedicated GPUs, try [Friendli Dedicated Endpoints](/guides/dedicated-endpoints/introduction).

To get started, complete the following steps.

## Create an API Key

<CreateApiKeySteps openingParagraph="Before you send a request, you must create a FriendliAI API key:" closingParagraph="You can use your API key to send a request to FriendliAI." />

## Send a Request

Once you create your FriendliAI API key, you're ready to send your first request:

<Steps>
  <Step title="Set Up Your API Key">
    In your terminal, run the following command:

    ```bash theme={null}
    export FRIENDLIAI_API_KEY="<FRIENDLIAI_API_KEY>"
    ```

    Replace `<FRIENDLIAI_API_KEY>` with your API key.
  </Step>

  <Step title="Install the OpenAI SDK">
    In your terminal, run the following command:

    <CodeGroup>
      ```bash OpenAI Python SDK theme={null}
      pip install openai
      ```

      ```bash OpenAI JavaScript SDK theme={null}
      npm install openai
      ```
    </CodeGroup>
  </Step>

  <Step title="Send Your Request to FriendliAI">
    Run the following code:

    <CodeGroup>
      ```python OpenAI Python SDK wrap theme={null}
      import os
      from openai import OpenAI

      client = OpenAI(
          base_url="https://api.friendli.ai/serverless/v1",
          api_key=os.environ["FRIENDLIAI_API_KEY"],
      )

      completion = client.chat.completions.create(
          model="zai-org/GLM-5.2",
          messages=[
              {"role": "system", "content": "You are a friendly assistant."},
              {"role": "user", "content": "Describe FriendliAI in one sentence."},
          ],
      )

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

      ```javascript OpenAI JavaScript SDK wrap theme={null}
      import OpenAI from "openai"

      const client = new OpenAI({
        baseURL: "https://api.friendli.ai/serverless/v1",
        apiKey: process.env.FRIENDLIAI_API_KEY,
      })

      const messages = [
        { role: "system", content: "You are a friendly assistant." },
        { role: "user", content: "Describe FriendliAI in one sentence." },
      ]

      const completion = await client.chat.completions.create({
        model: "zai-org/GLM-5.2",
        messages,
      })

      console.log(completion.choices[0].message)
      ```

      ```bash cURL wrap theme={null}
      curl -X POST https://api.friendli.ai/serverless/v1/chat/completions \
        -H 'Content-Type: application/json' \
        -H "Authorization: Bearer $FRIENDLIAI_API_KEY" \
        -d '{
        "model": "zai-org/GLM-5.2",
          "messages": [
            {"role": "system", "content": "You are a friendly assistant."},
            {"role": "user", "content": "Describe FriendliAI in one sentence."}
          ]
      }'
      ```
    </CodeGroup>

    If you'd like to use a different model, replace `zai-org/GLM-5.2` with another model. To browse all models, see [Models > Model APIs](https://friendli.ai/models?products=SERVERLESS).

    <Check>
      FriendliAI returns a response, similar to the following:

      ```json expandable wrap theme={null}
      {
        "id": "chatcmpl-04eb40ba7fc14cf8a51b7869d9cfa76f",
        "object": "chat.completion",
        "choices": [
          {
            "index": 0,
            "message": {
              "role": "assistant",
              "content": "FriendliAI is a generative AI infrastructure company that provides optimized solutions to help businesses deploy large language models faster, more efficiently, and at a lower cost.",
              "reasoning": "...",
              "reasoning_content": "..."
            },
            "logprobs": null,
            "finish_reason": "stop"
          }
        ],
        "created": 1781892285,
        "usage": {
          "completion_tokens": 412,
          "prompt_tokens": 27,
          "prompt_tokens_details": {
            "cached_tokens": 0
          },
          "total_tokens": 439
        },
        "model": "zai-org/GLM-5.2"
      }
      ```
    </Check>
  </Step>
</Steps>

Congratulations. You sent your first request and are ready to build your next AI project.

## Use Your Agent or SDK

You're ready to start building with your favorite coding agent or SDK to connect to fast, cost-efficient, and reliable open-weight models.

Choose how you work:

<CardGroup cols={2}>
  <Card title="Agents" icon="robot" href="/integrate/agents/overview">
    Use your favorite agent with FriendliAI.
  </Card>

  <Card title="SDKs" icon="code" href="/integrate/sdks/overview">
    Use your favorite SDK with FriendliAI.
  </Card>
</CardGroup>
