> ## 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.

# Examples

> Copy-paste Phaseo requests, runnable sample projects, and cookbook walkthroughs.

Use this page when you already understand the basics and want working examples to copy into your app.

You can use it for:

* small request examples
* runnable sample projects
* cookbook walkthroughs that explain the project structure

<Note>
  Examples marked with `:free` do not require deposited credits.
</Note>

## Free text generation

Use this example for the fastest zero-credit smoke test with the Responses API.

<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": "google/gemma-3-27b:free",
      "input": "Summarize this article in 3 bullet points."
    }'
  ```

  ```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: "google/gemma-3-27b:free",
    input: "Summarize this article in 3 bullet points.",
  });

  console.log(response.output_text);
  ```

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

  client = Phaseo(api_key="YOUR_API_KEY")

  response = client.generate_response(
      {
          "model": "google/gemma-3-27b:free",
          "input": "Summarize this article in 3 bullet points.",
      }
  )

  print(response.get("output_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": "Summarize this article in 3 bullet points.",
        },
      },
    }

    response, err := client.GenerateResponse(context.Background(), phaseo.ResponsesRequest{
      Model: "google/gemma-3-27b:free",
      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"] = "google/gemma-3-27b:free",
      ["input"] = "Summarize this article in 3 bullet points."
  });

  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' => 'google/gemma-3-27b:free',
      'input' => 'Summarize this article in 3 bullet points.',
  ]);

  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: 'google/gemma-3-27b:free',
    input: 'Summarize this article in 3 bullet points.'
  )

  puts response
  ```

  ```java Java SDK theme={null}
  import ai.stats.sdk.Phaseo;

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

  String body = """
  {
    "model": "google/gemma-3-27b:free",
    "input": [
      {
        "role": "user",
        "content": [
          { "type": "input_text", "text": "Summarize this article in 3 bullet points." }
        ]
      }
    ]
  }
  """;

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

## Paid chat completion

Use this when you want an OpenAI-compatible chat request against a paid model.

```bash theme={null}
curl https://api.phaseo.ai/v1/chat/completions \
  -H "Authorization: Bearer $PHASEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5.4",
    "messages": [{"role": "user", "content": "Write a short email."}]
  }'
```

## Image generation

Use this when your app needs a generated image from a prompt.

```bash theme={null}
curl https://api.phaseo.ai/v1/images/generations \
  -H "Authorization: Bearer $PHASEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-1",
    "prompt": "A minimal line drawing of a lighthouse."
  }'
```

## Runnable sample projects

Each sample project has a matching cookbook walkthrough.

### Browser apps

* [Next.js web chat app](../cookbook/build-a-nextjs-web-chat-app)
  Repo: [examples/web-chat-nextjs](https://github.com/phaseoteam/Phaseo/tree/main/examples/web-chat-nextjs)
* [OAuth Next.js workbench](../cookbook/build-an-oauth-nextjs-workbench)
  Repo: [examples/oauth-client-nextjs](https://github.com/phaseoteam/Phaseo/tree/main/examples/oauth-client-nextjs)

### Script and backend starters

* [Node REST smoke app](../cookbook/build-a-node-rest-smoke-app)
  Repo: [examples/gateway-node-quickstart](https://github.com/phaseoteam/Phaseo/tree/main/examples/gateway-node-quickstart)
* [Python gateway CLI](../cookbook/build-a-python-gateway-cli)
  Repo: [examples/gateway-python-quickstart](https://github.com/phaseoteam/Phaseo/tree/main/examples/gateway-python-quickstart)

## Prompt-first starters

If you want a coding agent to generate the first version for you, start here:

* [Mini app starter prompts](../cookbook/mini-app-starter-prompts)

## More SDK examples

Explore the [SDK Reference](../sdk-reference/typescript/overview) for language-specific examples.
