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

# Quickstart

> Create an API key and send the first chat completion.

## 1. Create an API key

1. Sign in at [platform.fortytwo.network](https://platform.fortytwo.network).
2. Open **Credits** and press **Buy credits**.
3. Open **API keys**, press **Create key** (**New key** if the account already has keys), and copy the key. It is shown only once.

Details are on [Get access](/docs/access).

## 2. Set the key

```bash theme={null}
export FORTYTWO_API_KEY="<your key>"
```

## 3. Send a request

The API is compatible with the OpenAI SDKs. Set the base URL to `https://api.fortytwo.network/v1`.

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.fortytwo.network/v1/chat/completions \
    -H "Authorization: Bearer $FORTYTWO_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "qwen/qwen3.8-27b",
      "messages": [{ "role": "user", "content": "Say hello in one sentence." }]
    }'
  ```

  ```python Python theme={null}
  # pip install openai
  import os
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["FORTYTWO_API_KEY"],
      base_url="https://api.fortytwo.network/v1",
  )

  completion = client.chat.completions.create(
      model="qwen/qwen3.8-27b",
      messages=[{"role": "user", "content": "Say hello in one sentence."}],
  )

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

  ```typescript TypeScript theme={null}
  // npm install openai
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.FORTYTWO_API_KEY,
    baseURL: "https://api.fortytwo.network/v1",
  });

  const completion = await client.chat.completions.create({
    model: "qwen/qwen3.8-27b",
    messages: [{ role: "user", content: "Say hello in one sentence." }],
  });

  console.log(completion.choices[0].message.content);
  ```
</CodeGroup>

The response is a standard chat completion. The answer is in `choices[0].message.content`, and the token counts are in `usage`. The model reasons before it answers by default; the reasoning is in `choices[0].message.reasoning` and is billed as output — see [Pricing](/docs/pricing).

## If the request fails

| Error | Cause |
| - | - |
| `401 invalid_api_key` | The key is missing, malformed, unknown, disabled, revoked or expired |
| `429 insufficient_quota` | No credits on the balance |
| `404 model_not_found` | The model ID is wrong — see [Models](/docs/models) |
| `400 invalid_request` | A field is not supported — see [OpenAI compatibility](/docs/openai-compatibility) |

Other codes are on [Errors](/docs/errors). What to do about each is in [Common problems](/docs/support-common-problems#api).

## Next steps

<Columns cols={2}>
  <Card title="Models" icon="layer-group" href="/docs/models">
    Model IDs, limits and supported features.
  </Card>

  <Card title="Chat completions" icon="message" href="/docs/chat-completions">
    Request fields, tool calling and structured output.
  </Card>

  <Card title="Streaming" icon="wave-square" href="/docs/streaming">
    Receive the response as it is generated.
  </Card>

  <Card title="OpenAI compatibility" icon="arrows-left-right" href="/docs/openai-compatibility">
    What differs from the OpenAI API.
  </Card>
</Columns>


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