---
title: "Quickstart"
description: "Send your first request through pirouter in five steps, from creating a key to finding the request in the console. With an OpenAI, Anthropic or Google SDK, you only change the base URL and the key."
canonical: "https://pirouter.ai/docs/quickstart"
last-updated: "2026-10-13"
lang: "en"
source: "content/docs/en/(start)/quickstart.mdx"
---

# Quickstart

Send your first request through pirouter in five steps, from creating a key to finding the request in the console. With an OpenAI, Anthropic or Google SDK, you only change the base URL and the key.

In five steps you will get a pirouter API key, add credit to your wallet, send a request, watch a streamed response, and find that request in the console.

1. **Create an API key**

   Sign in to the console with GitHub, Google or an email code. Your first sign-in creates your account. There is no password to set.

   - [Open the console](https://app.pirouter.ai): app.pirouter.ai

   Open **API Keys**, click **Create key**, give it a name and confirm.

   You should see a key that starts with `sk-pi-`. It is shown this one time and cannot be viewed again after you close the dialog. Store it in an environment variable now:

   ```bash
   export PIROUTER_API_KEY="sk-pi-..."
   ```

   Only workspace owners can create keys. Signing up creates a personal workspace and makes you its owner, so on your own account you can.

2. **Add credit to your wallet**

   Signing up does not come with credit. With a wallet balance of 0, requests return `402`, so add credit before you send one.

   Open **Credits** in the console and click **Add credit**. Only workspace owners can add credit.

   Choose an amount and a payment method, then pay. The minimum for one top-up is $10. You can pay by card, Alipay or WeChat Pay.

   You should land back in the console with a message that the amount was added, and see the balance under **Credits** go up.

   See [Pricing & billing](https://pirouter.ai/docs/billing.md#add-credit) for the currency, the exchange rate and receipts.

3. **Send a request**

   Model IDs are written as `vendor/model`. [Models & protocols](https://pirouter.ai/docs/models.md) lists the models you can call. The three versions below send the same request. Pick one and run it.

   cURL:

   ```bash
   curl https://api.pirouter.ai/v1/chat/completions \
     -H "Authorization: Bearer $PIROUTER_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "model": "openai/gpt-6-sol",
       "messages": [{ "role": "user", "content": "Hello!" }]
     }'
   ```

   Python:

   ```python
   import os
   from openai import OpenAI

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

   completion = client.chat.completions.create(
       model="openai/gpt-6-sol",
       messages=[{"role": "user", "content": "Hello!"}],
   )
   print(completion.choices[0].message.content)
   ```

   TypeScript:

   ```ts
   import OpenAI from 'openai'

   const client = new OpenAI({
     baseURL: 'https://api.pirouter.ai/v1',
     apiKey: process.env.PIROUTER_API_KEY,
   })

   const completion = await client.chat.completions.create({
     model: 'openai/gpt-6-sol',
     messages: [{ role: 'user', content: 'Hello!' }],
   })
   console.log(completion.choices[0].message.content)
   ```

   The Python and TypeScript versions use the official OpenAI SDK. Install it first with `pip install openai` or `npm install openai`.

   You should see status `200` and a JSON body, with the model's reply in `choices[0].message.content`.

   A `401` means the key was not sent or cannot be used. See [Authentication & API keys](https://pirouter.ai/docs/authentication.md#when-authentication-fails). A `402` means the balance is too low. [Errors](https://pirouter.ai/docs/errors.md) lists every error code and what to do about it.

4. **Stream the response**

   Add `"stream": true` to the request body, and pass `-N` to curl to turn off output buffering.

   ```bash
   curl -N https://api.pirouter.ai/v1/chat/completions \
     -H "Authorization: Bearer $PIROUTER_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "model": "openai/gpt-6-sol",
       "stream": true,
       "messages": [{ "role": "user", "content": "Hello!" }]
     }'
   ```

   You should see server-sent events arrive one after another, each line starting with `data: `. The last line is `data: [DONE]`.

   With an SDK, set the `stream` parameter to true and iterate over the events it returns.

5. **See it in Logs**

   Open **Logs** in the console.

   You should see the request you just sent in the list, with its input and output tokens, cost and latency. A request takes a few seconds to appear.

   Every response carries an `X-Pi-Trace-Id` header. Pass `-i` to curl to see it, then paste its value into **Search by trace ID** on the Logs page to go straight to that request.

> **Note:** Using an Anthropic or Google SDK? Each protocol has its own base URL and request format. See the samples in [Models & protocols](https://pirouter.ai/docs/models.md#calling-each-protocol).

> **Warning:** A key is shown once. If it leaks, revoke it in the console and create a new one. Revocation takes effect immediately.

## Next steps

- [Authentication & API keys](https://pirouter.ai/docs/authentication.md): Which header carries the key, and how keys expire and are revoked.
- [Models & protocols](https://pirouter.ai/docs/models.md): Which protocols each model accepts, and how to call each one.
- [Pricing & billing](https://pirouter.ai/docs/billing.md): How the wallet is charged and how to add credit.
- [Connect a tool](https://pirouter.ai/docs/integrations.md): Point an SDK or a coding tool at pirouter.
