Skip to content
PLEXON AI
Theme
Download

Company API

On this page

This page is for a company whose server calls the Plexon models for its own users. It covers how to get access, the first call, the model API and what it streams back, the tools Plexon runs, the company API (accounts, money, optional per-user keys), every error the server answers, and the limits.

Every path below is relative to the Plexon server, written as $PLEXON. That is https://server.plexon.ai. $COMPANY_KEY in the samples is your company key, and $GROUP_ID the id of one of your company’s user groups, $GROUP_SLUG its slug.

What this is

Your server holds one secret, a company key. With each call it sends the key and a handle, which is your own id for the user the call is for. Plexon answers with the model’s reply, charges the call to your company’s prepaid credits, and keeps one account per handle. You do not have to create that account, and you store no key for it.

your user  ->  your server       ->  Plexon                  ->  the models
               one company key       one account per handle
               + your user's id      paid from your credits

The plan behind it is called pay as you go: no subscription and no seats. You fund a balance, and each call costs what it cost.

Get access

There is no sign-up form for this. Plexon turns pay as you go on for your company, and from then on every step is your own company admin’s.

  1. Write to Plexon. Send a note to contact@plexon.ai and say which company it is for. Plexon turns pay as you go on for it. Until then the company panel’s page reads “Pay as you go is not turned on for this company. Ask Plexon to turn it on.”, and no key can be made. If Plexon ever turns it off again, a key’s calls answer 403 payg_not_enabled with that sentence.
  2. Sign in to the company panel. Your company admin signs in at https://plexon.ai and opens Pay as you go in the company panel.
  3. Add funds by card. Choose Add funds by card and enter a whole number of dollars, from 5 to 10,000. The money lands in the reserve once the payment clears.
  4. Fill the pool. Choose Top up the pool and move some of the reserve into the pool, at least 1 USD. The pool is what your accounts spend. With an empty pool a first call for a new handle answers 402 credits_exhausted and makes no account.
  5. Create a company key. Open the Company keys tab, choose Create key and give the key a name. The key is shown once. Store it as a secret on your server.

Steps 3 and 4 can run by themselves. Under Automatic top-up on the same page, save a card and set a threshold (100 USD or more) and a top-up amount (400 to 10,000 USD). When the pool falls below the threshold, the card is charged the top-up amount and it goes to the pool. The reserve is not touched; moving it stays your step. A monthly cap on those charges is optional. A charge that fails pauses the rule until the card is replaced or Retry is pressed, so keep the manual steps in mind for that day.

The two keys

There are two kinds of access key. Each is shown once, when it is created.

Key Looks like Sent to What it can do
Company key plx_c_ followed by 43 characters the model API, /api/v1, with the X-Plexon-Handle header; the company API, /auth/company/payg; desktop access for your people, /auth/company/seats, once your company admin allows it model calls and the balance of any account of your company, named by its handle; everything in “The company API” below except managing the company’s own keys and paying by card; and, once your company admin allows it, turning on desktop access for your people at /auth/company/seats (“Desktop access for your people”, below)
User key plx_u_ followed by 43 characters the model API, /api/v1; its account’s own history, /auth/billing/payg/ledger model calls, the balance and the movements of that one account. Optional

Send a key as a bearer token:

Authorization: Bearer plx_c_...

A company key cannot create, list or revoke company keys, and it cannot pay by card: a leaked key must not be able to mint the next one or spend a card. It belongs on your server, because it is the credential for every account your company has.

User keys are optional. Use one for a key that has to live on a device the company does not control, such as an app on the person’s own phone: a leaked user key reaches one account, a leaked company key reaches all of them. User keys are created through the company API (“An account’s user keys”, below).

A key’s list item shows prefix, its first 12 characters, which tells keys apart without the secret.

Your first call

Your server makes a chat call for its customer cust-4821, with the company key and the handle. There is no step before it: this first call creates the account.

bash
curl -s -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"flags": {"mode": "ask"}, "messages": [{"role": "user", "content": "Hi"}], "provider": {"name": "plexon", "model": "plexon-1.0"}}'

The answer carries the reply in response and, when the call was charged, a metered block with its cost:

json
{"success": true, "response": "Hi. What are you working on?",
 "usage": {"prompt_tokens": 8824, "completion_tokens": 9, "total_tokens": 8833},
 "metered": {"cost": 0, "cost_microcredits": 425280, "rate_card": "peak",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 19999},
 "...": "..."}

The "...": "..." pair stands for fields of the Plexon app’s own, which “Chat” below names. The metered block is the same on every route:

Field Type Meaning
cost integer the cost in whole credits, rounded to the nearest
cost_microcredits integer the exact cost, a million to a credit: 425280 is 0.42528 credits
rate_card string flat, peak or off_peak: the price list the call was charged on. You do not choose it, and the cost already reflects it
included_used, included_limit integer always 0 on pay as you go
purchased integer the account’s own credits after the call, in whole credits; negative when the call overdrew them. 0 here: a new account has none, so the pool paid
pool integer the company pool after the call, in whole credits rounded down; left out when it is 0

Most of those 8,824 prompt tokens are Plexon’s built-in prompt, which rides every chat call. A first call reads it in full and costs about 0.43 credits, as here. When these samples were run, a repeat of the same call cost 0.02 to 0.05 credits, once that prompt was served from cache. That is what the samples cost, not a price: the metered block of each answer is the figure to trust.

The same handle on every later call reaches the same account. To read what it can spend:

bash
curl -s "$PLEXON/api/v1/balance" -H "Authorization: Bearer $COMPANY_KEY" -H "X-Plexon-Handle: cust-4821"
json
{"plan": "payg",
 "purchased": {"credits": 0, "usd": 0, "uc": 0},
 "pool": {"credits": 19999, "usd": 199.99, "uc": 19999574720},
 "available": {"credits": 19999, "usd": 199.99, "uc": 19999574720},
 "hd_voice": true, "unmetered": true}

Each balance here is an amount object, the same value three ways: whole credits, dollars, and uc, the exact value in microcredits (one million to a credit). “Money” has the detail, and “The balance” explains the other fields.

Two turns in Go

A complete program, standard library only. It does what a chat feature has to do and one cURL call does not show: it keeps the conversation itself (the server keeps none, so each reply is appended and everything is sent again), and it reads a streamed reply event by event until data:[DONE].

go
// Two chat turns for one user: a plain call, then a streamed one.
// Run with PLEXON and COMPANY_KEY in the environment.
package main

import (
	"bufio"
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"net/http"
	"os"
	"strings"
)

type message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

// metered is the charge of one call. Microcredits are exact: a million to a credit.
type metered struct {
	CostMicrocredits int64 `json:"cost_microcredits"`
}

// chat sends the whole conversation for one user and returns the open response.
func chat(handle string, messages []message, stream bool) (*http.Response, error) {
	body, err := json.Marshal(map[string]any{
		"flags":    map[string]string{"mode": "ask"},
		"messages": messages,
		"provider": map[string]string{"name": "plexon", "model": "plexon-1.0"},
		"stream":   stream,
	})
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest(http.MethodPost, os.Getenv("PLEXON")+"/api/v1/chat", bytes.NewReader(body))
	if err != nil {
		return nil, err
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("COMPANY_KEY"))
	req.Header.Set("X-Plexon-Handle", handle)
	req.Header.Set("Content-Type", "application/json")
	res, err := http.DefaultClient.Do(req)
	if err != nil {
		return nil, err
	}
	if res.StatusCode != http.StatusOK {
		defer res.Body.Close()
		var refusal struct {
			Error   string `json:"error"`
			Message string `json:"message"`
		}
		json.NewDecoder(res.Body).Decode(&refusal)
		// Branch on refusal.Error, not the status: a 429 is credits_in_use or a
		// busy model (processing_failed, with Retry-After). This sample stops.
		return nil, fmt.Errorf("%d %s: %s", res.StatusCode, refusal.Error, refusal.Message)
	}
	return res, nil
}

// plain is a turn answered as one JSON body.
func plain(handle string, messages []message) (string, metered, error) {
	res, err := chat(handle, messages, false)
	if err != nil {
		return "", metered{}, err
	}
	defer res.Body.Close()
	var answer struct {
		Response string  `json:"response"`
		Metered  metered `json:"metered"`
	}
	if err := json.NewDecoder(res.Body).Decode(&answer); err != nil {
		return "", metered{}, err
	}
	// The app's end-of-answer marker is not part of the answer.
	return strings.TrimPrefix(answer.Response, "<final>true</final>"), answer.Metered, nil
}

// streamed is a turn read event by event. It prints each piece as it arrives
// and returns the whole reply, so the next turn can send it back.
func streamed(handle string, messages []message) (string, metered, error) {
	res, err := chat(handle, messages, true)
	if err != nil {
		return "", metered{}, err
	}
	defer res.Body.Close()

	var reply strings.Builder
	var charge metered
	// One "data:" line per event, a blank line between events, "data:[DONE]" last.
	// A Scanner refuses a line over 64 KB unless it is given a larger buffer.
	events := bufio.NewScanner(res.Body)
	events.Buffer(make([]byte, 0, 64*1024), 1024*1024)
	for events.Scan() {
		data, found := strings.CutPrefix(events.Text(), "data:")
		if !found {
			continue
		}
		data = strings.TrimSpace(data)
		if data == "[DONE]" {
			return reply.String(), charge, nil
		}
		var event struct {
			Type    string  `json:"type"`
			Content string  `json:"content"`
			Metered metered `json:"metered"`
			Error   string  `json:"error"`
		}
		if json.Unmarshal([]byte(data), &event) != nil {
			continue
		}
		switch event.Type {
		case "content":
			fmt.Print(event.Content)
			reply.WriteString(event.Content)
		case "metered":
			charge = event.Metered
		case "error": // a failure after the stream opened arrives here, inside the HTTP 200
			// A metered event just before it is what the part already produced cost.
			return reply.String(), charge, errors.New(event.Error)
		} // any other type is not for you: skip it
	}
	if err := events.Err(); err != nil {
		return "", metered{}, err
	}
	return "", metered{}, errors.New("the stream ended before data:[DONE]")
}

func run() error {
	const handle = "cust-4821" // your own id for this user
	messages := []message{{Role: "user", Content: "Give me one name for a bakery."}}

	reply, charge, err := plain(handle, messages)
	if err != nil {
		return err
	}
	fmt.Printf("%s\n(%d microcredits)\n", reply, charge.CostMicrocredits)

	// The server keeps no history, so the next turn sends the whole conversation.
	messages = append(messages,
		message{Role: "assistant", Content: reply},
		message{Role: "user", Content: "Now a slogan for it."})
	reply, charge, err = streamed(handle, messages)
	if err != nil {
		if charge.CostMicrocredits > 0 {
			fmt.Printf("\n(%d microcredits for the part before the failure)\n", charge.CostMicrocredits)
		}
		return err
	}
	fmt.Printf("\n(%d microcredits)\n", charge.CostMicrocredits)

	// Keep the reply too, for a third turn.
	messages = append(messages, message{Role: "assistant", Content: reply})
	fmt.Printf("%d messages in the conversation\n", len(messages))
	return nil
}

func main() {
	if err := run(); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}

Handles

A handle is your own id for one of your users: a customer number, a row id from your database, anything stable you already keep for that person.

The handle names who makes the call, and that person’s account pays for it. It is the only header of the three that a call needs. X-Plexon-Customer looks alike and is a different thing: a label for whom the call is made, with no account and no money behind it. Which header is which sets the three side by side.

A disable, a move out of the company or a change of your company’s pay-as-you-go switch takes effect within a minute.

Groups and customers

Two more headers are optional on a call by company key. Both work on every route of the model API, the two GET routes included. A call by user key ignores them, as it ignores X-Plexon-Handle.

The customer is checked first, then the group. A refusal here comes before anything else: no account is made, nothing is held or charged, and the model is not called.

A chat turn for cust-4821, in a group, for one of your customers:

bash
curl -s -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "X-Plexon-Group: $GROUP_ID" -H "X-Plexon-Customer: shop-12" \
  -H "Content-Type: application/json" \
  -d '{"flags": {"mode": "ask"}, "messages": [{"role": "user", "content": "Hi"}], "provider": {"name": "plexon", "model": "plexon-1.0"}}'

Among the answer’s headers:

X-Plexon-Marketplaces: acme-clinic,acme-shop
json
{"success": true, "response": "Hi. What are you working on?",
 "metered": {"cost": 0, "cost_microcredits": 21280, "rate_card": "peak",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 19998},
 "...": "..."}

The call’s row in the account’s movements now reads "customer": "shop-12" and the group’s id in group_id (“One account” shows the read). The same turn with the group’s slug instead of its id:

bash
curl -s -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "X-Plexon-Group: $GROUP_SLUG" -H "X-Plexon-Customer: shop-12" \
  -H "Content-Type: application/json" \
  -d '{"flags": {"mode": "ask"}, "messages": [{"role": "user", "content": "Hi"}], "provider": {"name": "plexon", "model": "plexon-1.0"}}'

Among the answer’s headers, the same marketplaces as by id:

X-Plexon-Marketplaces: acme-clinic,acme-shop
json
{"success": true, "response": "Hi. What are you working on?",
 "metered": {"cost": 0, "cost_microcredits": 21280, "rate_card": "peak",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 19998},
 "...": "..."}

Its row keeps the group’s id in group_id, not the slug. A group id that is not one of your company’s:

bash
curl -s "$PLEXON/api/v1/balance" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "X-Plexon-Group: ffffffff-ffff-4fff-bfff-ffffffffffff"

Answers 404:

json
{"error": "group_not_found", "message": "Your company has no user group with this id or slug.", "code": 404}

Which header is which

Three headers travel with a call by company key. Each answers its own question.

X-Plexon-Handle X-Plexon-Group X-Plexon-Customer
The question who makes the call which of your marketplaces serve it whom the call is made for
Needed yes, on every call no no
Names one of your users: a person or a seat in your product one of your company’s user groups, by id or slug anyone you bill or report by: a shop, a clinic, a tenant, an order
An account in Plexon yes, made by the first POST with a new handle no, and it does not put the account in the group no, nothing is ever made for it
Money the account’s own credits are spent first, then your pool none none
Can a call be refused over it yes: a disabled account, one that left your company, no credits only when no such group exists only when its shape is wrong
Kept on the call’s row the row is in that account’s history as group_id as customer
Read back with the balance, the account’s history, ?handle= on the accounts list group_id on each row the customer= filter on every history read
A mistyped value a new account that spends your pool a refused call, nothing spent one row with the wrong label

In short: the handle decides who pays, the group decides which marketplaces serve the call, and the customer decides nothing. It is a note on the row for your own bookkeeping.

Your users are your customers. A bakery runs a help desk on its site and every visitor who signs in is the customer. Send the handle and nothing else:

X-Plexon-Handle: cust-4821

Each visitor is an account with a history of its own. There is nobody else to attribute a call to, so X-Plexon-Customer would only repeat the handle.

Your users work for your customers. You sell software to clinics, and the clinic’s staff use it. Maria works at clinic 12 on Monday and covers clinic 30 on Tuesday. She is one account on both days, and the customer changes with where she is working:

X-Plexon-Handle: maria-4821
X-Plexon-Customer: clinic-12
X-Plexon-Handle: maria-4821
X-Plexon-Customer: clinic-30

Maria has one balance and one history. Each call’s row says which clinic it was for.

Billing a customer at the end of the month. Read what drew on your pool for one clinic, whoever on its staff made the calls:

GET /auth/company/payg/pool-usage?customer=clinic-12&from=2026-11-01T00:00:00Z&to=2026-12-01T00:00:00Z

Add up the rows’ amount for the clinic’s bill. The same customer= filter on one account’s history (GET /auth/company/payg/users/{id}) answers what Maria spent for clinic 12 alone.

A call made for no person. A nightly job writes product descriptions for each shop on your platform. Nobody is at the keyboard, so give the job a handle of its own and tag each call with its shop:

X-Plexon-Handle: job-descriptions
X-Plexon-Customer: shop-12

The job is one account, and its history splits by shop.

The customer is not always a company. Any id you report by fits: an order (order-77), a project, a ticket, a cost centre. A support tool can send the ticket’s id and later read what one ticket cost.

One user, two kinds of work. Your company has two marketplaces, one linked to the group doctors and one to the group reception. The same person can make a call under either, and the group names which:

X-Plexon-Handle: maria-4821
X-Plexon-Group: doctors
X-Plexon-Customer: clinic-12

The call is served under your company’s own marketplaces plus the ones linked to doctors, and the answer’s X-Plexon-Marketplaces header lists them. Naming a group does not make Maria a member of it and does not change what the model is told. With no group header the call is served under your company’s own marketplaces alone.

Three ways to get it wrong.

The model API

Every path is under $PLEXON/api/v1. Your server sends the company key and names the account in the X-Plexon-Handle header:

Authorization: Bearer plx_c_...
X-Plexon-Handle: cust-4821
X-Plexon-Group: <a user group id or slug>   optional
X-Plexon-Customer: shop-12              optional

The handle is the account that makes the call and pays for it. The two optional headers are tags on the call: the group picks the marketplaces it is served under, and the customer is your own label for whom it is made. Both are under Groups and customers, and Which header is which compares the three with examples. Every call by company key needs the handle header, the two GET routes included. With no header the call answers 400 handle_required. Bodies are JSON (Content-Type: application/json) unless the route’s section says otherwise, and the model routes take large ones: pictures and recordings ride in them.

In the samples, lighthouse.jpg, order.mp3, song.mp3 and plate.jpg stand for any file of yours: a picture, five seconds of speech, 24 seconds of singing, and a photo of a plate of food. A sample that sends a file builds its body into body.json first. The streamed samples pass -N to curl so each event prints as it arrives.

Routes

Route What it does Section
POST /api/v1/chat a chat turn, answered as one JSON body or streamed Chat
POST /api/v1/image a picture, from words or from reference pictures A picture
POST /api/v1/video a clip, from words, frames or references A clip
POST /api/v1/music a song, an instrumental or a cover A song
POST /api/v1/tts speech from text Speech
GET /api/v1/tts/voices the voices speech can use The voices
POST /api/v1/transcribe text from a recording Speech to text
GET /api/v1/balance what the account can spend The balance
POST /api/v1/mcp the tools Plexon runs for you Tools Plexon runs

Every other /api/v1 route answers 403 access_key_scope to a key.

Chat: POST /api/v1/chat

One turn of a conversation. The server keeps no history, so every call sends the whole conversation, and the answer is one JSON body, or server-sent events with "stream": true. The Plexon app uses this same route, so the body takes more fields than the ones below. X-Plexon-Group and X-Plexon-Customer apply here: optional tags for the marketplaces a call is served under and for whom it is made, beside X-Plexon-Handle, the account that makes it (Groups and customers). You need only these:

Field Type Required Values Default Notes
flags.mode string yes ask, summarizer, code, auto, architect, spec none ask is a question and its answer, and every sample here uses it. summarizer condenses the conversation it is sent. The other four carry the Plexon app’s instructions for editing files and planning. Missing or unknown answers 400
flags.disable_system_prompts boolean no true, false false a much smaller built-in prompt, so a first call costs less. Your role (persona_system_prompt or persona_name), persona_overlay_prompt, custom_system_prompts and system_info still reach the model; response_style, input_modality and examples do nothing with it, because the smaller prompt holds none of those parts
messages[].role string yes user, assistant, tool, system none at least one message besides system ones; send the whole conversation every time. A system message is taken out of the conversation and added to your custom instructions, after custom_system_prompts, and a summarizer call drops it. Your standing instructions belong in persona_system_prompt or custom_system_prompts
messages[].content string or array yes a string, or a list of parts of type text or image_url none the sample “A message that carries a picture” shows both parts. A picture’s url is a data:image/...;base64, URI or an https link, as JPEG, PNG, GIF or WebP. null on an assistant message that only called tools
messages[].name string no the tool’s name none on a tool message
messages[].tool_calls array no the tool_calls of an earlier answer, as received none on the assistant message that called your tools
messages[].tool_call_id string no the id of the call this message answers none on a tool message, whose content is your tool’s result
messages[].reasoning string no the reasoning of an earlier answer none optional. The samples leave it out and the model answers the same
messages[].reasoning_content string no any text none the same, under the name some models use; optional too
messages[].reasoning_items array no the reasoning_items of an earlier answer none opaque; optional. When you keep them, send them back as received
provider.name string yes plexon none any other name, or none, answers 400 validation_error before anything is sent
provider.model string no plexon-1.0, plexon-1.0-code, plexon-1.0-image plexon-1.0 a missing or unknown model is served as plexon-1.0. plexon-1.0-code is the coding model. plexon-1.0-image makes one picture from the conversation, charged as a picture and answered as Markdown; /image is the route for pictures. plexon-1.0-video answers 400
provider.enable_auto_routing boolean no true, false false leave it out. With it the server may pick the kind of model per message, and a turn it reads as a request for a picture is charged as a picture
provider.max_tokens integer no 1 to 128,000 128,000 the most output tokens the reply may use; a larger value is lowered to the model’s own limit
provider.enable_streaming boolean no true, false true false answers JSON even with "stream": true
stream boolean no true, false false server-sent events instead of one JSON body; summarizer mode always answers JSON
session_id string no any text that does not start with invoke_ none optional. One stable id per conversation helps the prompt cache
persona_system_prompt string no any text none your assistant’s role, in place of the built-in one
persona_name string no default, software-developer, writer, designer, marketer, dietitian, financial-analyst, product-manager, stock-trader, greek-logistics, startup-founder, personal-shopper, mirror, home-interior default one of Plexon’s built-in roles. An empty or unknown name reads as default, a software engineering role of its own, written apart from software-developer. persona_system_prompt replaces it
persona_overlay_prompt string no any text none added after the role, as rules that also apply
custom_system_prompts string no any text none your own standing instructions, added after Plexon’s: facts, opening hours, house rules
system_info.date_time string no a date as YYYY-MM-DD none the model has no date otherwise
system_info.locale string no a locale, such as el-GR none the user’s language and region
system_info.timezone string no a time zone, such as Europe/Athens none the user’s time zone
mcp_tools array no your tools, each with a name, a description and an inputSchema (a JSON Schema) none the model may call them. The call comes back to you: the chat route never runs a tool. A tool Plexon serves runs when your server forwards the call to /api/v1/mcp (Tools Plexon runs). A tool whose schema cannot be read is dropped
tool_choice string no auto, any, required, or the name of one of your tools auto with mcp_tools. any and required mean the same: the model must call one of your tools. Ignored on a call that asks for web tools
web_tools.search boolean no true, false false the model may search the web on this call. It decides itself whether a question needs a search. The search sample below answered in 6.4 seconds
web_tools.read_urls boolean no true, false false the model may read the links in the last user message. A read is reliable for one link per message: the page was read in 10 of 10 tries. With several links in one message, most went unread. With two links, one of them was read in only 1 of 10 tries; with ten to twelve, 2 to 7 were read per try. web.pages and sources say which pages came through: send one link per message when each one matters
web_tools.deep boolean no true, false false needs search. The model makes several searches, opens pages and finds text in them. It reads more, because every search result and every opened page is input. It took 6 to 41 seconds in our runs. What it costs depends on how much of the prompt came from cache (“What to know about web tools” gives one example)
response_style string no concise, detailed none how long the reply runs
input_modality string no voice none short replies that read well aloud
examples array no items with an input, an output and an optional label none worked examples the model follows

Fields the Plexon app sends for itself. These belong to the Plexon app and are not meant for a call by key. Leave out the flags, the provider fields and the other fields listed next: some change the prompt (one turns reasoning off and caps the reply), one changes how deeply the model thinks, and some answer 400 on a value the app would never send. The flags: flags.talk, flags.skip_validation, flags.skip_retry, flags.enable_summary, flags.skip_response_metadata, flags.max_cycles, flags.max_prompt_cycles, flags.mcp_tools_enabled, flags.skip_custom_instructions, flags.is_sub_agent, flags.disable_questions, flags.one_shot, flags.harness_level.
The provider fields: provider.is_planning, provider.reasoning_effort, provider.encrypted_api_key, provider.auth_method, provider.api_key_helper, provider.chunk_size, provider.chunk_overlap, provider.tool_deferral.
The rest: media_local_paths, sub_agent_config, parent_agent_id, subtask_id, batch_mode, batch_custom_id.
Ignored on a call by key (the call is served as if they were not sent): project_documents, memory, global_memory, retrieved_memory, retrieved_memory_at, agent_catalog, skill_registry, directory_tree, plan_draft, working_directory, extra_directories, connectors, plexon_paths, tool_index, validation_feedback, builtin_tools, skill_container, provider.temperature, provider.top_p, provider.stop_sequences, provider.headers, provider.region, provider.available_builtin_tools, provider.inline_model, provider.compatibility, and every field of system_info but its date, locale and time zone. A working directory that starts with two dots is still refused, as under “Refusals”. A value of the wrong JSON type in one of these fields still answers 400 invalid_request, because the body is then not the JSON the route takes.

What the model is told. Every chat call carries Plexon’s built-in prompt before your messages. With no role of your own the model answers as Plexon’s built-in assistant for software work (the default role), which is why the first call above asks what you are working on. persona_system_prompt gives it your role. flags.disable_system_prompts sends a much smaller built-in prompt, so a first call costs less: with it, the questions on this page that use no web tools sent 3,476 to 4,325 prompt tokens, where the full prompt sent about 8,800. A repeat of the full prompt served from cache can cost less still. custom_system_prompts adds your own standing instructions, and system_info.date_time tells the model the date, which it does not know otherwise. Plexon’s own rules still follow your role, so the model may give its name as Plexon: say in your role what it should call itself if that matters to you.

A call that sends no tools. For a help desk, or any call that sends no tools, put this line in your role or in custom_system_prompts:

You have no tools in this conversation: you cannot search the web, open a link or run a command. When a question needs one of those, say in words that you cannot do it here.

The smaller built-in prompt alone does not do this job. Without the line, a question only the web could answer can come back as the text of a tool call instead of an answer. A question about the latest release of something came back that way 8 to 10 times in 10, and a link to read 3 to 4 times in 10. With the line it never did (0 of 40). Such a reply may open with a short sentence, then holds a tag such as <plexon_system_command> around a command and no answer. Send flags.disable_system_prompts: true on such a call as well: the full prompt describes the Plexon app’s own tools, and a call that sends no tools holds none of them.

The reply may begin with <final>true</final>. It is the app’s end-of-answer marker, not part of the answer: strip it before you show or store the reply. A plain JSON answer may carry it (the tool sample below does); a streamed reply in ask mode does not.

A streamed turn. With "stream": true the reply arrives in pieces:

bash
curl -s -N -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"flags": {"mode": "ask"}, "messages": [{"role": "user", "content": "Give me one name for a bakery."}], "provider": {"name": "plexon", "model": "plexon-1.0"}, "stream": true}'

The events as they arrived, with the model’s reasoning events left out:

data:{"type":"content","content":"\"Crumb & K","tool_id":"","name":"","args":"","error":"","is_done":false}
data:{"type":"content","content":"ettle\"","tool_id":"","name":"","args":"","error":"","is_done":false}
data:{"type":"usage","content":"","tool_id":"","name":"","args":"","error":"","is_done":false,"usage":{"prompt_tokens":8796,"completion_tokens":23,"total_tokens":8819}}
data:{"type":"service_tier","content":"","tool_id":"","name":"","args":"","error":"","is_done":false,"service_tier":"premium"}
data:{"type":"metered","content":"","tool_id":"","name":"","args":"","error":"","is_done":false,"metered":{"cost":0,"cost_microcredits":161760,"rate_card":"peak","included_used":0,"included_limit":0,"purchased":0,"pool":19732}}
data:[DONE]

Every event except error carries the keys content, tool_id, name, args, error and is_done, empty when they do not apply; an error event has fields of its own (“Streaming”). Join the content pieces in order for the reply.

type Fields
content content: the next piece of the reply
reasoning reasoning: the next piece of the model’s reasoning, when it shows one
tool_call tool_id, name (on every piece) and args, a piece of the call’s JSON arguments
usage usage: the token counts of the turn. It can arrive more than once; the last one counts. On a call that asks for web tools it also carries web, with searches, pages and served, and the first one reports only the question’s own tokens and zero counts. usage then holds web_search_requests, the searches made, and web_fetch_requests, the pages read from a link or opened by a deep search, each only when it is above zero
web_tool web_tool: one step of a web tool, with tool (web_search or read_url), action (search, open_page, find_in_page or read_link), query for a search, url for an opened page or a link read, and both query and url for a find in a page. A search step with several queries is one event per query
sources sources: the pages a step found or read, each with a url, a title when there is one, and site_name and snippet for a search result. An address already sent on this response is not sent again
citation citation: url, title and cited_text. It follows the text it supports. cited_text is the text of the reply the citation supports, which can span several content events
service_tier the Plexon app’s; skip it
metered metered: the charge, the same block as the plain answer’s
reasoning_items reasoning_items, near the end, when the model returned them: keep them and send them back on the assistant message
error the failure, as “Streaming” below describes

A streamed tool call. When the stream ends, rebuild one tool_calls item per tool_id: {"id": <the tool_id>, "type": "function", "function": {"name": <the name>, "arguments": <the args pieces of that tool_id, joined in order>}}, and send the list on the assistant message, as the tool sample below does with a plain answer’s tool_calls.

Two turns. The second call sends the first question, the reply it got, and the next question:

bash
curl -s -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"flags": {"mode": "ask"},
       "messages": [{"role": "user", "content": "Give me one name for a bakery."},
                    {"role": "assistant", "content": "\"Crumb & Kettle\""},
                    {"role": "user", "content": "Now a slogan for it."}],
       "provider": {"name": "plexon", "model": "plexon-1.0"}}'
json
{"success": true, "response": "\"Baked slow, gone fast.\"",
 "usage": {"prompt_tokens": 8846, "completion_tokens": 32, "total_tokens": 8878,
           "prompt_tokens_details": {"cached_tokens": 8704}},
 "service_tier": "premium",
 "metered": {"cost": 0, "cost_microcredits": 21280, "rate_card": "peak",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 19515},
 "...": "..."}

The built-in prompt came from cache this time (cached_tokens: 8,704 of the 8,846), so the turn cost 0.02 credits.

A message that carries a picture. content becomes a list of parts, here a question and lighthouse.jpg as a data URI:

bash
{ printf '{"flags": {"mode": "ask"}, "messages": [{"role": "user", "content": [{"type": "text", "text": "Describe this picture in one sentence."}, {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,'; base64 < lighthouse.jpg | tr -d '\n'; printf '"}}]}], "provider": {"name": "plexon", "model": "plexon-1.0"}}'; } > body.json
curl -s -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" -d @body.json
json
{"success": true,
 "response": "A watercolour of a red-and-white lighthouse on a rocky cliff above the sea at sunset, with gulls in a pink and orange sky.",
 "usage": {"prompt_tokens": 9472, "completion_tokens": 30, "total_tokens": 9502},
 "service_tier": "premium",
 "metered": {"cost": 0, "cost_microcredits": 51040, "rate_card": "peak",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 19732},
 "...": "..."}

The server sets no limit of its own on the size or number of pictures in a message. A picture in a chat call costs input tokens at the model’s input rate; there is no per-picture fee.

Your own role. A help desk for a bakery, with its own facts, the date, and the smaller built-in prompt:

bash
curl -s -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"flags": {"mode": "ask", "disable_system_prompts": true},
       "persona_system_prompt": "You are the help desk of Acme Bakery. Answer in one sentence.",
       "custom_system_prompts": "Acme Bakery opens at 7:00, Monday to Saturday.",
       "system_info": {"date_time": "2026-11-27"},
       "messages": [{"role": "user", "content": "Who are you, and when do you open?"}],
       "provider": {"name": "plexon", "model": "plexon-1.0"}}'
json
{"success": true,
 "response": "I'm Plexon, the help desk assistant for Acme Bakery, and we open at 7:00 Monday to Saturday.",
 "usage": {"prompt_tokens": 3476, "completion_tokens": 78, "total_tokens": 3554},
 "service_tier": "premium",
 "metered": {"cost": 0, "cost_microcredits": 181760, "rate_card": "peak",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 19515},
 "...": "..."}

The model’s reasoning counts as output tokens, which is why a one-sentence reply shows 78 completion tokens. This role carries no line about tools because its question needs nothing outside the role; a real help desk adds the one under “A call that sends no tools”.

Your own tool. Describe the tool in mcp_tools. The model does not run it: it answers with the call, your server runs the tool, and the next call sends the result back. tool_choice here makes the model call it:

bash
curl -s -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"flags": {"mode": "ask"},
       "mcp_tools": [{"name": "get_weather", "description": "Weather for a city",
                      "inputSchema": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}],
       "tool_choice": "get_weather",
       "messages": [{"role": "user", "content": "Weather in Athens?"}],
       "provider": {"name": "plexon", "model": "plexon-1.0"}}'
json
{"success": true, "response": "Checking current conditions in Athens.",
 "tool_calls": [{"id": "call_abc123", "type": "function",
                 "function": {"name": "get_weather", "arguments": "{\"city\":\"Athens\"}"}}],
 "usage": {"prompt_tokens": 10807, "completion_tokens": 202, "total_tokens": 11009},
 "service_tier": "premium",
 "metered": {"cost": 0, "cost_microcredits": 190240, "rate_card": "peak",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 19732},
 "...": "..."}

arguments is a JSON string: parse it and run the tool. Then send the conversation again with the assistant message as it came, its tool_calls included, and a tool message that carries the result under the call’s id:

bash
curl -s -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"flags": {"mode": "ask"},
       "mcp_tools": [{"name": "get_weather", "description": "Weather for a city",
                      "inputSchema": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}}],
       "messages": [{"role": "user", "content": "Weather in Athens?"},
                    {"role": "assistant", "content": "Checking current conditions in Athens.",
                     "tool_calls": [{"id": "call_abc123", "type": "function",
                                     "function": {"name": "get_weather", "arguments": "{\"city\":\"Athens\"}"}}]},
                    {"role": "tool", "tool_call_id": "call_abc123", "name": "get_weather", "content": "22 C, sunny"}],
       "provider": {"name": "plexon", "model": "plexon-1.0"}}'
json
{"success": true, "response": "<final>true</final>Athens: 22 °C, sunny.",
 "usage": {"prompt_tokens": 10864, "completion_tokens": 18, "total_tokens": 10882},
 "service_tier": "premium",
 "metered": {"cost": 0, "cost_microcredits": 25120, "rate_card": "peak",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 19515},
 "...": "..."}

Streamed, the same call arrives as tool_call events instead of tool_calls; “A streamed tool call” above says how to rebuild it.

Condense a conversation. A conversation grows with every turn, and one too long for the model answers 413 context_window_exceeded, here as on every other call. Condense it before that: an answer’s context_window is how many tokens the model can read, and usage.prompt_tokens is how many this call sent. A summarizer call takes the conversation and answers a summary:

bash
curl -s -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"flags": {"mode": "summarizer"},
       "messages": [{"role": "user", "content": "We need a name and a slogan for a bakery that opens in March."},
                    {"role": "assistant", "content": "\"Crumb & Kettle\", with the slogan \"Baked slow, gone fast.\""},
                    {"role": "user", "content": "Good. We agreed to put up the sign on Friday."}],
       "provider": {"name": "plexon", "model": "plexon-1.0"}}'
json
{"success": true,
 "response": "1. Previous Conversation:\n- The user asked for a name and a slogan for a bakery...",
 "usage": {"prompt_tokens": 474, "completion_tokens": 652, "total_tokens": 1126},
 "...": "..."}

The summary is plain text in response. Start the next call’s messages with it as a user message, then the new question. A summarizer call always answers one JSON body, even with "stream": true. It is charged like any turn, but its answer carries no metered block: read the account’s movements for its cost (“Calls with no cost on the answer”).

Search the web. With "web_tools": {"search": true} the model may look things up before it answers, and it decides itself whether a question needs that: a question about the latest release of something gets a search, small talk does not. This call turns on read_urls too, as “What to know about web tools” advises. A streamed call for the latest stable Go release, with the date and the smaller built-in prompt:

bash
curl -s -N -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"flags": {"mode": "ask", "disable_system_prompts": true},
       "system_info": {"date_time": "2026-11-29"},
       "web_tools": {"search": true, "read_urls": true},
       "messages": [{"role": "user", "content": "What is the latest stable release of Go? Name your source."}],
       "provider": {"name": "plexon", "model": "plexon-1.0"}, "stream": true}'

The events of one answer, cut down. Shown: the first of its three web_tool events, its sources event with two of its fifteen sources, its first content piece, its last usage event and its metered event. Left out: the first usage event, the other two web_tool events, the other content events, the four citation events and service_tier:

data:{"type":"web_tool","content":"","tool_id":"","name":"","args":"","error":"","is_done":false,"web_tool":{"tool":"web_search","action":"search","query":"Go latest stable release 2026"}}
data:{"type":"sources","content":"","tool_id":"","name":"","args":"","error":"","is_done":false,"sources":[{"title":"Release History","url":"https://go.dev/doc/devel/release?data=us","site_name":"The Go Programming Language","snippet":"Go 1.21.0 is a major release of Go. ... go1.20 (released 2023-02-01)¶ Go 1.20 is a major release of Go. ... go1.20.8 (released 2023-09-06)"},{"title":"format - Versions in this module Expand all Collapse all go1 go1.27.4 Nov 10, 2026 go1.27.3 Oct 20, 2026 go1.27.2 Oct 8, 2026 go1.27.1 Se...","url":"https://pkg.go.dev/internal/trace/traceviewer/format@go1.22.0?tab=versions#1","site_name":"Go Packages","snippet":"2025 go1.25.14 Aug 19, 2026 go1.25.13 Aug 13, 2026 go1.25.12 Jul 7 ... 2025 go1.25.4 Nov 5..."}]}
data:{"type":"content","content":"The","tool_id":"","name":"","args":"","error":"","is_done":false}
...
data:{"type":"usage","content":"","tool_id":"","name":"","args":"","error":"","is_done":false,"usage":{"prompt_tokens":15521,"completion_tokens":272,"total_tokens":15793,"prompt_tokens_details":{"cached_tokens":8192},"web_search_requests":1},"web":{"searches":1,"pages":0,"served":true}}
data:{"type":"metered","content":"","tool_id":"","name":"","args":"","error":"","is_done":false,"metered":{"...":"..."}}
data:[DONE]

This turn answered in 6.4 seconds and cost 0.21 credits (205,920 microcredits). It sent 15,521 prompt tokens, 8,192 of them from cache, and 272 completion tokens. metered is the block the other streamed samples show. The answer drew on fifteen sources and carried four citations. The model usually cites what it found, though not on every answer. A citation event follows the text of the reply it supports, and its cited_text can span several content events. Here the first citation came after the fourth content piece and quotes all four:

data:{"type":"content","content":" newest stable Go release, dated Nov 10, 2026 ","tool_id":"","name":"","args":"","error":"","is_done":false}
data:{"type":"citation","content":"","tool_id":"","name":"","args":"","error":"","is_done":false,"citation":{"url":"https://pkg.go.dev/internal/trace/traceviewer/format@go1.22.0?tab=versions#1","title":"format - Versions in this module Expand all Collapse all go1 go1.27.4 Nov 10, 2026 go1.27.3 Oct 20, 2026 go1.27.2 Oct 8, 2026 go1.27.1 Se...","cited_text":"The latest stable release of Go is **Go 1.27.4**, released on **November 10, 2026**.\n\nSource: the Go module version listings on **pkg.go.dev**, which show `go1.27.4` as the newest stable Go release, dated Nov 10, 2026"}}

Read a link. With "web_tools": {"read_urls": true} the model may read a link in the last user message. This call turns on search too:

bash
curl -s -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"flags": {"mode": "ask", "disable_system_prompts": true},
       "web_tools": {"search": true, "read_urls": true},
       "messages": [{"role": "user", "content": "Read https://go.dev/VERSION?m=text and tell me exactly what that page says."}],
       "provider": {"name": "plexon", "model": "plexon-1.0"}}'
json
{"success": true, "response": "...",
 "sources": [{"url": "https://go.dev/VERSION?m=text"}],
 "web": {"searches": 0, "pages": 1, "served": true},
 "usage": {"prompt_tokens": 8660, "web_fetch_requests": 1, "...": "..."},
 "...": "..."}

The reply is left out here: it quotes the page, which changes with every Go release. This call answered in 1.4 seconds and cost 0.04 credits, with 7,424 of its 8,660 prompt tokens from cache. Sent again, it cost 0.02 credits, with 8,320 from cache. A page read from a link is a source with a url, and a title when the page has one. A link that cannot be read is not an error of the call: the model says it could not read it, and web.pages still counts the attempt.

What to know about web tools.

These chat samples were run at different times, so pool does not run in order from one to the next.

The answer.

Field Type Meaning
success boolean true
response string the reply; strip a leading <final>true</final>
reasoning string the model’s reasoning, when it shows one
tool_calls array calls of your tools: id, type (function), function.name, function.arguments (a JSON string)
usage object prompt_tokens, completion_tokens, total_tokens, and prompt_tokens_details.cached_tokens when part of the prompt came from cache. With web tools also usage.web_search_requests, the searches made, and usage.web_fetch_requests, the pages read from a link or opened by a deep search, each only when it is above zero. A deep search that opened two pages counts 2 there with no link read
sources array with web tools: the pages the answer could draw on, each address once, first seen first. Each has a url, a title when there is one, and for a search result site_name and snippet
citations array with web tools: the parts of the reply a page supports, each with url, title and cited_text
web object with web tools: searches, pages, and served, false when the model that answered runs no web tools. A call that did not ask carries no web, sources or citations
metered object the charge, as under “Your first call”; absent when nothing was charged
reasoning_items array opaque, optional; when you keep them, send them back on the assistant message
context_window integer how many tokens the model can read at once; compare usage.prompt_tokens with it to know when to condense

The answer also carries pricing_model, context_limit, tools_tokens, prompt_blocks_tokens and service_tier. They belong to the Plexon app: ignore them.

What a turn costs. A turn is charged by its tokens, in and out, on the price list rate_card names, and tokens served from cache cost less. In the samples above a first call cost 0.43 credits and later ones 0.02 to 0.19 credits. While a turn runs it holds at least 7 credits (“How calls are charged and limited”).

Refusals.

A picture: POST /api/v1/image

One picture, from words or from up to six reference pictures. The answer is always a stream of two events: image_start, then image_done, which carries the picture. A stream that ends without image_done made no picture.

X-Plexon-Group and X-Plexon-Customer apply here. Both are optional tags on the call: the group picks the marketplaces it is served under, and the customer is your own label for whom it is made, kept on the call’s row. Neither replaces X-Plexon-Handle, the account that makes the call (Groups and customers).

Field Type Required Values Default Notes
prompt string yes 1 to 32,000 characters none what the picture shows, or what to change about the reference pictures
aspect_ratio string no 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9 the model’s choice another value answers 400
resolution string no 1K, 2K 1K any other value becomes 1K
reference_images array of strings no 0 to 6 data URIs: data:image/jpeg;base64,..., data:image/png;base64,... or data:image/webp;base64,...; 10 MB each, 40 MB together none a link answers 400: send the file’s bytes. Each file must really be the format its URI names

From words. The smallest call:

bash
curl -s -N -X POST "$PLEXON/api/v1/image" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"prompt": "A lighthouse on a cliff at dawn, watercolour"}'
data:{"type":"image_start","service_tier":"premium","resolution":"1K"}
data:{"type":"image_done","url":"https://...","revised_prompt":"This is a beautifully detailed watercolour painting of a lighthouse on a rugged cliff at d...","size":"880x1184","metered":{"cost":3,"cost_microcredits":3447200,"rate_card":"flat","included_used":0,"included_limit":0,"purchased":0,"pool":19996}}
data:[DONE]

From reference pictures. lighthouse.jpg as the reference, wide and at 2K:

bash
{ printf '{"prompt": "The same lighthouse at night, its lamp lit", "aspect_ratio": "16:9", "resolution": "2K", "reference_images": ["data:image/jpeg;base64,'; base64 < lighthouse.jpg | tr -d '\n'; printf '"]}'; } > body.json
curl -s -N -X POST "$PLEXON/api/v1/image" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" -d @body.json
data:{"type":"image_start","service_tier":"premium","resolution":"2K","aspect_ratio":"16:9","references":1}
data:{"type":"image_done","url":"https://...","revised_prompt":"The white cylindrical lighthouse with a red dome and gallery railing in ...","size":"2720x1536","metered":{"cost":5,"cost_microcredits":4533440,"rate_card":"flat","included_used":0,"included_limit":0,"purchased":0,"pool":19468}}
data:[DONE]
type Fields
image_start resolution and aspect_ratio as the model took them, references: how many reference pictures it was given. service_tier is the Plexon app’s
image_done url: the picture; revised_prompt: the prompt as the model rewrote it, when it did; size in pixels; notice, when the prompt was handled differently from how it was sent (cut short, for one); metered: the charge
error the failure (“Streaming”)

Keep your own copy. url is a temporary https link to a PNG, on a host outside Plexon, and Plexon keeps no copy. This page cannot promise how long the link lasts: download the picture as soon as image_done arrives and store it yourself.

What a picture costs. It is priced before it is made, by its size and its references, and the whole price must be covered. In the samples: 3.45 credits from words, 4.53 credits at 2K from one reference.

Refusals. Before the stream, as an HTTP status:

Inside the stream, a failure is an error event; its kind values are under “Streaming”.

A clip: POST /api/v1/video

A video clip of 4 to 15 seconds, from words, an opening and a closing frame, or reference pictures, clips and sound. The answer is a stream: video_start, a video_progress event every 10 seconds while the clip is made, then video_done. The samples took one to four minutes.

X-Plexon-Group and X-Plexon-Customer apply here. Both are optional tags on the call: the group picks the marketplaces it is served under, and the customer is your own label for whom it is made, kept on the call’s row. Neither replaces X-Plexon-Handle, the account that makes the call (Groups and customers).

Field Type Required Values Default Notes
prompt string yes, unless first_frame 1 to 7,000 characters none not needed when first_frame is sent. A camera move goes in square brackets inside it, such as [Push in]
duration integer no 4 to 15 seconds 6 a value outside moves to the nearer end: 2 makes 4. 0 or less makes 6
resolution string no 768P, 2K 768P any other value becomes 768P
aspect_ratio string no 21:9, 16:9, 4:3, 1:1, 3:4, 9:16, adaptive 16:9, or adaptive when a frame or a reference is sent another value answers 400
first_frame string no an https link or a data URI, up to 20 MB none the clip’s opening picture
last_frame string no an https link or a data URI, up to 20 MB none the clip’s closing picture, sent beside first_frame
reference_images array of strings no up to 9 https links or data URIs, 20 MB each none pictures of the subject
reference_videos array of strings no up to 3 data URIs of MP4 or MOV clips, 20 MB each, 15 seconds together none type them data:video/mp4;base64,... or data:video/quicktime;base64,...; the server reads each clip’s length from the file itself. A link answers 400. Every second of them is charged
reference_audio array of strings no up to 3 https links or data URIs, 20 MB each none an MP3 may be typed audio/mpeg or audio/mp3; both are accepted

All the frames and references of one request are capped at 96 MB together; past that the body is refused with 400 validation_error, invalid request body.

From words. The smallest call:

bash
curl -s -N -X POST "$PLEXON/api/v1/video" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"prompt": "A paper boat drifting across a still pond, morning light"}'
data:{"type":"video_start","service_tier":"premium","duration":6,"resolution":"768P","aspect_ratio":"16:9"}
data:{"type":"video_progress","status":"Queued"}
data:{"type":"video_progress","status":"Processing","elapsed_ms":10000}
...
data:{"type":"video_done","url":"https://...","metered":{"cost":77,"cost_microcredits":76800000,"rate_card":"flat","included_used":0,"included_limit":0,"purchased":0,"pool":19890}}
data:[DONE]

With a first frame. lighthouse.jpg opens a four-second clip. Add last_frame the same way for the closing picture:

bash
{ printf '{"prompt": "The lamp starts to turn", "duration": 4, "first_frame": "data:image/jpeg;base64,'; base64 < lighthouse.jpg | tr -d '\n'; printf '"}'; } > body.json
curl -s -N -X POST "$PLEXON/api/v1/video" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" -d @body.json
data:{"type":"video_start","service_tier":"premium","duration":4,"resolution":"768P","aspect_ratio":"adaptive"}
data:{"type":"video_progress","status":"Queued"}
data:{"type":"video_progress","status":"Processing","elapsed_ms":10000}
...
data:{"type":"video_done","url":"https://...","metered":{"cost":51,"cost_microcredits":51200000,"rate_card":"flat","included_used":0,"included_limit":0,"purchased":0,"pool":19393}}
data:[DONE]

With references. A picture of the subject and a recording for the sound:

bash
{ printf '{"prompt": "The lighthouse in the picture at dusk, waves below", "duration": 4, "reference_images": ["data:image/jpeg;base64,'; base64 < lighthouse.jpg | tr -d '\n'; printf '"], "reference_audio": ["data:audio/mp3;base64,'; base64 < order.mp3 | tr -d '\n'; printf '"]}'; } > body.json
curl -s -N -X POST "$PLEXON/api/v1/video" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" -d @body.json
data:{"type":"video_start","service_tier":"premium","duration":4,"resolution":"768P","aspect_ratio":"adaptive"}
data:{"type":"video_progress","status":"Queued"}
data:{"type":"video_progress","status":"Processing","elapsed_ms":10000}
...
data:{"type":"video_done","url":"https://...","metered":{"cost":51,"cost_microcredits":51200000,"rate_card":"flat","included_used":0,"included_limit":0,"purchased":0,"pool":19341}}
data:[DONE]
type Fields
video_start duration, resolution and aspect_ratio as the clip will be made, after any value was moved into range. service_tier is the Plexon app’s. on_credits (boolean, sent only when true): this clip is paid from your credits. From this event on it is made and charged even if you disconnect, so keep reading until the clip is done
video_progress status: Queued, then Processing; elapsed_ms from the second one on
video_done url: the clip; cover_url: a still of it, when the model returns one (none came back when these samples were run); metered: the charge
error the failure (“Streaming”)

Keep your own copy. url is a temporary https link to an MP4, on a host outside Plexon, and Plexon keeps no copy. This page cannot promise how long the link lasts: download the clip as soon as video_done arrives and store it yourself.

What a clip costs. It is priced before it is made, by its seconds and its resolution, and the whole price must be covered. Each second of a reference clip adds to the price, and so does each picture past the first five (the frames count as pictures). In the samples: 76.8 credits for six seconds at 768P, and 51.2 for four seconds, with a first frame or with a picture and audio alike.

Refusals. Before the stream, as an HTTP status:

Inside the stream, a failure is an error event; its kind values are under “Streaming”. A clip the model itself refuses arrives as an error event with no kind, and is not charged.

A song: POST /api/v1/music

A whole song from a style and lyrics, an instrumental, or a cover of a recording. The answer is a stream: music_start, the audio in music_audio slices, then music_done. A song takes about as long to make as it plays.

X-Plexon-Group and X-Plexon-Customer apply here. Both are optional tags on the call: the group picks the marketplaces it is served under, and the customer is your own label for whom it is made, kept on the call’s row. Neither replaces X-Plexon-Handle, the account that makes the call (Groups and customers).

Field Type Required Values Default Notes
style string one of the two up to 2,000 characters none not needed when lyrics is sent, except for an instrumental
lyrics string one of the two up to 3,500 characters, with \n line breaks and [verse], [chorus], [bridge] tags none left out of a song with vocals, the model writes lyrics from style
instrumental boolean no true, false false no vocals; needs style; not with a reference
reference_url string no an https link to a recording none makes a cover. The model fetches the link itself. Not with reference_base64
reference_base64 string no a recording as plain base64, never a data: URI; up to 20 MB none makes a cover
use_my_voice boolean no true, false false sings the lyrics in the account’s cloned voice, and needs lyrics. A key cannot clone a voice, so only an account that cloned one in the Plexon app has one; an account made through this API has no sign-in, so in practice it has none. With no lyrics it answers 400 validation_error, with no cloned voice 400 voice_unavailable
audio.format string no mp3, wav mp3 any other value becomes mp3
audio.sample_rate integer no 16000, 24000, 32000, 44100 44100 another number moves to the nearest
audio.bitrate integer no 32000, 64000, 128000, 256000 256000 another number moves to the nearest

A cover needs a recording of 6 seconds to 6 minutes with singing in it, plus style or lyrics, and is never instrumental.

With lyrics, as a wav at 24 kHz:

bash
curl -s -N -X POST "$PLEXON/api/v1/music" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"style": "warm folk, acoustic guitar, female vocal",
       "lyrics": "[verse]\nThe lamp turns slow above the bay\nIt shows the boats the way\n[chorus]\nCome home, come home tonight",
       "audio": {"format": "wav", "sample_rate": 24000, "bitrate": 64000}}'
data:{"type":"music_start","format":"wav","service_tier":"premium"}
data:{"type":"music_audio","seq":1,"audio_base64":"UklGRv////9XQVZFZm10..."}
data:{"type":"music_audio","seq":2,"audio_base64":"KPe+BGf2qgO59bYCJfXQ..."}
...
data:{"type":"music_done","format":"wav","duration_ms":102643,"sample_rate":24000,"bitrate":64000,"channels":2,"size_bytes":9853886,"metered":{"cost":24,"cost_microcredits":24000000,"rate_card":"flat","included_used":0,"included_limit":0,"purchased":0,"pool":19707}}
data:[DONE]

An instrumental:

bash
curl -s -N -X POST "$PLEXON/api/v1/music" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"style": "calm solo piano, slow, warm", "instrumental": true}'
data:{"type":"music_start","format":"mp3","service_tier":"premium"}
data:{"type":"music_audio","seq":1,"audio_base64":"SUQzBAAAAAAAI1RTU0UA..."}
data:{"type":"music_audio","seq":2,"audio_base64":"//vSRPaEBnNpS5O6YvDT..."}
...
data:{"type":"music_done","format":"mp3","duration_ms":197984,"sample_rate":44100,"bitrate":256000,"channels":2,"size_bytes":6337977,"metered":{"cost":24,"cost_microcredits":24000000,"rate_card":"flat","included_used":0,"included_limit":0,"purchased":0,"pool":19967}}
data:[DONE]

A cover of song.mp3, sent as plain base64:

bash
{ printf '{"style": "slow acoustic guitar, soft female vocal", "reference_base64": "'; base64 < song.mp3 | tr -d '\n'; printf '"}'; } > body.json
curl -s -N -X POST "$PLEXON/api/v1/music" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" -d @body.json
data:{"type":"music_start","format":"mp3","cover":true,"service_tier":"premium"}
data:{"type":"music_audio","seq":1,"audio_base64":"SUQzBAAAAAAAI1RTU0UA..."}
data:{"type":"music_audio","seq":2,"audio_base64":"//vSROuAFldl1vtPZMDH..."}
...
data:{"type":"music_done","format":"mp3","duration_ms":23556,"sample_rate":44100,"bitrate":256000,"channels":2,"size_bytes":755714,"metered":{"cost":24,"cost_microcredits":24000000,"rate_card":"flat","included_used":0,"included_limit":0,"purchased":0,"pool":19444}}
data:[DONE]
type Fields
music_start format; cover: true for a cover, absent otherwise. service_tier is the Plexon app’s
music_audio seq, from 1, and audio_base64: the next slice of the file. Base64-decode each slice and join the bytes in seq order: the result is one mp3 or wav file
music_done format, duration_ms, sample_rate, bitrate, channels, size_bytes, and metered: the charge
error the failure (“Streaming”)

A streamed wav. The header in the first slice is written before the song’s length is known, so its size fields hold a placeholder (the first slice of the lyrics sample shows it: UklGRv////9...). After music_done, rewrite the two size fields from size_bytes, or ask for mp3, which plays as it is.

What a song costs. One price per track, whatever its length, cover included; metered on music_done carries it. Each song above cost 24 credits. It is priced before it is made and held while it runs. A stream cut after audio went out is charged in full, and its music_done never arrives.

Refusals. Before the stream, as an HTTP status:

A recording the model will not cover (no singing in it, or longer than six minutes) arrives inside the stream as an error event with no kind, before any audio, and is not charged. A song’s stream carries no kind on any failure (“Streaming”).

Speech: POST /api/v1/tts

Text read aloud, as one JSON body with the whole file, or streamed with "stream": true. The language is detected from the text.

X-Plexon-Group and X-Plexon-Customer apply here. Both are optional tags on the call: the group picks the marketplaces it is served under, and the customer is your own label for whom it is made, kept on the call’s row. Neither replaces X-Plexon-Handle, the account that makes the call (Groups and customers).

Field Type Required Values Default Notes
text string yes 1 to 5,000 characters none a Chinese, Japanese or Korean character counts as two in the price
voice string no an id from the voices route, such as athena, iris, thalia, calliope, atlas, orion, apollo athena “The voices” answers the whole list. An account that cloned a voice in the Plexon app may use its id too; a key cannot clone one, so an account made through this API has none
speed number no 0.5 to 2 1 a value outside moves to the nearer end
pitch integer no -12 to 12 0 a value outside moves to the nearer end; a fraction answers 400
emotion string no happy, sad, angry, fearful, disgusted, surprised, calm, fluent, whisper none another value is ignored
format string no mp3, wav, pcm, flac mp3 another value answers 400. Mono at 32 kHz. pcm is raw samples with no header (“Streamed” below)
quality string no standard, hd standard hd is the high-fidelity voice, which costs more; any other value reads as standard
stream boolean no true, false false server-sent events instead of one JSON body

The smallest call, the standard voice as mp3:

bash
curl -s -X POST "$PLEXON/api/v1/tts" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"text": "Your order has shipped. It should arrive on Thursday."}'
json
{"success": true, "voice": "athena", "format": "mp3",
 "audio_base64": "SUQzBAAAAAAIalRYWFgA...",
 "characters": 53, "service_tier": "premium",
 "metered": {"cost": 1, "cost_microcredits": 508800, "rate_card": "flat",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 19991}}

High fidelity, as wav, in another voice:

bash
curl -s -X POST "$PLEXON/api/v1/tts" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"text": "Welcome to Acme Bakery.", "quality": "hd", "format": "wav", "voice": "atlas"}'
json
{"success": true, "voice": "atlas", "format": "wav",
 "audio_base64": "UklGRqK5AwBXQVZFZm10...",
 "characters": 23, "service_tier": "premium",
 "metered": {"cost": 0, "cost_microcredits": 368000, "rate_card": "flat",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 19515}}

Speed, pitch and emotion, as flac:

bash
curl -s -X POST "$PLEXON/api/v1/tts" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"text": "Hi", "format": "flac", "speed": 1.25, "pitch": -2, "emotion": "happy"}'
json
{"success": true, "voice": "athena", "format": "flac",
 "audio_base64": "ZkxhQwAAACIJAAkAAAAA...",
 "characters": 2, "service_tier": "premium",
 "metered": {"cost": 0, "cost_microcredits": 19200, "rate_card": "flat",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 19515}}

Streamed, as raw pcm you can play while it arrives:

bash
curl -s -N -X POST "$PLEXON/api/v1/tts" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -d '{"text": "Hello from Plexon.", "stream": true, "format": "pcm"}'
data:{"type":"tts_start","voice":"athena","format":"pcm","sample_rate":32000,"channels":1,"service_tier":"premium"}
data:{"type":"tts_audio","seq":1,"audio_base64":"AAAAAAAAAAAAAAAAAAAA..."}
data:{"type":"tts_audio","seq":2,"audio_base64":"Ru7E7JTsP+xG7F/tv+3p..."}
...
data:{"type":"tts_usage","characters":18,"metered":{"cost":0,"cost_microcredits":172800,"rate_card":"flat","included_used":0,"included_limit":0,"purchased":0,"pool":19515}}
data:[DONE]
Field or type Meaning
success true
voice, format the voice and the format the speech was made in
audio_base64 the whole file, base64
characters the characters counted for the charge
metered the charge
tts_start the stream’s first event: voice, format, sample_rate (32000), channels (1). service_tier is the Plexon app’s
tts_audio seq, from 1, and audio_base64: the next slice. Base64-decode each slice and join the bytes in seq order. pcm bytes play as they come; mp3, wav and flac play as one file once joined
tts_usage characters and metered, last before data:[DONE]

Playing pcm. The bytes are 16-bit signed samples, little-endian, mono, at the sample_rate of tts_start (32 kHz), with no header. A slice may end in the middle of a sample, so keep a carry of one odd byte between slices.

What speech costs. It is priced by its characters before it is made, and held while it runs; hd costs more per character than standard. In the samples: 0.51 credits for 53 characters, 0.37 credits for 23 characters in hd. A stream that fails after audio went out is charged, and its tts_usage never arrives.

Refusals.

The voices: GET /api/v1/tts/voices

The voices /tts takes, the same eight for every account. It costs nothing, and a handle nobody has used answers 404 account_not_found.

X-Plexon-Group and X-Plexon-Customer apply here. Both are optional tags on the call: the group picks the marketplaces it is served under, and the customer is your own label for whom it is made, kept on the call’s row. Neither replaces X-Plexon-Handle, the account that makes the call (Groups and customers).

bash
curl -s "$PLEXON/api/v1/tts/voices" -H "Authorization: Bearer $COMPANY_KEY" -H "X-Plexon-Handle: cust-4821"
json
{"voices": [
  {"id": "athena", "name": "Athena", "gender": "female", "style": "Warm and wise", "default": true},
  {"id": "iris", "name": "Iris", "gender": "female", "style": "Calm and clear"},
  {"id": "thalia", "name": "Thalia", "gender": "female", "style": "Bright and lively"},
  {"id": "calliope", "name": "Calliope", "gender": "female", "style": "Friendly narrator"},
  {"id": "atlas", "name": "Atlas", "gender": "male", "style": "Deep and steady"}]}

The first five of the eight are shown; the other three have the same shape. id is what voice takes. default marks the voice used when voice is left out. The list is the same for every account, so read it once with any handle that has made a call, and keep it. The one exception: an account that cloned a voice in the Plexon app also lists it, with cloned true and no gender or style. A key cannot clone a voice (403 access_key_scope), so an account made through this API has none.

Speech to text: POST /api/v1/transcribe

A recording turned into text. The body is multipart form data, not JSON, and the answer is one JSON body.

X-Plexon-Group and X-Plexon-Customer apply here. Both are optional tags on the call: the group picks the marketplaces it is served under, and the customer is your own label for whom it is made, kept on the call’s row. Neither replaces X-Plexon-Handle, the account that makes the call (Groups and customers).

Field Type Required Values Default Notes
file file yes a recording whose name ends in .wav, .mp3, .m4a, .flac, .ogg, .oga, .opus, .aac, .aiff or .aif; 1 byte to 32 MB none the type is read from the extension, so the name needs one. The model takes recordings up to about eight minutes
language string no zh, yue, en, ja, ko, th, vi, id, ms, fil, ar, tr, fr, de, es, it, pt, pl, ru, uk none a hint. Any other code, Greek el included, is sent as no hint, and the answer’s language is then empty. Such a recording is still transcribed (a Greek one was, when these samples were run)
bash
curl -s -X POST "$PLEXON/api/v1/transcribe" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -F "file=@order.mp3" -F "language=en"
json
{"success": true, "text": "Your order has shipped. It should arrive on Thursday.",
 "duration_seconds": 4.8, "language": "en",
 "metered": {"cost": 0, "cost_microcredits": 81440, "rate_card": "flat",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 19441}}
Field Type Meaning
success boolean true
text string the transcript; empty for a silent recording, which is not an error
duration_seconds number the recording’s length as measured
language string the hint that was sent, empty when none; never a detected language
metered object the charge

The answer also carries service_tier, the Plexon app’s.

What a transcription costs. It is priced after it is made, by the length measured: 0.08 credits for 4.8 seconds in the sample. While it runs it holds 7 credits.

Refusals.

The balance: GET /api/v1/balance

What the account can spend, read live: it shows a top-up the moment the call that made it returns. It costs nothing, and a handle nobody has used answers 404 account_not_found.

X-Plexon-Group and X-Plexon-Customer apply here. Both are optional tags on the call: the group picks the marketplaces it is served under, and the customer is your own label for whom it is made, kept on the call’s row. Neither replaces X-Plexon-Handle, the account that makes the call (Groups and customers).

bash
curl -s "$PLEXON/api/v1/balance" -H "Authorization: Bearer $COMPANY_KEY" -H "X-Plexon-Handle: cust-4821"
json
{"plan": "payg",
 "purchased": {"credits": 0, "usd": 0, "uc": 0},
 "pool": {"credits": 19996, "usd": 199.96, "uc": 19996127520},
 "available": {"credits": 19996, "usd": 199.96, "uc": 19996127520},
 "hd_voice": true, "unmetered": true}
In the answer Meaning
plan payg
purchased the account’s own credits, an amount object; can be negative after the last call overdrew it
pool your company’s pool, an amount object
available what the next call is checked against: own credits as they stand (below zero included) plus the pool, shown as 0 when that sum is below zero
hd_voice true whenever the account can spend
unmetered true while own credits plus the pool are above 100 credits

No route on this page depends on a balance above 100 credits (unmetered). An amount object is described under “Money”.

Tools Plexon runs: POST /api/v1/mcp

Some tools run on Plexon’s side, and your server calls them on this route. The first is plexon_nutrition: calories, protein, carbs, fat and fibre for the foods on a plate, from USDA food tables Plexon serves. The model still decides when to call it, and your server still runs the loop: it lists the tools here, passes them to a chat call in mcp_tools, forwards the model’s call to this route, and sends the result back to the model in a tool message.

The route speaks MCP (Model Context Protocol) over HTTP, revision 2026-07-28: one JSON-RPC message per POST, answered as one JSON body. There is no session and no initialize step. A company key sends X-Plexon-Handle here as on every other route, and a user key works here too.

X-Plexon-Group and X-Plexon-Customer are checked here as on any route (400 invalid_customer, 404 group_not_found), but a lookup is recorded nowhere and its result does not depend on them. They count on the chat calls, where the charge is kept (Groups and customers).

Field Type Required Values Default Notes
jsonrpc string yes 2.0 none the JSON-RPC version
id number or string yes any id of yours none comes back on the answer
method string yes tools/list, tools/call none the Mcp-Method header repeats it
params object yes _meta, and for tools/call the tool’s name and its arguments none _meta carries io.modelcontextprotocol/protocolVersion, which is 2026-07-28 and which the MCP-Protocol-Version header repeats, and io.modelcontextprotocol/clientCapabilities, where {} will do. On tools/call the Mcp-Name header repeats name

The headers. Beside the key and the handle, a tools/call carries three MCP headers. For the nutrition tool:

MCP-Protocol-Version: 2026-07-28
Mcp-Method: tools/call
Mcp-Name: plexon_nutrition

tools/list sends the first two, with no Mcp-Name. A header that is missing or does not match the body answers 400 with a JSON-RPC error of code -32020, and no tool runs. Send Content-Type: application/json. With no Content-Type at all JSON is assumed, but any other type is refused, and curl’s -d sends one unless you set the header. Accept makes no difference: the route never streams. A plain HTTP client is enough.

The samples below are one worked example, in order: the list, a chat call with a photo, two lookups, and the chat call that answers. plate.jpg stands for a photo of a plate of your own. The one these samples ran with shows a bowl of meatballs on orzo with feta, cherry tomatoes, cucumber and olives, and tzatziki on the side.

List the tools.

bash
curl -s -X POST "$PLEXON/api/v1/mcp" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -H "MCP-Protocol-Version: 2026-07-28" -H "Mcp-Method: tools/list" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list",
       "params": {"_meta": {"io.modelcontextprotocol/protocolVersion": "2026-07-28", "io.modelcontextprotocol/clientCapabilities": {}}}}'
json
{"jsonrpc": "2.0", "id": 1,
 "result": {"ttlMs": 3600000, "cacheScope": "public",
            "tools": [{"name": "plexon_nutrition",
                       "description": "Calories, protein, carbs, fat and fibre for foods by weight, from the USDA food tables served by Plexon. Returns each item and the plate total.\n\nFor a meal photo: look at the picture, list every item you can see ...",
                       "inputSchema": {"type": "object", "...": "..."},
                       "outputSchema": {"type": "object", "...": "..."}}],
            "...": "..."}}

Here "...": "..." stands for what the sample cuts; the chat samples below carry the tool in full. outputSchema describes the lookup’s structuredContent; mcp_tools does not need it. ttlMs is how long you may keep the list, one hour. Keep it for that hour and list again when it runs out, not before every call. The list is the same for every key and handle (cacheScope public), so list under a handle you already use, never an invented one: a POST here with a new handle makes an account.

A chat call with the photo and the tool. The tool goes into mcp_tools as tools/list answered it: its name, description and inputSchema, unchanged. tool_choice makes the model call it, as in the weather sample. Send it on the first turn only: a loop that keeps it forces a call, and a charged turn, every time. Without it the model calls the tool when the question needs it, and an answer with no tool_calls is the reply:

bash
{ printf '%s' '{"flags": {"mode": "ask"},
  "mcp_tools": [{"name": "plexon_nutrition",
                 "description": "Calories, protein, carbs, fat and fibre for foods by weight, from the USDA food tables served by Plexon. Returns each item and the plate total.\n\nFor a meal photo: look at the picture, list every item you can see with your best weight in grams, and call this once with all of them. Name foods in English with the cooking method, and add what a photo hides but the dish contains, such as cooking oil or dressing. Set grams_source to weighed or label when the user gave the weight; a weight they gave replaces your estimate.\n\nExpect two calls for a plate. The table answers only when a name means one food; a name that covers several (rice, bacon, grilled chicken breast with or without skin) comes back under unmatched with candidates. Choose the candidate that fits what you see and send the whole plate again with its food_id, or give a more exact name, or per_100g values (all four of kcal, protein_g, carbs_g, fat_g) from a label or another food database. Read each matched name too, and correct any that is not the food you meant. A mixed dish the table does not have works as its ingredients. Give the user the accuracy line with the numbers.",
                 "inputSchema": {"type": "object", "properties": {"items": {"type": "array", "items": {"type": "object", "properties": {"name": {"type": "string", "description": "The food in English with its cooking method, e.g. \"grilled chicken breast\", \"boiled potatoes\", \"feta cheese\"."}, "grams": {"type": "number", "description": "Weight in grams of the part that is eaten."}, "food_id": {"type": "integer", "description": "The food_id of a candidate from an earlier result. Skips name matching."}, "per_100g": {"type": "object", "properties": {"kcal": {"type": "number", "description": "Energy in kcal per 100 g."}, "protein_g": {"type": "number", "description": "Protein in grams per 100 g."}, "carbs_g": {"type": "number", "description": "Carbohydrate in grams per 100 g."}, "fat_g": {"type": "number", "description": "Fat in grams per 100 g."}, "fibre_g": {"type": "number", "description": "Fibre in grams per 100 g. Leave out when the source does not state it."}}, "description": "Composition per 100 g when you already have it from a label, a barcode or another database. Skips the food table.", "required": ["kcal", "protein_g", "carbs_g", "fat_g"], "additionalProperties": false}, "grams_source": {"type": "string", "description": "Where the weight came from: estimated from a photo or a description; weighed by the user; label for a weight printed on the pack.", "default": "estimated", "enum": ["estimated", "weighed", "label"]}}, "required": ["name", "grams"], "additionalProperties": false}, "description": "Every food on the plate, each with its weight."}, "servings": {"type": "number", "description": "How many people share the plate. Adds a per_serving total. Defaults to 1."}}, "required": ["items"], "additionalProperties": false}}],
  "tool_choice": "plexon_nutrition",
  "messages": [{"role": "user", "content": [{"type": "text", "text": "How many calories and how much protein, carbohydrate and fat are on this plate? I will eat all of it."},
                                            {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,'
  base64 < plate.jpg | tr -d '\n'
  printf '%s' '"}}]}],
  "provider": {"name": "plexon", "model": "plexon-1.0"}}'
} > body.json
curl -s -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" -d @body.json
json
{"success": true, "response": "Counting the plate: orzo, five meatballs, feta, the salad, and the tzatziki bowl on the side.",
 "tool_calls": [{"id": "call_abc123", "type": "function",
                 "function": {"name": "plexon_nutrition",
                              "arguments": "{\"items\":[{\"grams\":180,\"grams_source\":\"estimated\",\"name\":\"cooked orzo pasta\"},{\"grams\":150,\"grams_source\":\"estimated\",\"name\":\"pan-fried beef and lamb meatballs\"},..."}}],
 "usage": {"prompt_tokens": 11795, "completion_tokens": 308, "total_tokens": 12103},
 "service_tier": "premium",
 "metered": {"cost": 0, "cost_microcredits": 312640, "rate_card": "off_peak",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 1999},
 "...": "..."}

The model named eight foods with a weight for each, the olive oil the photo cannot show among them, as the tool’s description asks.

The first lookup. Forward the call: params.name is the call’s function.name, and params.arguments is its function.arguments, parsed. The sample sends a fixed plate of eight foods, close to the list the model made when these samples were run, so its answer stays the same from run to run:

bash
curl -s -X POST "$PLEXON/api/v1/mcp" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -H "MCP-Protocol-Version: 2026-07-28" -H "Mcp-Method: tools/call" -H "Mcp-Name: plexon_nutrition" \
  -d '{"jsonrpc": "2.0", "id": 2, "method": "tools/call",
       "params": {"name": "plexon_nutrition",
                  "arguments": {"items": [{"name": "meatballs", "grams": 160},
                                            {"name": "cooked pasta", "grams": 150},
                                            {"name": "feta cheese", "grams": 40},
                                            {"name": "tomatoes", "grams": 60},
                                            {"name": "cucumber", "grams": 40},
                                            {"name": "olives", "grams": 20},
                                            {"name": "olive oil", "grams": 10},
                                            {"name": "tzatziki", "grams": 60}]},
                  "_meta": {"io.modelcontextprotocol/protocolVersion": "2026-07-28", "io.modelcontextprotocol/clientCapabilities": {}}}}'
json
{"jsonrpc": "2.0", "id": 2,
 "result": {"content": [{"type": "text", "text": "{\"items\":[{\"name\":\"cooked pasta\",\"matched\":\"Pasta, cooked\",\"food_id\":2..."}],
            "structuredContent": {
              "items": [{"name": "cooked pasta", "matched": "Pasta, cooked", "food_id": 2708357, "dataset": "fndds",
                         "grams": 150, "grams_source": "estimated", "kcal_per_100g": 157,
                         "amount": {"kcal": 235.5, "protein_g": 8.6, "carbs_g": 46.1, "fat_g": 1.4, "fibre_g": 2.7}}],
              "unmatched": [{"name": "meatballs", "grams": 160,
                             "reason": "The table will not choose for this name: the foods below differ, or none is plainly it. Send it again with one food_id, or name it more exactly (the cut, the cooking method).",
                             "candidates": [{"food_id": 2707472, "name": "Meatball, meatless", "dataset": "fndds", "kcal_per_100g": 197},
                                            {"food_id": 169067, "name": "Meatballs, meatless", "dataset": "sr", "kcal_per_100g": 197},
                                            {"food_id": 2706395, "name": "Meatballs, Puerto Rican style", "dataset": "fndds", "kcal_per_100g": 225},
                                            {"food_id": 171638, "name": "Meatballs, frozen, Italian style", "dataset": "sr", "kcal_per_100g": 286},
                                            {"food_id": 2706467, "name": "Meatballs, NS as to type of meat, with sauce", "dataset": "fndds", "kcal_per_100g": 186}]}],
              "totals": {"kcal": 530.9, "protein_g": 20.6, "carbs_g": 55.6, "fat_g": 25.1, "fibre_g": 4.1},
              "totals_note": "Totals leave out 1 item: meatballs.",
              "accuracy": "Estimate. Weights read from a photo are typically 35 to 50% off on calories. A weighed portion, a barcode or a reference object in the shot tightens it.",
              "source": "USDA FoodData Central: Foundation Foods 2026-10-29, FNDDS 2024-10-31, SR Legacy 2019-04-01."},
            "...": "..."}}

Seven of the eight foods resolved: items shows the first, and the other six have the same shape. meatballs covers several foods, so it comes back under unmatched with candidates, the pick list, and stays out of totals until one is chosen (totals_note says so). A name with no close match comes back the same way, with the nearest foods or none.

content[0].text is structuredContent written out as JSON text, and it is what your server sends back to the model: a tool message whose tool_call_id is the call’s id, as under “Your own tool”. The model reads the pick list, chooses, and calls the tool again. That chat turn has the shape of the last sample below, so the example goes straight to the lookup it asks for. Your server or your user may also pick a candidate and send the lookup itself with its food_id, which saves a chat turn. The tool expects two calls for a plate: stop the loop after a small number of your choosing, such as four, and answer from the last result.

The second lookup. The model’s next call sends the whole plate again, with the food_id it chose for the meatballs:

bash
curl -s -X POST "$PLEXON/api/v1/mcp" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" \
  -H "MCP-Protocol-Version: 2026-07-28" -H "Mcp-Method: tools/call" -H "Mcp-Name: plexon_nutrition" \
  -d '{"jsonrpc": "2.0", "id": 3, "method": "tools/call",
       "params": {"name": "plexon_nutrition",
                  "arguments": {"items": [{"name": "meatballs", "grams": 160, "food_id": 171638},
                                            {"name": "cooked pasta", "grams": 150},
                                            {"name": "feta cheese", "grams": 40},
                                            {"name": "tomatoes", "grams": 60},
                                            {"name": "cucumber", "grams": 40},
                                            {"name": "olives", "grams": 20},
                                            {"name": "olive oil", "grams": 10},
                                            {"name": "tzatziki", "grams": 60}]},
                  "_meta": {"io.modelcontextprotocol/protocolVersion": "2026-07-28", "io.modelcontextprotocol/clientCapabilities": {}}}}'
json
{"jsonrpc": "2.0", "id": 3,
 "result": {"content": [{"type": "text", "text": "{\"items\":[{\"name\":\"meatballs\",\"matched\":\"Meatballs, frozen, Italian st..."}],
            "structuredContent": {
              "items": [{"name": "meatballs", "matched": "Meatballs, frozen, Italian style", "food_id": 171638, "dataset": "sr",
                         "grams": 160, "grams_source": "estimated", "kcal_per_100g": 286,
                         "amount": {"kcal": 457.6, "protein_g": 23, "carbs_g": 12.9, "fat_g": 35.5, "fibre_g": 3.7}}],
              "totals": {"kcal": 988.5, "protein_g": 43.6, "carbs_g": 68.4, "fat_g": 60.6, "fibre_g": 7.7},
              "accuracy": "Estimate. Weights read from a photo are typically 35 to 50% off on calories. A weighed portion, a barcode or a reference object in the shot tightens it.",
              "source": "USDA FoodData Central: Foundation Foods 2026-10-29, FNDDS 2024-10-31, SR Legacy 2019-04-01."},
            "...": "..."}}

Every food resolved, so totals is the whole plate: 988.5 kcal, 43.6 g protein, 68.4 g carbs and 60.6 g fat. A finished plate has no unmatched. A totals_note may still be there, to say the fibre total leaves out a food the table has no fibre value for. The numbers to show your user are structuredContent.totals of the last lookup, not figures read from the model’s prose. Read matched too. Here the meatballs are the table’s frozen Italian-style row, the nearest one it has, and the model is told to check each matched name against what it meant.

How far to trust the numbers. The weights came from a photo, and accuracy says what that means in the tool’s own words:

Estimate. Weights read from a photo are typically 35 to 50% off on calories. A weighed portion, a barcode or a reference object in the shot tightens it.

The table’s values are sound for the food it matched. The weights are the guess, so the calories of a plate read off a photo can be 35 to 50% away from what was eaten. Have your code print accuracy word for word beside the numbers, because the model may word it differently, as it does below. Do not present the figures as measured. A weight your user gives is sent with grams_source weighed or label, and the line changes with it: it counts how many weights were measured, and when all of them were, it says the weights are the user’s and the values are averages for the matched foods.

The answer. Send the conversation again with the model’s call and the lookup’s text as the tool message. Your loop can keep every message. This sample drops the first lookup and the turn after it to stay short, which works because the second lookup holds the whole plate; its assistant sentence and call_def456 stand for the model’s own. It still holds the photo. tool_choice is left out, so the model answers:

bash
{ printf '%s' '{"flags": {"mode": "ask"},
  "mcp_tools": [{"name": "plexon_nutrition",
                 "description": "Calories, protein, carbs, fat and fibre for foods by weight, from the USDA food tables served by Plexon. Returns each item and the plate total.\n\nFor a meal photo: look at the picture, list every item you can see with your best weight in grams, and call this once with all of them. Name foods in English with the cooking method, and add what a photo hides but the dish contains, such as cooking oil or dressing. Set grams_source to weighed or label when the user gave the weight; a weight they gave replaces your estimate.\n\nExpect two calls for a plate. The table answers only when a name means one food; a name that covers several (rice, bacon, grilled chicken breast with or without skin) comes back under unmatched with candidates. Choose the candidate that fits what you see and send the whole plate again with its food_id, or give a more exact name, or per_100g values (all four of kcal, protein_g, carbs_g, fat_g) from a label or another food database. Read each matched name too, and correct any that is not the food you meant. A mixed dish the table does not have works as its ingredients. Give the user the accuracy line with the numbers.",
                 "inputSchema": {"type": "object", "properties": {"items": {"type": "array", "items": {"type": "object", "properties": {"name": {"type": "string", "description": "The food in English with its cooking method, e.g. \"grilled chicken breast\", \"boiled potatoes\", \"feta cheese\"."}, "grams": {"type": "number", "description": "Weight in grams of the part that is eaten."}, "food_id": {"type": "integer", "description": "The food_id of a candidate from an earlier result. Skips name matching."}, "per_100g": {"type": "object", "properties": {"kcal": {"type": "number", "description": "Energy in kcal per 100 g."}, "protein_g": {"type": "number", "description": "Protein in grams per 100 g."}, "carbs_g": {"type": "number", "description": "Carbohydrate in grams per 100 g."}, "fat_g": {"type": "number", "description": "Fat in grams per 100 g."}, "fibre_g": {"type": "number", "description": "Fibre in grams per 100 g. Leave out when the source does not state it."}}, "description": "Composition per 100 g when you already have it from a label, a barcode or another database. Skips the food table.", "required": ["kcal", "protein_g", "carbs_g", "fat_g"], "additionalProperties": false}, "grams_source": {"type": "string", "description": "Where the weight came from: estimated from a photo or a description; weighed by the user; label for a weight printed on the pack.", "default": "estimated", "enum": ["estimated", "weighed", "label"]}}, "required": ["name", "grams"], "additionalProperties": false}, "description": "Every food on the plate, each with its weight."}, "servings": {"type": "number", "description": "How many people share the plate. Adds a per_serving total. Defaults to 1."}}, "required": ["items"], "additionalProperties": false}}],
  "messages": [{"role": "user", "content": [{"type": "text", "text": "How many calories and how much protein, carbohydrate and fat are on this plate? I will eat all of it."},
                                            {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,'
  base64 < plate.jpg | tr -d '\n'
  printf '%s' '"}}]},
               {"role": "assistant", "content": "Looking the plate up again with the meatballs I chose.",
                "tool_calls": [{"id": "call_def456", "type": "function",
                                "function": {"name": "plexon_nutrition", "arguments": "{\"items\":[{\"name\":\"meatballs\",\"grams\":160,\"food_id\":171638},{\"name\":\"cooked pasta\",\"grams\":150},{\"name\":\"feta cheese\",\"grams\":40},{\"name\":\"tomatoes\",\"grams\":60},{\"name\":\"cucumber\",\"grams\":40},{\"name\":\"olives\",\"grams\":20},{\"name\":\"olive oil\",\"grams\":10},{\"name\":\"tzatziki\",\"grams\":60}]}"}}]},
               {"role": "tool", "tool_call_id": "call_def456", "name": "plexon_nutrition",
                "content": "{\"items\":[{\"name\":\"meatballs\",\"matched\":\"Meatballs, frozen, Italian style\",\"food_id\":171638,\"dataset\":\"sr\",\"grams\":160,\"grams_source\":\"estimated\",\"kcal_per_100g\":286,\"amount\":{\"kcal\":457.6,\"protein_g\":23,\"carbs_g\":12.9,\"fat_g\":35.5,\"fibre_g\":3.7}},{\"name\":\"cooked pasta\",\"matched\":\"Pasta, cooked\",\"food_id\":2708357,\"dataset\":\"fndds\",\"grams\":150,\"grams_source\":\"estimated\",\"kcal_per_100g\":157,\"amount\":{\"kcal\":235.5,\"protein_g\":8.6,\"carbs_g\":46.1,\"fat_g\":1.4,\"fibre_g\":2.7}},{\"name\":\"feta cheese\",\"matched\":\"Cheese, Feta\",\"food_id\":2705714,\"dataset\":\"fndds\",\"grams\":40,\"grams_source\":\"estimated\",\"kcal_per_100g\":273,\"amount\":{\"kcal\":109.2,\"protein_g\":7.9,\"carbs_g\":2.2,\"fat_g\":7.6,\"fibre_g\":0}},{\"name\":\"tomatoes\",\"matched\":\"Tomatoes, raw\",\"food_id\":2709719,\"dataset\":\"fndds\",\"grams\":60,\"grams_source\":\"estimated\",\"kcal_per_100g\":20,\"amount\":{\"kcal\":12,\"protein_g\":0.5,\"carbs_g\":2.4,\"fat_g\":0.2,\"fibre_g\":0.7}},{\"name\":\"cucumber\",\"matched\":\"Cucumber, raw\",\"food_id\":2709784,\"dataset\":\"fndds\",\"grams\":40,\"grams_source\":\"estimated\",\"kcal_per_100g\":16,\"amount\":{\"kcal\":6.4,\"protein_g\":0.2,\"carbs_g\":1.2,\"fat_g\":0.1,\"fibre_g\":0.2}},{\"name\":\"olives\",\"matched\":\"Olives, NFS\",\"food_id\":2710088,\"dataset\":\"fndds\",\"grams\":20,\"grams_source\":\"estimated\",\"kcal_per_100g\":116,\"amount\":{\"kcal\":23.2,\"protein_g\":0.2,\"carbs_g\":1.2,\"fat_g\":2.2,\"fibre_g\":0.3}},{\"name\":\"olive oil\",\"matched\":\"Olive oil\",\"food_id\":2710186,\"dataset\":\"fndds\",\"grams\":10,\"grams_source\":\"estimated\",\"kcal_per_100g\":900,\"amount\":{\"kcal\":90,\"protein_g\":0,\"carbs_g\":0,\"fat_g\":10,\"fibre_g\":0}},{\"name\":\"tzatziki\",\"matched\":\"Tzatziki dip\",\"food_id\":2705448,\"dataset\":\"fndds\",\"grams\":60,\"grams_source\":\"estimated\",\"kcal_per_100g\":91,\"amount\":{\"kcal\":54.6,\"protein_g\":3.1,\"carbs_g\":2.5,\"fat_g\":3.6,\"fibre_g\":0.1}}],\"totals\":{\"kcal\":988.5,\"protein_g\":43.6,\"carbs_g\":68.4,\"fat_g\":60.6,\"fibre_g\":7.7},\"accuracy\":\"Estimate. Weights read from a photo are typically 35 to 50% off on calories. A weighed portion, a barcode or a reference object in the shot tightens it.\",\"source\":\"USDA FoodData Central: Foundation Foods 2026-10-29, FNDDS 2024-10-31, SR Legacy 2019-04-01.\"}"}],
  "provider": {"name": "plexon", "model": "plexon-1.0"}}'
} > body.json
curl -s -X POST "$PLEXON/api/v1/chat" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "X-Plexon-Handle: cust-4821" -H "Content-Type: application/json" -d @body.json
json
{"success": true,
 "response": "<final>true</final>About 990 kcal, 44 g protein, 68 g carbs, 61 g fat, 8 g fibre for the whole plate (meatballs, orzo, feta, salad, tzatziki).\n\nThe meatballs are the swing factor: I used a generic Italian-style frozen meatball at 160 g, and fattier homemade ones would push the total past 1,050 kcal.\n\nRisk: every weight is read off the photo, so the calorie figure could be off by a third either way; the protein estimate is the more stable number.",
 "usage": {"prompt_tokens": 12746, "completion_tokens": 124, "total_tokens": 12870, "prompt_tokens_details": {"cached_tokens": 11776}},
 "service_tier": "premium",
 "metered": {"cost": 0, "cost_microcredits": 40800, "rate_card": "off_peak",
             "included_used": 0, "included_limit": 0, "purchased": 0, "pool": 1999},
 "...": "..."}

The model gave the totals with its own wording of the warning about the weights, in the voice of the built-in role. A meal app gives the model its own role with persona_system_prompt, as “Your own role” shows. As in any chat answer, strip the leading <final>true</final>.

What it costs. A call to this route costs no credits and moves no balance, tools/list included. The chat turns around the lookups are charged as chat turns are (“What a turn costs”), and two parts of them come from the tool: its description and schema ride as input tokens in every chat call that declares it, and each lookup’s text you send back stays in the conversation from then on. A picture in a chat call costs input tokens at the model’s input rate; there is no per-picture fee. The example sends a 98 KB photo, 750 by 500 pixels, which added 230 prompt tokens to its turn: 11,795 with it, 11,565 without. The photo rides every turn of the conversation, so its tokens are paid on each, at the lower cached price once they come from cache. Above, both on the off_peak list as their rate_card says, the chat call with the photo cost 0.31 credits and the answer 0.04. When this example was first run from start to end, the plate took three chat turns and two lookups for 0.549 credits; a second run, with the prompt already in cache, took four turns for 0.304 credits. That is what the samples cost, not a price.

Limits. A key may make 60 calls at once here, refilled at 10 a second, which is 600 a minute. Each Plexon server counts on its own, so take 600 a minute as what a key can rely on, not as the exact point where refusals begin. The limit is per key, never per handle: limits per user are yours to set. One lookup takes at most 32 foods, each named in at most 8 words and 80 bytes. A request body is at most 256 KB, measured after a gzip body is inflated.

Refusals. A plate the tool cannot take is not an HTTP error. The answer is a 200 whose result holds "isError": true and one sentence for the model in content[0].text. Send it back as the tool message, as you would any result, and the model corrects its call. A 33rd food, for one:

json
{"jsonrpc": "2.0", "id": 5,
 "result": {"content": [{"type": "text", "text": "send at most 32 items in one call; split a longer list"}], "isError": true,
            "...": "..."}}

Arguments of a loose type are repaired before any of that: "grams": "150" counts as 150. These are refused on the wire, in Plexon’s error body:

Every other answer is MCP’s own. A JSON answer holds result or error: read error first. A 200 with an error and no result means the tool failed on the server: send the call again shortly. Any status other than 200 whose body is not Plexon’s error body comes from the protocol layer: treat it as a bug in your request.

Streaming

With "stream": true on /chat and /tts, and always on /image, /video and /music, the answer is HTTP 200 with server-sent events. Each event is one data: line holding a JSON object with a type (there are no event: lines), events are separated by a blank line, and a stream that succeeds ends with data:[DONE]. A line that starts with : is a keep-alive comment, sent every 10 seconds while nothing else is: skip it. Each route’s section lists its events. A stream also carries events meant for the Plexon app, such as service_tier and timing: skip any type you do not use.

A failure after the stream opened arrives as an error event inside that HTTP 200, never as an HTTP status, and the stream ends there, with no data:[DONE] after it. A refusal decided before the stream opens is an HTTP status with the usual JSON body.

When a chat turn fails after the model began answering, a metered event can come just before the error event: the part already produced was charged, and that event says what it cost.

An error event has its own fields, not the ones the chat events share:

Field of error Meaning
error the sentence
kind what failed, when the server knows; absent on a failure of the model itself
status the status that came with the failure, when there was one
retry_after seconds to wait, on a short-lived refusal
limit, count on prompt_too_long only: the limit and the prompt’s length, in characters
window, resets_at on a day’s limit met on the stream only (daily_limit_exceeded): the window, which reads 24h, and when it opens again, an RFC 3339 time
uncounted on video_outcome_unknown only: true when the clip did not count as one of today’s clips, which is every clip on credits
is_done true

When the paid model fails and the backup model under it has used up its day, the call ends with daily_limit_exceeded and window and resets_at, on the stream as an error event and before it as 429. The sentence names the kind of call and the day’s count, such as “The paid model could not make this picture, and the backup model has reached today’s limit of 3 pictures.” Ask again after resets_at.

A failure of the model itself carries no kind: read the sentence. A song or a speech stream never carries a kind. These are the kinds the other streams carry:

kind Stream What it means Charged Ask again
credits_exhausted chat the credits ran out while the turn was served only what a metered event before it says after a top-up
context_window_exceeded chat the conversation is longer than the model can read only what a metered event before it says after condensing it
provider_rejected chat the model refused the request as it was sent only what a metered event before it says only after changing what you sent
model_unavailable chat the model’s side cannot serve, and waiting will not change that only what a metered event before it says no: write to Plexon
server_restarting chat, picture Plexon is updating chat: only what a metered event before it says; picture: no yes, a moment later
image_busy picture too many pictures at once, or pictures are not available for a while; nothing was made no yes, later
image_outcome_unknown picture the request reached the model and no answer came back; it counts toward the three lost a day no only if the person asks: the picture may already be under way
image_references_unavailable picture reference pictures cannot be used right now no yes, without reference_images
image_failed picture the picture could not be made no yes
validation_error picture, clip after a step to another model, that model refused the inputs no only after fixing them
video_busy clip clips cannot be made right now; nothing was made no yes, later
video_outcome_unknown clip the clip may have been started and its result did not come back; it counts toward the three lost a day no only if the person asks: the clip may already be under way
prompt_too_long clip after a step to another model, the prompt is over that model’s limit no with a shorter prompt
video_failed clip after a step to another model, the clip could not be made there no yes, in a moment

On credits a clip’s video_outcome_unknown event carries uncounted: true, and its sentence says it did not count as one of today’s clips; it counts toward the three losses. Three such losses of pictures, or of clips, in a UTC day close that kind for the account until midnight UTC.

How calls are charged and limited

With a user key instead

A user key (plx_u_) calls the model API for its own account, with no header: send Authorization: Bearer plx_u_... and nothing else. Its calls spend that account’s own credits, then your company’s pool, exactly as a company key’s calls for that account do. An X-Plexon-Handle, X-Plexon-Group or X-Plexon-Customer header sent with a user key is ignored. A user key never creates an account: create the account first (through the company API, or with a first model call by company key), then mint its key.

A user key can also read its own account’s movements, a page at a time: An account’s own history, after the company API.

The company API

Every path is under $PLEXON/auth/company/payg. The company is always the key’s company; nothing in a path or a body can name another one. These calls take the company key alone: no X-Plexon-Handle header. A body is JSON and at most 1 MB.

An account or key that is not in your company answers 404, as an id that does not exist does, and so does an account that is not on pay as you go. An account Plexon has switched to no plan counts as not on pay as you go everywhere in this API: it is not counted, not listed and not credited.

Route What it does
GET /auth/company/payg the company: its reserve, its pool, its start amount
GET /auth/company/payg/ledger every movement of company money
GET /auth/company/payg/pool-usage the model calls the pool paid part of, a page at a time
PUT /auth/company/payg/settings set the start amount
POST /auth/company/payg/pool/topup move money from the reserve to the pool
POST /auth/company/payg/users create an account
GET /auth/company/payg/users list accounts, or find one by its handle
GET /auth/company/payg/users/{id} one account, its balance and its movements, a page at a time
POST /auth/company/payg/users/{id}/topup move money from the reserve to one account
POST /auth/company/payg/users/topup-all move money from the reserve to every account
GET /auth/company/payg/users/{id}/keys list an account’s user keys
POST /auth/company/payg/users/{id}/keys create a user key
DELETE /auth/company/payg/users/{id}/keys/{key_id} revoke a user key

The samples below follow one company from its first day: it paid 2,500 USD by card, moved 200 of it to the pool, and made the first call above.

The company: GET /auth/company/payg

No body. Answers the company:

Field Meaning
company_id your company’s id
enabled pay as you go is on for the company
balance the reserve, an amount object
pool the pool, an amount object
start what a new account receives when the create call below makes it, an amount object (an account a first model call makes receives nothing)
users how many accounts a top-up of every account reaches: on pay as you go and not disabled
credits_per_usd the server’s rate
auto_topup the automatic top-up rule and the saved card: enabled, threshold_usd, amount_usd and monthly_cap_usd in whole dollars (a cap of 0 is no cap), card (brand, last4, exp_month, exp_year, or null), paused (“” or why the last charge failed: card_declined, authentication_required, tax_location, stripe_error), charged_this_month_usd, cap_reached and pending. A key can read it and cannot change it
bash
curl -s "$PLEXON/auth/company/payg" -H "Authorization: Bearer $COMPANY_KEY"
json
{"company_id": "00000000-0000-4000-8000-00000000c0de",
 "enabled": true,
 "balance": {"credits": 230000, "usd": 2300, "uc": 230000000000},
 "pool": {"credits": 19999, "usd": 199.99, "uc": 19999574720},
 "start": {"credits": 0, "usd": 0, "uc": 0},
 "users": 1,
 "credits_per_usd": 100}

The path is served exactly as written, with no trailing slash and no redirect.

The company ledger: GET /auth/company/payg/ledger?limit=&before=

Every movement of company money, newest first. limit is 50 by default and at most 200. before is an entry id: pass the last id of a page to get the page after it.

Field of an entry Meaning
id the entry’s id, for before
kind what moved, in the table below
amount an amount object, the size of the move; positive except a Plexon take-back
user_id, user_email the account, for a move to one account, else empty. user_email is also empty for an account with no email address, such as one a first model call made
users the head count of a top-up of every account, else 0
note the note sent with the move
actor who moved it: key: and the key’s id for a call made with a key, user: and the person’s id for a person of your company signed in, plexon for anything Plexon did, stripe for a card payment
paid_cents what a card payment charged
created_at when

A row carries no handle: match it to your user by user_id, the Plexon id that GET /users?handle= answers.

kind Meaning
fund_admin Plexon funded the reserve (negative: Plexon took some back)
fund_stripe the company paid the reserve by card
fund_auto an automatic top-up charged the saved card; a to_pool row for the same amount follows it
to_pool reserve to pool
to_user reserve to one account
to_all reserve to every account on pay as you go; amount is the total
start reserve to a new account, its start amount
from_pool Plexon moved credit from the pool back to the reserve (after a refund or a dispute, for example); you can see such a row, you cannot make one
bash
curl -s "$PLEXON/auth/company/payg/ledger?limit=2" -H "Authorization: Bearer $COMPANY_KEY"
json
{"entries": [
  {"id": 812, "kind": "to_pool", "amount": {"credits": 20000, "usd": 200, "uc": 20000000000},
   "user_id": "", "user_email": "", "users": 0, "note": "Opening pool",
   "actor": "user:00000000-0000-4000-8000-0000000000d1", "paid_cents": 0,
   "created_at": "<RFC3339 time>"},
  {"id": 811, "kind": "fund_stripe", "amount": {"credits": 250000, "usd": 2500, "uc": 250000000000},
   "user_id": "", "user_email": "", "users": 0, "note": "", "actor": "stripe", "paid_cents": 250000,
   "created_at": "<RFC3339 time>"}]}

Reading a history page by page

Three reads answer a history one page at a time: the pool usage below, an account’s movements (GET /auth/company/payg/users/{id}), and the movements an account reads for itself (An account’s own history). All three page the same way, so a company can read every call back to the 90 days Plexon keeps (“History”).

Parameter Meaning
limit rows per page; each read states its default, and a page holds at most 500 rows (a larger limit reads as 500)
cursor the next_cursor of the page before; leave it out for the newest page
from only rows at or after this time, in RFC 3339, such as 2026-11-01T00:00:00Z
to only rows before this time, in RFC 3339; a row at exactly to is left out
customer only the calls that sent this X-Plexon-Customer, matched exactly; leave it out for every row. Like ?handle=, it is recorded with the URL by the hosting platform’s request log

Each row carries customer and group_id: the X-Plexon-Customer and the X-Plexon-Group its call sent, or an empty string when it sent none (every row that is not a model call, too).

Pool usage: GET /auth/company/payg/pool-usage?limit=&cursor=&from=&to=&customer=

The model calls the pool paid part of, newest first, one page at a time. limit is 50 by default and at most 500. cursor, from, to and customer work as “Reading a history page by page” says.

Field Meaning
entries this page of entries, newest first
next_cursor send it as cursor for the next page; an empty string on the last page
Field of an entry Meaning
id the call’s id, the same id its debit carries in that account’s movements
user_id, user_email the account; user_email is empty for an account with no email address
amount the pool’s part of that call, an amount object
task what kind of call it was, such as text, code or image
customer the X-Plexon-Customer the call sent, else empty
group_id the X-Plexon-Group the call sent, else empty
created_at when
bash
curl -s "$PLEXON/auth/company/payg/pool-usage?limit=1" -H "Authorization: Bearer $COMPANY_KEY"
json
{"entries": [{"id": 90377, "user_id": "00000000-0000-4000-8000-0000000000a1", "user_email": "",
  "amount": {"credits": 0, "usd": 0, "uc": 425280}, "task": "text", "customer": "", "group_id": "",
  "created_at": "<RFC3339 time>"}],
 "next_cursor": "MTc2NDIzNTgxMDEyMzQ1Ni45MDM3Nw"}

Errors: 400 invalid_cursor, 400 invalid_range and 400 invalid_customer (“Reading a history page by page”).

The start amount: PUT /auth/company/payg/settings

Body {"start_usd": 10}, required: 0, or 1 to 5000 dollars, with at most two decimals. Every account the create call makes afterwards receives this amount from the reserve, unless the create call names its own. An account a first model call makes receives no start amount. Answers the company.

bash
curl -s -X PUT "$PLEXON/auth/company/payg/settings" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "Content-Type: application/json" -d '{"start_usd": 10}'

Answers the company as in GET /auth/company/payg, with start now {"credits": 1000, "usd": 10, "uc": 1000000000}.

Errors: 400 invalid_amount (missing, negative, above 0 and under 1, a third decimal, or above 5000), 400 invalid_request (the body is not JSON).

Whether pay as you go is on for the company is Plexon’s switch; this call never changes it.

Fill the pool: POST /auth/company/payg/pool/topup

Body {"amount_usd": 100, "note": "Shared budget"}, at least 1 USD. note is optional, up to 500 characters. Takes the amount from the reserve and adds it to the pool. Honours Idempotency-Key. Answers the company, plus "replayed": true on a replay.

bash
curl -s -X POST "$PLEXON/auth/company/payg/pool/topup" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "Content-Type: application/json" -H "Idempotency-Key: pool-batch-17" \
  -d '{"amount_usd": 100, "note": "Shared budget"}'
json
{"company_id": "00000000-0000-4000-8000-00000000c0de", "enabled": true,
 "balance": {"credits": 220000, "usd": 2200, "uc": 220000000000},
 "pool": {"credits": 29999, "usd": 299.99, "uc": 29999574720},
 "start": {"credits": 1000, "usd": 10, "uc": 1000000000}, "users": 1, "credits_per_usd": 100}

Errors: 400 invalid_amount, 400 note_too_long, 400 invalid_request, 402 company_balance_insufficient (nothing moved), 409 idempotency_key_reused.

Create an account: POST /auth/company/payg/users

You do not need this call to use the model API: a first model call with a new handle creates the account. Create an account here when it should have an email address, a start amount of its own, a user group, or a user key from the start.

Field Required Meaning
email yes the account’s address; an address that already has a Plexon account answers 409 and is never attached
handle no your own id for this user, the one the model API takes (see “Handles”); left out, Plexon makes one (a UUIDv7) and returns it
firstname, lastname no the name
group_id no one of your company’s user groups to put the account in
start_usd no this account’s start amount: 0, or 1 to 5000 dollars; absent uses the company’s start amount
issue_key no true also creates the account’s user key and returns it
password no refused when the call is made with a key (403 key_cannot_set_password)

The account is created in your company, on pay as you go, with the start amount moved out of the reserve. All of it happens or none of it: when the reserve cannot cover the start, or the handle is taken, no account is created. An account made with a key has no sign-in. It works through the company key and its handle, or through its user key. A person can sign in to the Plexon app with it only after your company admin sets a password for it in the company panel. (An account your company admin creates while signed in, with no password, can still use Google sign-in on the same address.)

A handle Plexon makes is a UUID, like the account’s id, and it is a different value. Store the handle from the answer if the model API will reach this account.

bash
curl -s -X POST "$PLEXON/auth/company/payg/users" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "maria@example.com", "handle": "cust-5107", "firstname": "Maria", "lastname": "Papadopoulou", "start_usd": 10, "issue_key": true}'

Answers 201:

json
{"user": {"id": "00000000-0000-4000-8000-0000000000a2", "email": "maria@example.com",
          "firstname": "Maria", "lastname": "Papadopoulou", "handle": "cust-5107",
          "payg_since": "<RFC3339 time>"},
 "start": {"credits": 1000, "usd": 10, "uc": 1000000000},
 "access_key": {"id": "00000000-0000-4000-8000-0000000000b2", "prefix": "plx_u_Ab12Cd",
                "token": "plx_u_<43 characters>"}}

access_key is present only when issue_key was true, and the token is never shown again.

Errors: 400 invalid_request (no email, an address Plexon reserves, or the body is not JSON), 400 invalid_handle (the handle’s shape), 400 invalid_amount (start_usd out of range), 400 invalid_group (the group is not one of your company’s), 400 weak_password (a password your signed-in company admin sent does not meet the password rules; it cannot occur with a key, which may not send a password), 402 company_balance_insufficient (nothing created), 403 key_cannot_set_password (nothing created), 409 email_taken, 409 handle_taken (the handle already names an account in your company, one that has left it included; nothing created).

List accounts: GET /auth/company/payg/users?limit=&offset=&search=&handle=

Your company’s accounts on pay as you go, newest first. limit is 50 by default and at most 500; offset skips that many. Each account: id, email, firstname, lastname, handle, payg_since, balance (its own credits, an amount object). total is the number of matches.

The account the first call made, found by its handle:

bash
curl -s "$PLEXON/auth/company/payg/users?handle=cust-4821" -H "Authorization: Bearer $COMPANY_KEY"
json
{"users": [{"id": "00000000-0000-4000-8000-0000000000a1", "email": "",
            "firstname": "", "lastname": "", "handle": "cust-4821", "payg_since": "<RFC3339 time>",
            "balance": {"credits": 0, "usd": 0, "uc": 0}}],
 "total": 1}

Errors: 400 invalid_handle (the handle parameter’s shape).

One account: GET /auth/company/payg/users/{id}?limit=&cursor=&from=&to=&customer=

The account, its balance, and its movements one page at a time, newest first. {id} is the Plexon id, never the handle. limit is 50 by default and at most 500. cursor, from, to and customer work as “Reading a history page by page” says. Every page carries the account and its balance as they are now.

Field Meaning
user the account, as the list above shows it
balance its own credits, an amount object
ledger this page of movements, newest first
next_cursor send it as cursor for the next page; an empty string on the last page
Field of a movement Meaning
id the movement’s id
kind the direction: debit is a model call (spent, shown positive); company is money your company moved in; purchase is a card top-up; grant is Plexon’s
amount the whole size of the movement, an amount object; positive except a Plexon take-back (a negative grant)
pool the part a company pool paid, 0 when none
task the kind of call, for a debit
note the note of the movement
customer the X-Plexon-Customer a debit’s call sent, else empty
group_id the X-Plexon-Group a debit’s call sent, else empty
created_at when

On a company movement, its note reads “Company start”, or “Company top-up:” and the note you sent; with no note sent, “Company top-up” alone.

bash
curl -s "$PLEXON/auth/company/payg/users/00000000-0000-4000-8000-0000000000a2" -H "Authorization: Bearer $COMPANY_KEY"

Maria’s account, after one chat call of its own:

json
{"user": {"id": "00000000-0000-4000-8000-0000000000a2", "email": "maria@example.com", "firstname": "Maria",
          "lastname": "Papadopoulou", "handle": "cust-5107", "payg_since": "<RFC3339 time>",
          "balance": {"credits": 999, "usd": 9.99, "uc": 999952000}},
 "balance": {"credits": 999, "usd": 9.99, "uc": 999952000},
 "ledger": [
   {"id": 90412, "kind": "debit", "amount": {"credits": 0, "usd": 0, "uc": 48000},
    "pool": {"credits": 0, "usd": 0, "uc": 0}, "task": "text", "note": "",
    "customer": "", "group_id": "", "created_at": "<RFC3339 time>"},
   {"id": 90388, "kind": "company", "amount": {"credits": 1000, "usd": 10, "uc": 1000000000},
    "pool": {"credits": 0, "usd": 0, "uc": 0}, "task": "", "note": "Company start",
    "customer": "", "group_id": "", "created_at": "<RFC3339 time>"}],
 "next_cursor": ""}

Both movements fit on one page, so next_cursor is empty. The account the first call made (cust-4821) has many more movements. Read one per page:

bash
curl -s "$PLEXON/auth/company/payg/users/00000000-0000-4000-8000-0000000000a1?limit=1" -H "Authorization: Bearer $COMPANY_KEY"
json
{"user": {"id": "00000000-0000-4000-8000-0000000000a1", "email": "", "firstname": "", "lastname": "",
          "handle": "cust-4821", "payg_since": "<RFC3339 time>",
          "balance": {"credits": 0, "usd": 0, "uc": 0}},
 "balance": {"credits": 0, "usd": 0, "uc": 0},
 "ledger": [
   {"id": 90377, "kind": "debit", "amount": {"credits": 0, "usd": 0, "uc": 425280},
    "pool": {"credits": 0, "usd": 0, "uc": 425280}, "task": "text", "note": "",
    "customer": "", "group_id": "", "created_at": "<RFC3339 time>"}],
 "next_cursor": "MTc2NDIzNTgxMDEyMzQ1Ni45MDM3Nw"}

The pool paid all of that call, so the same id is the newest pool-usage entry above. The next page sends next_cursor back as cursor and starts with the call before it:

bash
curl -s "$PLEXON/auth/company/payg/users/00000000-0000-4000-8000-0000000000a1?limit=1&cursor=MTc2NDIzNTgxMDEyMzQ1Ni45MDM3Nw" -H "Authorization: Bearer $COMPANY_KEY"
json
{"user": {"id": "00000000-0000-4000-8000-0000000000a1", "email": "", "firstname": "", "lastname": "",
          "handle": "cust-4821", "payg_since": "<RFC3339 time>",
          "balance": {"credits": 0, "usd": 0, "uc": 0}},
 "balance": {"credits": 0, "usd": 0, "uc": 0},
 "ledger": [
   {"id": 90371, "kind": "debit", "amount": {"credits": 0, "usd": 0, "uc": 161760},
    "pool": {"credits": 0, "usd": 0, "uc": 161760}, "task": "text", "note": "",
    "customer": "", "group_id": "", "created_at": "<RFC3339 time>"}],
 "next_cursor": "MTc2NDIzNTgwOTEyMzQ1Ni45MDM3MQ"}

Only the calls made for one of your customers, here the two turns under “Groups and customers”, newest first: the one by slug, then the one by id. Both rows carry the group’s id:

bash
curl -s "$PLEXON/auth/company/payg/users/00000000-0000-4000-8000-0000000000a1?customer=shop-12" -H "Authorization: Bearer $COMPANY_KEY"
json
{"user": {"id": "00000000-0000-4000-8000-0000000000a1", "email": "", "firstname": "", "lastname": "",
          "handle": "cust-4821", "payg_since": "<RFC3339 time>",
          "balance": {"credits": 0, "usd": 0, "uc": 0}},
 "balance": {"credits": 0, "usd": 0, "uc": 0},
 "ledger": [
   {"id": 90361, "kind": "debit", "amount": {"credits": 0, "usd": 0, "uc": 21280},
    "pool": {"credits": 0, "usd": 0, "uc": 21280}, "task": "text", "note": "",
    "customer": "shop-12", "group_id": "00000000-0000-4000-8000-0000000000e1", "created_at": "<RFC3339 time>"},
   {"id": 90359, "kind": "debit", "amount": {"credits": 0, "usd": 0, "uc": 21280},
    "pool": {"credits": 0, "usd": 0, "uc": 21280}, "task": "text", "note": "",
    "customer": "shop-12", "group_id": "00000000-0000-4000-8000-0000000000e1", "created_at": "<RFC3339 time>"}],
 "next_cursor": ""}

Errors: 400 invalid_cursor, 400 invalid_range and 400 invalid_customer (“Reading a history page by page”), 404 not found.

Top up one account: POST /auth/company/payg/users/{id}/topup

Body {"amount_usd": 25, "note": "November budget"}, at least 1 USD. Moves the amount from the reserve into that account’s own credits. Honours Idempotency-Key.

bash
curl -s -X POST "$PLEXON/auth/company/payg/users/00000000-0000-4000-8000-0000000000a2/topup" \
  -H "Authorization: Bearer $COMPANY_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: maria-november" -d '{"amount_usd": 25, "note": "November budget"}'
json
{"user_id": "00000000-0000-4000-8000-0000000000a2",
 "balance": {"credits": 3499, "usd": 34.99, "uc": 3499952000},
 "company": {"company_id": "00000000-0000-4000-8000-00000000c0de", "enabled": true,
             "balance": {"credits": 216500, "usd": 2165, "uc": 216500000000},
             "pool": {"credits": 29999, "usd": 299.99, "uc": 29999574720},
             "start": {"credits": 1000, "usd": 10, "uc": 1000000000}, "users": 2, "credits_per_usd": 100}}

balance is the account’s own credits after the move. It is left out when the account is no longer in your company (a replay after the person left).

Errors: 400 invalid_amount, 400 note_too_long, 400 invalid_request, 402 company_balance_insufficient, 404 not found, 409 not_payg (a member of your company who is not on pay as you go), 409 idempotency_key_reused.

Top up every account: POST /auth/company/payg/users/topup-all

Body {"amount_usd": 5, "note": "Monthly allowance"}, the amount per account, at least 1 USD. Gives that amount to every account of your company on pay as you go (disabled accounts are skipped), all or nothing: when the reserve cannot cover the total, nobody gets anything. Honours Idempotency-Key. users is how many accounts were topped up, total what left the reserve. With no account on pay as you go it moves nothing and answers users: 0. The total (the amount times the accounts it reaches) is at most 1,000,000 USD; above that the call answers 400 invalid_amount and nothing moves.

bash
curl -s -X POST "$PLEXON/auth/company/payg/users/topup-all" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "Content-Type: application/json" -H "Idempotency-Key: all-november" \
  -d '{"amount_usd": 5, "note": "Monthly allowance"}'
json
{"users": 2, "total": {"credits": 1000, "usd": 10, "uc": 1000000000},
 "company": {"company_id": "00000000-0000-4000-8000-00000000c0de", "enabled": true,
             "balance": {"credits": 215500, "usd": 2155, "uc": 215500000000},
             "pool": {"credits": 29999, "usd": 299.99, "uc": 29999574720},
             "start": {"credits": 1000, "usd": 10, "uc": 1000000000}, "users": 2, "credits_per_usd": 100}}

Errors: 400 invalid_amount, 400 note_too_long, 400 invalid_request, 402 company_balance_insufficient, 409 idempotency_key_reused.

An account’s user keys

Optional. The company key and a handle already reach every account; a user key is for a key that has to live on a device the company does not control.

Call Body Answer
GET /auth/company/payg/users/{id}/keys none {"keys": [...]}: key items, revoked keys included, newest first
POST /auth/company/payg/users/{id}/keys {"name": "Booking app"} (up to 100 characters) or no body 201 {"id", "prefix", "token"}; the token is shown once
DELETE /auth/company/payg/users/{id}/keys/{key_id} none 204, no body

A key item: id, kind (user), name, prefix, created_at, created_by (who made it: key: and a key’s id, user: and a person’s id, or plexon when Plexon did), last_used_at (updated at most every five minutes), revoked_at.

bash
curl -s -X POST "$PLEXON/auth/company/payg/users/00000000-0000-4000-8000-0000000000a2/keys" \
  -H "Authorization: Bearer $COMPANY_KEY" -H "Content-Type: application/json" -d '{"name": "Booking app"}'

Answers 201:

json
{"id": "00000000-0000-4000-8000-0000000000b3", "prefix": "plx_u_Xy98Zw", "token": "plx_u_<43 characters>"}

Errors: 400 invalid_request (a name over 100 characters), 403 access_key_plan (on create: the account also holds a subscription, so a key would not work for it), 404 not found (the account, or on delete the key).

Company keys and card payments (signed-in only)

GET and POST /auth/company/payg/keys and DELETE /auth/company/payg/keys/{key_id} manage the company’s own keys, and POST /auth/company/payg/checkout with {"amount_usd": 100} (whole dollars, 5 to 10000) opens a card payment that funds the reserve. PUT /auth/company/payg/auto-topup sets the automatic top-up rule and POST /auth/company/payg/auto-topup/retry lifts a pause. A company admin uses them from the company panel. With a key they answer 403 key_cannot_manage_keys. The card the top-up charges is saved with POST /auth/company/billing/card and removed with DELETE /auth/company/billing/card. It is saved from the company’s billing and no longer needs pay as you go. Those two calls need a signed-in company admin; a key does not reach them.

Desktop access for your people

Your company can pay for a person’s Plexon plan, so they sign in to the Plexon desktop app with their own email and password and use it like anyone who bought the plan. Each such plan is a seat: one subscription a month, charged to the card your company saved, with the two add-ons optional (nous_cloud, Plexon Nous Cloud, and site_publishing, website publishing). The person reads “Paid by” and your company’s name in their account, and cannot change or cancel it. This is not pay as you go: a seat holder is an ordinary account of your company with a plan of its own, no handle and no credits from your pool, and your company does not need pay as you go for it. Prices include tax, and the quote below answers the amounts.

A company key reaches these routes only after a company admin turns it on. On the Subscriptions page of the company panel, the admin saves a card under Company card and ticks “Let company keys turn on desktop access” under Company keys, with an optional monthly cap on what keys start. Until then every route here answers a company key 403 seat_keys_off, “Key access to desktop seats is off for this company. A company admin turns it on in the company panel.” A signed-in company admin can use the same routes, and the panel does: its Enable desktop access button is the call below.

Every path is under $PLEXON/auth/company/seats. The company is always the key’s company. These calls take the company key alone, with no X-Plexon-Handle header, and a body is JSON.

Route What it does
POST /auth/company/seats/quote what turning desktop access on would charge now; charges nothing
POST /auth/company/seats turn desktop access on for one person and charge the card
GET /auth/company/seats your company’s seats, live ones first

What it would charge: POST /auth/company/seats/quote

Ask before you press. The quote answers what the call below would charge right now, for the person and the add-ons you name, and it charges, creates and writes nothing.

Field Required Meaning
user_id no an account of your company; left out, the quote is for a new person
group_id no one of your company’s user groups the person would join
add_ons no the add-ons to price, each once: nous_cloud, site_publishing

The answer carries plan_usd, one entry per add-on you named (feature, usd, included), total_usd, tax (it reads included) and card, the card that would be charged (brand, last4, exp_month, exp_year, or null with no card saved). An add-on is included when the person already has it another way, through the plan or through a group, the group you named counting as joined. It then costs 0, stays out of the total and must not be sent with the call below. The amounts here are an example:

curl -s -X POST "$PLEXON/auth/company/seats/quote" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"user_id": "00000000-0000-4000-8000-0000000000d1", "add_ons": ["nous_cloud", "site_publishing"]}'
json
{"plan_usd": 20, "add_ons": [{"feature": "nous_cloud", "usd": 30, "included": false},
                             {"feature": "site_publishing", "usd": 0, "included": true}],
 "total_usd": 50, "tax": "included",
 "card": {"brand": "visa", "last4": "4242", "exp_month": 4, "exp_year": 2030}}

Turn it on: POST /auth/company/seats

This call charges the company card at once: the plan and each add-on for the first month, the total the quote gave. It needs an Idempotency-Key header, up to 200 characters, and the key decides what a second call does:

The body names the person once: user_id for someone already in your company, or user for a new account.

Field Required Meaning
user_id one of the two an account of your company
user one of the two a new account: email (required), firstname, lastname, password (optional with a key)
group_id no one of your company’s user groups to put the person in
add_ons no nous_cloud, site_publishing, each once; leave out one the quote marks included

A new person is created in your company, approved at once, with no invitation and no email. A key may leave the password out. The seat starts all the same, and the person cannot sign in, Google included, until your company admin sets a password for them on the Users page of the company panel. Until then every seat answer carries "needs_password": true for them; it goes away by itself once a password is set. Share a password you do send over a channel you trust.

curl -s -X POST "$PLEXON/auth/company/seats" -H "Authorization: Bearer $COMPANY_KEY" \
  -H "Content-Type: application/json" -H "Idempotency-Key: seat-maria-1" \
  -d '{"user_id": "00000000-0000-4000-8000-0000000000d1", "add_ons": ["nous_cloud"]}'

The answer is seat, the seat as the list below describes it, and replayed:

json
{"seat": {"stripe_subscription_id": "sub_<Stripe id>",
          "user": {"id": "00000000-0000-4000-8000-0000000000d1", "email": "maria@example.com",
                   "firstname": "Maria", "lastname": "Papadopoulou"},
          "status": "active", "live": true, "add_ons": ["nous_cloud"],
          "monthly_usd": 50, "first_charge_usd": 50,
          "started_at": "<RFC3339 time>", "current_period_end": "<RFC3339 time>",
          "cancel_at_period_end": false, "actor": "key:00000000-0000-4000-8000-0000000000b9"},
 "replayed": false}

For a new person, send user instead of user_id:

json
{"user": {"email": "nikos@example.com", "firstname": "Nikos", "lastname": "Georgiou"},
 "group_id": "00000000-0000-4000-8000-0000000000e1", "add_ons": []}

When a call created the new person and was then refused, the person stays, in the group, and the refusal carries their user_id beside error, message and code. Name them by that user_id in the next call, so a second account is never made. After stripe_unavailable (503), send {"user_id": "<that id>"} in place of user with the same key, the same group and the same add-ons: the call may have reached Stripe, and the same key charges once. After any other refusal (the card was declined, say), send user_id with a new key.

With a cap set, the seats keys start this calendar month (UTC) may be charged at most the cap when they start. Renewals do not count, and neither do seats a signed-in admin starts. A call past it answers 402 seat_cap_reached and charges nothing, with cap_usd, started_this_month_usd and seat_usd (what this seat would have been charged) beside the error fields.

The seats: GET /auth/company/seats

No body. Answers {"seats": [...]}: every seat your company has paid for, ended ones included, the live ones first and each part newest first.

Field of a seat Meaning
stripe_subscription_id the seat’s subscription
user the person: id, email, firstname, lastname
status the subscription’s status, such as active, past_due or canceled
live the seat still pays for the person’s plan
add_ons the add-ons on the seat
monthly_usd what it costs a month now; 0 once it is set to end
first_charge_usd what it was charged when it started, tax included
started_at, ended_at when it started, and when it ended (absent while live)
current_period_end the end of the month already paid, when it renews or ends
cancel_at_period_end it ends at current_period_end instead of renewing
actor who turned it on: key: and a key’s id, user: and a person’s id, or plexon: and an id when Plexon did
needs_password present and true while the person has no password and cannot sign in

A failed renewal makes the seat past_due. The person keeps the plan for a few days of grace, as any subscriber does, and then loses it.

When a call is refused

Every refusal has the body under “Errors” below.

The quote checks less than the call. It refuses what the call refuses about the request itself: key access turned off, an unknown or repeated add-on, a group that is not your company’s, and a user_id that is not your company’s or whose account is disabled or not approved. It does not look at the rest. A person who already has a seat (seat_exists) or pays for Plexon themselves (already_subscribed) still gets a quote. An add-on they already hold reads included instead of being refused. No saved card answers "card": null, not no_card_on_file. The cap, the new person’s email and password, and whether website publishing can be set up for the person are not checked. The call itself refuses all of those, so a quote is not a promise that the call will go through.

error Status When What to do
seat_keys_off 403 key access to desktop seats is off for your company a company admin turns it on in the company panel
access_key_invalid 401 a user key, or a key that is unknown or revoked use the company key
idempotency_key_required 400 no Idempotency-Key header: “Send an Idempotency-Key header, a new one for each press.” send one, a new one for each press
invalid_add_on 400 an add-on that does not exist or is named twice: “Name each add-on once: nous_cloud, site_publishing.” fix add_ons
invalid_request 400 the body names nobody, or both user_id and user: “Name the person once: user_id for someone in the company, or user for a new account.” name the person once
not found 404 “That is not in your company, or it no longer exists.”: the user_id or the group_id is not your company’s, or no longer exists; also when the person’s account was deleted while the call ran (see below) check the id
that email address cannot be used 400 “That email address cannot be used.”: a new person’s email is an address Plexon reserves use another address
email and password are required 400 “Email and password are both required.”: a new person with no email, or, from a signed-in admin, with no password send what is missing
no_card_on_file 409 your company saved no card: “Save a card before turning on desktop access.” a company admin saves one under Company card
user_disabled 409 “This account is disabled or not approved. Enable and approve it before turning on desktop access.” a company admin enables and approves the account on the Users page
seat_exists 409 “This person already has desktop access paid by a company.” nothing to do; it is on
already_subscribed 409 “This person pays for Plexon themselves. They cancel their own plan first.” the person cancels their own plan, then call again
add_on_included 409 the person already has that add-on through the plan or a group (“Website publishing is already included for your account.” for a publishing grant) leave it out; the quote marks it included
conflict 409 “Website publishing is not set up for this account yet. Nothing was charged; contact us and we will sort it out.” leave site_publishing out, and write to Plexon
an account with this email already exists 409 a new person’s email already has a Plexon account send that account’s user_id if it is in your company
idempotency_key_reused 409 “This Idempotency-Key was already used for a different request. Send a new key.” send a new key
card_declined 402 “The card on file was declined. Save another card and try again.” a company admin saves another card; then call again with a new key
authentication_required 402 “The bank wants the card holder to approve this charge. Save the card again and try again.” a company admin saves the card again; then a new key
tax_location 402 “Stripe could not work out tax from the address saved with the card. Save the card again.” a company admin saves the card again; then a new key
payment_failed 402 “Stripe refused the charge. Try again, or save another card.” try again with a new key, or save another card
seat_cap_reached 402 the seat would pass your monthly cap on what keys start a company admin raises the cap, or turns the seat on in the company panel
stripe_unavailable 503 “Stripe did not answer. Send it again with the same Idempotency-Key.” The call may have reached Stripe send the same call again: the same key, the same body (for a person the call created, user_id in place of user)
plan_unavailable 503 “The plan cannot be bought yet.” try later
error 500 “Website publishing could not be checked for this account. Nothing was added; try again.” try again with a new key
internal_error 500 “Something went wrong on our side. Nothing was charged; try again.”, or “Something went wrong on our side. Try again.”, which charged nothing either try again with a new key
failed to create user 500 “Failed to create user.”: the new person could not be created; nothing was charged try again with a new key
seat_charged_not_recorded 500 “The card was charged, and saving the seat failed. Do not press again. The seat appears in the list within a minute; if it does not, contact Plexon.” The answer carries user_id and stripe_subscription_id do not send it again; read the list. The seat shows there within a minute; if it does not, write to Plexon
seat_started_not_read 500 “The seat was started but could not be read back. Reload the list to see it.”: the card was charged and the seat is saved, but the answer could not be built do not send it again; read the list, where the seat is

A new person’s password is checked against the password rules, and a password that fails them answers 400 with the rule in message.

What a refusal charged, and what to send next:

What a key cannot do here

A company key can quote, start and list seats. Turning a seat off, adding or removing an add-on on a running seat, saving or removing the card, and changing the switch or the cap all need a signed-in company admin, in the company panel. So a leaked key can spend at most the cap in a month. Without a cap it has no such limit, so set one when keys turn seats on.

An account’s own history

An account can read its own movements without the company key. This route is not under /auth/company/payg, and the company key cannot call it.

Its movements: GET /auth/billing/payg/ledger?limit=&cursor=&from=&to=&customer=

The account’s movements, newest first, one page at a time: the same rows “One account” answers your company, for the caller’s own account only. limit is 50 by default and at most 500. cursor, from, to and customer work as “Reading a history page by page” says. No parameter names the account: it is always the caller’s.

Caller Answer
the account’s user key its movements, while the account is on pay as you go
the account’s own sign-in its movements, on any plan
a company key 401 access_key_invalid

The answer carries ledger, this page of movements as “One account” describes them, and next_cursor, an empty string on the last page. Maria’s key, made under “An account’s user keys” above, read the two newest:

bash
curl -s "$PLEXON/auth/billing/payg/ledger?limit=2" -H "Authorization: Bearer $USER_KEY"
json
{"ledger": [
   {"id": 90433, "kind": "company", "amount": {"credits": 500, "usd": 5, "uc": 500000000},
    "pool": {"credits": 0, "usd": 0, "uc": 0}, "task": "", "note": "Company top-up: Monthly allowance",
    "customer": "", "group_id": "", "created_at": "<RFC3339 time>"},
   {"id": 90431, "kind": "company", "amount": {"credits": 2500, "usd": 25, "uc": 2500000000},
    "pool": {"credits": 0, "usd": 0, "uc": 0}, "task": "", "note": "Company top-up: November budget",
    "customer": "", "group_id": "", "created_at": "<RFC3339 time>"}],
 "next_cursor": "MTc2NDIzNjAxMjEyMzQ1Ni45MDQzMQ"}

$USER_KEY is the account’s user key. Errors: 400 invalid_cursor, 400 invalid_range and 400 invalid_customer (“Reading a history page by page”), 401 access_key_invalid (a company key, or a key that is unknown or revoked), 403 access_key_plan (a user key whose account is not on pay as you go, or also holds a subscription).

Money

A company holds two balances, and each account holds one.

A model call spends the account’s own credits first, then the pool.

What a credit is worth

One credit is one cent paid: at the default rate one US dollar buys 100 credits. The rate is credits_per_usd on the company answer. This page gives no price list, because prices change. Every sample shows what that call cost when it was run, and the metered block of your own answers is the figure to trust.

Amounts

Money in is amount_usd: a JSON number of US dollars with at most two decimals, such as 25 or 12.50. A string ("25") is refused.

Money out is an amount object, the same value three ways:

json
{"credits": 500, "usd": 5, "uc": 500000000}

credits is whole credits, rounded down. usd is dollars, rounded down to the cent. uc is the exact value in microcredits (one million to a credit). A single model call often costs less than one credit, so print individual movements from uc.

Below zero. A user balance can be negative: the last call before an account runs dry is completed and charged in full, so it can overdraw the account’s own credits by one call. The pool never goes below zero. An account below zero is refused until its own credits plus the pool are above zero again: the pool is not charged for the debt, it only has to be larger than it.

Amounts you move (a pool top-up, a top-up of one account, a top-up of every account, per account) are at least 1 USD. A start amount is 0, or at least 1 USD.

Idempotency

The three calls that move money take an Idempotency-Key header: the pool top-up, the top-up of one account and the top-up of every account. Mint one key per intended move, up to 200 characters, and send the same key again when you retry it.

Without the header a retried call moves the money again. Creating an account needs no Idempotency-Key: the same email twice answers 409 email_taken, the same handle twice answers 409 handle_taken, and neither moves anything.

Calls with no cost on the answer

Most answers state their cost in metered.cost_microcredits. A call to POST /api/v1/mcp carries none because it costs nothing. Three kinds of charged call carry no metered either: a summarizer answer, a stream cut off before its last events, and a call your side hung up on. (A chat turn that fails after the model began answering does send its metered event, just before the error event.) Their cost is in the account’s movements: page through GET /auth/company/payg/users/{id} back to the time of the call and find its debit. Do not work it out from the balance, which other calls move at the same time.

History

Model-call movements older than 90 days are removed from the account movements (an account’s own read of them included) and the pool usage, so paging back through either ends there. Balances are not affected, but a pool cannot be reconciled call by call past that date. Keep your own copy if you need longer. Company ledger rows are kept.

What a key cannot do

This API also does not have:

Errors

Every error has the same body, apart from the answers of the tools route that come from MCP itself, in JSON-RPC’s own shape or in plain text (its “Refusals” list them). Branch on error. message is a sentence written for whoever runs the integration, so it may say “top up” or “ask Plexon”: read it yourself before you show it to your own user. Some errors carry more fields beside these three: daily_limit_exceeded adds resets_at (an RFC 3339 time) and window (it reads 24h), and prompt_too_long adds limit and count. Ignore any you do not use. Match each key exactly as written, spaces included: internal_error and internal error are two keys, and so is not found.

json
{"error": "company_balance_insufficient", "message": "The company balance cannot cover this. Add funds first.", "code": 402}
error Status When What to do
unauthorized 401 no Authorization: Bearer header send the key
access_key_invalid 401 the key is unknown or revoked, a user key on the company API, a company key on GET /auth/billing/payg/ledger, or a user key whose account is disabled check it was copied whole; create a new one
handle_required 400 a company key on the model API with no X-Plexon-Handle header send the header with your own id for the user
invalid_cursor 400 a cursor the server did not give out, or one changed on the way send next_cursor exactly as it came, or leave cursor out to start from the newest
invalid_range 400 a from or to that is not an RFC 3339 time, or a from that is not before to send times like 2026-11-01T00:00:00Z
invalid_customer 400 an X-Plexon-Customer header or a customer= parameter outside the customer id’s shape fix the id
invalid_handle 400 an empty ?handle=, a handle over 128 characters, or one that holds a character other than ASCII letters, digits and . _ - : @ + (in a query string, a + not sent as %2B) fix the handle
payg_not_enabled 403 pay as you go is not on for your company ask Plexon
account_disabled 403 a company key’s call for an account that is disabled your company admin or Plexon can enable it
account_left_company 403 a company key’s call with a handle whose account is no longer in your company use a new handle for a new account
key_cannot_manage_keys 403 a company key on a key or card route sign in to the company panel
key_cannot_set_password 403 a company key sent password on create leave password out
access_key_plan 403 the account is not on pay as you go, or also holds a subscription use the account’s signed-in app, or ask Plexon
access_key_scope 403 a key on a model API route keys cannot call use one of the model routes above
feature_not_included 403 this kind of call is not offered on pay as you go right now: no model the route can charge for is serving it none
invalid_request 400 the body is not valid JSON (on POST /api/v1/mcp, MCP answers that itself) or is over 1 MB, an email is missing or is an address Plexon reserves, a name is over 100 characters, Idempotency-Key is over 200 characters, or a body to POST /api/v1/mcp is a JSON-RPC list instead of one message fix the request
invalid_amount 400 an amount that is missing, zero, negative, a string, has three decimals, is under the 1 USD minimum of a move (a start amount: 0, or at least 1 USD), or is above a limit send a number of dollars of at least 1, with at most two decimals
note_too_long 400 a note over 500 characters shorten it
invalid_group 400 group_id is not one of your company’s user groups check the id
weak_password 400 the password does not meet the password rules choose another
validation_error 400, 413 a model request the route cannot take, such as a chat body with no messages or no valid mode, a picture with an unknown aspect ratio, or a prompt, lyrics or text over its limit (a clip’s prompt answers prompt_too_long instead). 413 for a recording to transcribe over 32 MB read message
prompt_too_long 400 a clip’s prompt is over 7,000 characters shorten it
provider_rejected 400 the model refused the chat request as it was sent change what you sent
voice_unavailable 400 a song with use_my_voice, for an account with no cloned voice (a key cannot clone one) leave use_my_voice out
company_balance_insufficient 402 the reserve cannot cover the move; nothing moved fund the reserve first
credits_exhausted 402 own credits plus the pool cannot pay for this call; a picture, clip, reading or song costs more than is left (the message gives both figures); the account is below zero and its own credits plus the pool are not above zero (the message gives the debt; the pool is not charged for it, it only has to be larger); or a new handle met an empty pool (no account was made) top up the account or the pool by more than the price or the debt; for a new handle, fill the pool
account_not_found 404 a GET on the model API with a handle nobody has used; nothing was created check the handle; its first POST creates the account
group_not_found 404 an X-Plexon-Group that is not the id of one of your company’s user groups; nothing was created or charged check the id
context_window_exceeded 413 a chat conversation longer than the model can read at once condense it with a summarizer call, or start a new conversation
request_too_large 413 a body to POST /api/v1/mcp over 256 KB, measured after a gzip body is inflated split the plate into two calls
method_not_allowed 405 a GET or DELETE to /api/v1/mcp, which takes POST only; the answer carries Allow: POST send a POST
image_references_unavailable 422 reference pictures cannot be used right now; no picture was made call again without reference_images, and tell the person the picture is not based on their photos
not found 404 the account or key is not in your company, does not exist, or the account is not on pay as you go check the id
email_taken 409 an account with that email exists use another address
handle_taken 409 on create, the handle already names an account in your company (one that left it included) use another handle
not_payg 409 a top-up of a member who is not on pay as you go ask Plexon to turn it on for that account
idempotency_key_reused 409 the Idempotency-Key was used for a different move send a new key
credits_in_use 429 the account’s credits, or the company pool, are held by calls still running, or four pictures, clips, readings or songs of the account are already in flight; no Retry-After comes with it ask again when one of your own running calls for that account has finished; when your side runs none, wait a few seconds and try again; or top up
rate_limited 429 a key past 60 calls at once, refilled at 10 a second (600 a minute), to POST /api/v1/mcp; the answer carries Retry-After: 1 wait the seconds Retry-After gives, then send it again
daily_limit_exceeded 429 three pictures, or three clips, of the account ended with no result today (UTC), or the paid model failed and the backup model has used up its day; on the stream it is an error event with the same window and resets_at wait until resets_at (midnight UTC)
internal_error, internal error 500 the server could not finish; on a new handle, the account was not created and nothing was changed retry with the same Idempotency-Key, or the same handle
processing_failed 500, 429, 502, 503, 504, 529 the chat model failed or is busy: 500, or the busy status the model’s side gave; a 429 may carry Retry-After: 20 retry in a few minutes; branch on error, since a 429 is not always credits_in_use
api_error_summarizer 500, 429, 502, 503, 504, 529 a summarizer call failed, with the same statuses as processing_failed retry in a few minutes
model_unavailable 500, 429 the chat model cannot serve, and waiting will not change that: 500, or 429 when the model’s side answered 429 do not retry; write to Plexon
generation_failed 500 a chat call with plexon-1.0-image could not make the picture retry in a moment, or use /image
image_failed 500 the picture route cannot make pictures right now retry in a moment
video_failed 500 the clip route cannot make clips right now retry in a moment
music_failed 500 the song route cannot make songs right now retry in a moment
tts_failed 500 the speech could not be made retry in a moment
transcribe_failed 500 the recording could not be turned into text retry in a moment
credits_unavailable 503 the balance could not be read, or credits are not available on Plexon’s side right now retry in a moment
server_restarting 503 the server is updating; the answer carries Retry-After: 1 retry a second later

The 402 sentences on the model routes are the ones the Plexon app shows its own users. A picture, a clip, a reading or a song the balance cannot cover gives both figures: “This picture needs 6 credits and 1 is left. Buy credits to continue.”, “This clip needs 312 credits and 100 are left. Make it shorter, or buy credits to continue.”, “Reading this aloud needs 48 credits and 23 are left. Buy credits to continue.”, “This song needs 24 credits and 23 are left. Buy credits to continue.” An account with nothing to spend reads “You have no credits left. Buy credits to continue.” For your accounts, “buy credits” means a top-up from your company.

Limits

What Plexon keeps

Plexon is privacy-architected: the server stores no conversation. Each call carries the whole conversation, the models that answer it receive it, and once the answer is sent Plexon keeps neither your messages nor the reply. With web_tools, a search sends its query, and a link read sends the address, to a search service outside Plexon.

What it does keep is what a bill needs. For each charged call: the time, the account, the kind of call, the model that served it, the token counts and the cost, and the group and customer id your server sent with it. Beside those it keeps usage figures, added up per conversation: how long calls took, how many messages they carried, the names of any tools they used, and a session id and app version when the caller sends them. Never the text. A call that fails also leaves a row saying what failed: the route, the status, the sentence the caller was shown, and the error text the model’s side returned, which is how Plexon finds and fixes it.

The handle and the customer id are yours, and either may be personal data. Prefer ids that are not: a customer number tells Plexon nothing, an email address does.

If your company needs a data processing agreement, write to contact@plexon.ai and Plexon will send one.