Skip to main content
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.
  2. Create a key under Gateway -> Keys.
  3. Copy it once and store it securely.
Use this format:
Authorization: Bearer phaseo_v1_sk_<kid>_<secret>
Treat your API key like a password. Do not expose it in client-side code.

2. Send a text request

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

Request

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
  }'
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);
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);
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)
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)
}
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
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);
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
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));
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);

Response

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

Integrating with the Gateway

Production integration patterns and endpoint selection.

API Reference

Full request and response docs for every endpoint.

Examples

More complete request samples for common workflows.

Support

Get help with debugging, routing, and model behavior.
Last modified on July 9, 2026