Using a coding agent? Paste this prompt before you start.
- create an API key
- send one text request or structured decision
- read the generated text or typed answers
- know what to check first if the request fails
1. Create an API key
Install the Phaseo CLI, sign in and create a key:PHASEO_API_KEY. To use paid models, run phaseo login --scopes billing:write once, then add credits with phaseo credits add --amount 20. With a saved card, a workspace owner or admin confirms the charge from an emailed link. With no saved card, the command returns a checkout link that an owner or admin opens to pay, and the card is saved for later top-ups. You can also create the key in the Phaseo Dashboard under Gateway -> Keys.
Use this format:
Treat your API key like a password. Do not expose it in client-side code.
2. Send a text request
UsePOST /v1/responses for the first request. It is the recommended endpoint for new text-generation work.
Install an SDK
The cURL and JavaScript examples need nothing installed. To use the TypeScript or Python SDK, install it first:Request
Response
output[].content[] where type is output_text.
If you use the Vercel AI SDK, read the reply from result.text.
Stream the reply
To print the reply as it is generated, stream it. Each chunk’stext holds only the new text, so this loop prints the answer once. Closing events such as response.output_text.done have an empty text; their full text is in fullText (TypeScript) or full_text (Python).
3. Make a structured decision
Use the OpenAI-compatible format for new calls:input contains text or user messages with inline input_image parts, and questions is an ordered array of predicate, choice, or score questions. Answers use the same order, with optional names. Boolean choice values remain booleans. Hosted image URLs are unsupported; Luna accepts up to 128 inline images, while other providers impose their own limits. Explicit image detail and safety_identifier require an OpenAI route. Existing state, named question maps, noul, and criteria remain supported and return the original answer map. Together Tev requires that legacy format because it returns labels without probabilities. The legacy examples below remain valid.
POST /v1/decisions when your application needs typed answers instead of generated text. Phaseo exposes TypeSafe’s Jev 1.13 with the model ID typesafe/jev-1.13.0. Send a state value and one or more named questions; each answer is returned under the same name.
Decisions is a beta capability and may require workspace enablement. Jev 1.13 is billed at $0.042 per 1M input tokens; output tokens are free.
PHASEO_API_KEY set. Never expose a Gateway API key in browser code.
The three question types are:
choiceselects one option from a criteria map and returns probabilities and confidence.noulreturns a yes/no probability from 0 to 1.scoreevaluates an ordered criteria array and returns a probability-weighted score.
Request
Response
answers.department.choice, answers.is_urgent.noul, or answers.customer_impact.score. Use confidence and probabilities when you need to set an application threshold instead of branching on the value alone.
See the Decisions API reference for the full request and response contract, and TypeSafe’s Jev model reference for model behavior and upstream limits.
4. Troubleshoot the first request
401: check the API key andAuthorizationheader.400: check the request body and model ID.402: switch to a:freemodel or add credits before using a paid model.429or5xx: retry with exponential backoff.
5. If you are building video
Video generation is async. Create a job first, then poll or subscribe for the result.- Create a job with
POST /v1/videos. - Poll status with
GET /v1/videos/{video_id}until completed. - Download content from
GET /v1/videos/{video_id}/content.
6. 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.