export const metadata = {
  title: 'Quickstart',
  description:
    'This guide will get you all set up and ready to use the Protocol API. We’ll cover how to get started an API client and how to make your first API request.',
}

# Quickstart

This guide will get you all set up and ready to use the Protocol API. We'll cover how to get started using one of our API clients and how to make your first API request. We'll also look at where to go next to find all the information you need to take full advantage of our powerful REST API. {{ className: 'lead' }}

<Note>
  If you're a developer looking into building Edgen from source, please follow [Documentation &raquo; Getting Started](/documentation/getting-started).
</Note>

## Download and install ⚡Edgen
\
<Button href="https://edgen.co/download">⚡ Download</Button>

## Choose your client

Before making your first API request, you need to pick which API client you will use. ⚡Edgen offers clients for Python and Node.js. In the following example, you can see how to install each client.

{/* TODO: Edit with our published packages */}

<CodeGroup>

```bash {{ title: 'cURL' }}
# cURL is most likely already installed on your machine. If not, install it
curl --version
```

```bash {{ language: 'python' }}
# Install the Python API client
pip install edgen
```

```bash {{ language: 'ts' }}
# Install the Node API client
npm install edgen --save
```

</CodeGroup>

<div className="not-prose">
  <Button href="/documentation/api-clients" variant="text" arrow="right">
    <>Check out our API Clients</>
  </Button>
</div>

## Making your first API request

You are ready to make your first call to the ⚡Edgen API. Below, you can see how to send a GET request to the chat completions endpoint to create a chat response, given an list of input chat messages.

{/* TODO: Do not hardcode this codegroup. Since it's already defined in /api-reference/chat */}
<CodeGroup title="Request" tag="POST" label="/v1/chat/completions">

  ```bash {{ title: 'cURL' }}
  curl http://localhost:33322/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer no-key-required" \
  -d '{
    "model": "default",
    "messages": [
      {
        "role": "system",
        "content": "You are EdgenChat, a helpful AI assistant."
      },
      {
        "role": "user",
        "content": "Hello!"
      }
    ],
    "stream": true
  }'
  ```

  ```python
  from edgen import Edgen
  client = Edgen()

  completion = client.chat.completions.create(
    model="default",
    messages=[
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Hello!"}
    ],
    stream=True
  )

  for chunk in completion:
    print(chunk.choices[0].delta)
  ```

  ```ts
  import Edgen from "edgen";

  const client = new Edgen();

  async function main() {
    const completion = await client.chat.completions.create({
      model: "default",
      messages: [
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello!"}
      ],
      stream: true,
    });

    for await (const chunk of completion) {
      console.log(chunk.choices[0].delta.content);
    }
  }

  main();
  ```

</CodeGroup>

<div className="not-prose">
  <Button href="/api-reference/chat" variant="text" arrow="right">
    <>Read the docs for the chat endpoint</>
  </Button>
</div>
