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

> ## Agent Instructions
> Phaseo Gateway base URL: https://api.phaseo.app/v1. Send `Authorization: Bearer $PHASEO_API_KEY` with every request.
> Model IDs look like `provider/model`, for example `openai/gpt-6-astra`. Do not guess IDs: list them with `GET /v1/models` or check https://phaseo.app/models. `phaseo/free` routes to an available free model and needs no wallet balance.
> For new text integrations prefer `POST /v1/responses`. `POST /v1/chat/completions` (OpenAI format) and `POST /v1/messages` (Anthropic format) suit existing code.
> The full API contract is https://phaseo.app/docs/openapi/v1/openapi.yaml. Official SDKs: `@phaseo/sdk` (TypeScript) and `phaseo` (Python), plus Go, C#, PHP, Ruby and Rust.
> Search these docs over MCP at https://phaseo.app/docs/mcp, and install Phaseo skills with `npx skills add https://phaseo.app/docs`. If a page is wrong or out of date, report it with the MCP `submit_feedback` tool.
> Manage Phaseo accounts with the `phaseo` CLI (`npm install -g @phaseo/cli`, then `phaseo login` or `phaseo login --device-code`), the `/v1` Management API or the MCP server at `https://mcp.phaseo.app/mcp?access=manage`. Do not send users to the dashboard for account tasks. A person is still needed for sign-up, approving a sign-in, paying the first top-up on the checkout link that `phaseo credits add` returns when no card is saved, confirming each saved-card top-up from the emailed link, and account security (password, MFA, passkeys). Create API keys with `phaseo keys create --name <name> --json`; never guess one. Credit top-ups need `phaseo login --scopes billing:write` first. Task map: https://phaseo.app/docs/v1/developers/manage-from-an-agent.md.

# Build a Node REST Smoke App

> Use the Node quickstart sample as a walkthrough for a raw HTTP integration and smoke-test script.

Use this page when you want the smallest possible Node integration and you want to see every HTTP request clearly.

**Goal:** Verify Phaseo health, model discovery, and one generation request using raw HTTP.

**Outcome:** A dependency-light script you can keep as a deployment or integration smoke test.

Build a **Node REST smoke app** against Phaseo using raw HTTP.

You are building a small Node.js integration against Phaseo Gateway using raw HTTP.

&#x20; Create a script-based app that:
&#x20; \- reads PHASEO\_API\_KEY from the environment
&#x20; \- calls health and model discovery routes
&#x20; \- makes one text generation request
&#x20; \- optionally calls one additional surface such as embeddings

&#x20; Requirements:
&#x20; \- Use raw fetch, not an SDK.
&#x20; \- Keep the code dependency-light.
&#x20; \- Keep request payloads explicit and easy to audit.
&#x20; \- Print clear success and error output in the terminal.
&#x20; \- Support a quick smoke mode and a fuller end-to-end mode.

&#x20; Deliverables:
&#x20; \- the script
&#x20; \- package.json commands
&#x20; \- a short README
&#x20; \- an .env.example entry

&#x20; Verification:
&#x20; \- run the smoke mode if possible
&#x20; \- run one full request path if possible
&#x20; \- report what was verified and any remaining assumptions.

## Sample project

* GitHub: [examples/gateway-node-quickstart](https://github.com/phaseoteam/Phaseo/tree/main/examples/gateway-node-quickstart)
* Local repo path: `examples/gateway-node-quickstart`

## What this app does

* calls `GET /v1/health`
* calls `GET /v1/models`
* exercises generation routes like `POST /v1/responses`
* gives you a raw HTTP reference for smoke tests, scripts, and backend checks

## When this sample is the right fit

Start here when:

* you want to debug raw API calls directly
* you do not want SDK abstractions yet
* you are building a script, worker, or CLI rather than a web UI

## Prerequisites

* Node.js with built-in `fetch` support
* a Phaseo API key

## Run the sample

```bash theme={null}
cd examples/gateway-node-quickstart
cp .env.example .env.local
```

Set:

* `PHASEO_API_KEY`

Then run either:

```bash theme={null}
npm run smoke
```

or:

```bash theme={null}
npm run start
```

## Check your work

* Smoke mode confirms that the API is reachable.
* Model discovery returns at least one model.
* The full run prints one successful generation response.
* Authentication and non-200 responses produce clear terminal errors.

## What to look at in the code

* how the script loads `.env.local`
* how the authorization header is attached
* how each request is built explicitly
* how non-200 responses are surfaced instead of swallowed

## How to make it your own

* trim the script to only the routes your service actually needs
* move shared request code into one helper if multiple scripts will use it
* upgrade to the TypeScript SDK later if the raw HTTP path becomes repetitive

## Related guides

* [Mini app starter prompts](https://phaseo.app/docs/v1/cookbook/mini-app-starter-prompts.md)
* [Launch on the free router](https://phaseo.app/docs/v1/cookbook/free-router-first-deploy.md)
* [Examples](https://phaseo.app/docs/v1/guides/examples.md)


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