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

# Quickstart

> Create an API key and make your first Phaseo request with a current text model.

Use this tutorial to make one successful Phaseo request and confirm where the response text appears.

You will:

* create an API key
* send one text request
* read the assistant output
* know what to check first if the request fails

***

## 1. Create an API key

1. Open the [Phaseo Dashboard](https://phaseo.app/gateway/keys).
2. Create a key under **Gateway -> Keys**.
3. Copy it once and store it securely.

Use this format:

```http theme={null}
Authorization: Bearer phaseo_v1_sk_<kid>_<secret>
```

<Danger>
  Treat your API key like a password. Do not expose it in client-side code.
</Danger>

***

## 2. Send a text request

Use `POST /v1/responses` for the first request. It is the recommended endpoint for new text-generation work.

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.phaseo.ai/v1/responses \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "openai/gpt-5.6-sol",
      "input": "Reply with: quickstart works",
      "temperature": 0
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.phaseo.ai/v1/responses", {
    method: "POST",
    headers: {
      Authorization: "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: "openai/gpt-5.6-sol",
      input: "Reply with: quickstart works",
      temperature: 0,
    }),
  });

  const data = await response.json();
  const assistantText = data.output
    ?.find((item) => item.type === "message")
    ?.content?.find((part) => part.type === "output_text")
    ?.text;

  console.log(assistantText);
  ```

  ```typescript TypeScript SDK theme={null}
  import Phaseo from "@phaseo/sdk";

  const client = new Phaseo({ apiKey: process.env.PHASEO_API_KEY! });

  const response = await client.generateResponse({
    model: "openai/gpt-5.6-sol",
    input: "Reply with: quickstart works",
    temperature: 0,
  });

  const assistantText = response.output
    ?.find((item: any) => item.type === "message")
    ?.content?.find((part: any) => part.type === "output_text")
    ?.text;

  console.log(assistantText);
  ```

  ```python Python SDK theme={null}
  from phaseo import Phaseo

  client = Phaseo(api_key="YOUR_API_KEY")

  response = client.generate_response(
      {
          "model": "openai/gpt-5.6-sol",
          "input": "Reply with: quickstart works",
          "temperature": 0,
      }
  )

  assistant_text = next(
      (
          part.get("text")
          for item in response.get("output", [])
          if item.get("type") == "message"
          for part in item.get("content", [])
          if part.get("type") == "output_text"
      ),
      None,
  )

  print(assistant_text)
  ```

  ```go Go SDK theme={null}
  package main

  import (
    "context"
    "fmt"

    phaseo "github.com/phaseoteam/Phaseo/packages/sdk/sdk-go"
  )

  func main() {
    client := phaseo.New("YOUR_API_KEY", "https://api.phaseo.ai/v1")
    input := map[string]interface{}{
      "role": "user",
      "content": []map[string]interface{}{
        {
          "type": "input_text",
          "text": "Reply with: quickstart works",
        },
      },
    }

    response, err := client.GenerateResponse(context.Background(), phaseo.ResponsesRequest{
      Model: "openai/gpt-5.6-sol",
      Input: &input,
    })
    if err != nil {
      panic(err)
    }

    fmt.Println(response)
  }
  ```

  ```csharp C# SDK theme={null}
  using PhaseoSdk;
  using System.Collections.Generic;

  var client = new Phaseo("YOUR_API_KEY");

  var response = await client.GenerateResponse(new Dictionary<string, object>
  {
      ["model"] = "openai/gpt-5.6-sol",
      ["input"] = "Reply with: quickstart works",
      ["temperature"] = 0
  });

  Console.WriteLine(response);
  ```

  ```php PHP SDK theme={null}
  <?php
  require 'vendor/autoload.php';

  use Phaseo\Sdk\Phaseo;

  $client = new Phaseo(getenv('PHASEO_API_KEY') ?: 'YOUR_API_KEY');

  $response = $client->generateResponse([
      'model' => 'openai/gpt-5.6-sol',
      'input' => 'Reply with: quickstart works',
      'temperature' => 0,
  ]);

  print_r($response);
  ```

  ```ruby Ruby SDK theme={null}
  require 'phaseo_sdk'

  client = PhaseoSdk::Phaseo.new(api_key: ENV.fetch('PHASEO_API_KEY', 'YOUR_API_KEY'))

  response = client.generate_response(
    model: 'openai/gpt-5.6-sol',
    input: 'Reply with: quickstart works',
    temperature: 0
  )

  puts response
  ```

  ```java Java SDK theme={null}
  import app.phaseo.sdk.Phaseo;

  Phaseo client = new Phaseo(System.getenv("PHASEO_API_KEY"));

  String body = """
  {
    "model": "openai/gpt-5.6-sol",
    "input": [
      {
        "role": "user",
        "content": [
          { "type": "input_text", "text": "Reply with: quickstart works" }
        ]
      }
    ],
    "temperature": 0
  }
  """;

  Object response = client.createResponse(body);
  System.out.println(String.valueOf(response));
  ```

  ```typescript Vercel AI SDK theme={null}
  import { phaseo } from "@phaseo/ai-sdk-provider";
  import { generateText } from "ai";

  const result = await generateText({
    model: phaseo("openai/gpt-5.6-sol"),
    prompt: "Reply with: quickstart works",
  });

  console.log(result.text);
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "id": "resp_...",
  "object": "response",
  "created_at": 1730000000,
  "status": "completed",
  "completed_at": 1730000001,
  "model": "openai/gpt-5.6-sol",
  "output": [
    {
      "type": "message",
      "id": "msg_...",
      "status": "completed",
      "role": "assistant",
      "content": [{ "type": "output_text", "text": "quickstart works", "annotations": [] }]
    }
  ],
  "usage": {
    "input_tokens": 9,
    "output_tokens": 3,
    "total_tokens": 12
  },
  "error": null,
  "incomplete_details": null
}
```

For direct Responses API calls, read the assistant reply from `output[].content[]` where `type` is `output_text`.

If you use the Vercel AI SDK, read the reply from `result.text`.

***

## 3. Troubleshoot the first request

* `401`: check the API key and `Authorization` header.
* `400`: check the request body and model ID.
* `402`: switch to a `:free` model or add credits before using a paid model.
* `429` or `5xx`: retry with exponential backoff.

Use the [Error Handling reference](./api-reference/errors) to debug quickly.

***

## 4. If you are building video

Video generation is async. Create a job first, then poll or subscribe for the result.

1. Create a job with `POST /v1/videos`.
2. Poll status with `GET /v1/videos/{video_id}` until completed.
3. Download content from `GET /v1/videos/{video_id}/content`.

```bash theme={null}
# Create
curl https://api.phaseo.ai/v1/videos \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<video-model-id>",
    "prompt": "A cinematic sunrise over a mountain lake"
  }'

# Poll status
curl https://api.phaseo.ai/v1/videos/VIDEO_ID \
  -H "Authorization: Bearer YOUR_API_KEY"
```

***

## 5. Keep building

<Columns cols={2}>
  <Card title="Integrating with the Gateway" icon="plug" href="./developers/integrating-with-the-gateway">
    Production integration patterns and endpoint selection.
  </Card>

  <Card title="API Reference" icon="book" href="./api-reference/introduction">
    Full request and response docs for every endpoint.
  </Card>

  <Card title="Examples" icon="code" href="./guides/examples">
    More complete request samples for common workflows.
  </Card>

  <Card title="Support" icon="message-circle" href="https://phaseo.app/help">
    Get help with debugging, routing, and model behavior.
  </Card>
</Columns>
