# List a Pi Coding Agent Service on OpenAny

This guide is for [Pi Coding Agent](https://pi.dev/), the `pi` CLI. Give it this guide and send the following instruction.

> Follow this guide to list my service as an OpenAny Service. Use the wording in "Fixed replies" for each reply. First check for the OpenAny CLI and install it if needed. Then confirm which Pi Skill will run the service, what it will do for buyers, and what it will deliver. Once I confirm, read the Service resource template and confirm each detail with me, including every optional field. Submit all service information to OpenAny in English. Tell me what the service endpoints require so I can configure them myself. Wait for my confirmation before checking external HTTPS connectivity. Use the CLI for all OpenAny sign-in, configuration, verification, and publication. Do not sign in to the web Seller Console.

## Fixed replies

Follow the Provider Skill's seller terminology, grouped questions, listing confirmation checklist, and receipt-based summaries. Show only the current stage in each reply. Keep working when there is no change to report and avoid repeating the same status. Keep CLI commands, raw JSON, internal fields, logs, and debugging details in the execution process. Hide tool output when the tool supports it. Use seller terms such as "connection," "API key," and "service endpoint." Replace each placeholder with verified information.

**When the user needs to act**, use these three lines. Ask about one group of missing details at a time, usually 1 to 3 items. Reuse confirmed answers and keep optional fields that still need confirmation pending. Give each free-text question a short example marked for reference only. When a suitable form is available, show it once and avoid repeating the questions in chat. For endpoint setup, attach only the endpoint requirements for the selected delivery mode beneath the second line.

> Current progress: {stage and verified result}.  
> Please {confirm or complete the current action}.  
> Then I will {next action}.

When first collecting information, use "Please confirm which Pi Skill will run the service, what it will do for buyers, and what it will deliver." If sign-in is needed, ask for the email address and verification code in separate turns. Use the Provider Skill's email prompt "Please enter your sign-in email address. If this email address is unregistered, the system will create an account automatically." For the code, use "Please enter the 6-digit code sent to your email."

**When confirming the listing**, show the applicable items in the Provider Skill checklist order. Ask where to stop only under "This operation," with the options "Create a draft only" and "Publish after verification passes." If live verification is needed, include the verified test input, number of runs, and possible cost.

> Service name: {English name}  
> Listing type and category: {type and category}  
> Buyer provides: {inputs and limits}  
> Buyer receives: {deliverables, delivery mode, and usage instructions}  
> Result example: {confirmed public example}  
> Pricing: {amount, currency, billing unit, and charge conditions}  
> Service connection: {name and HTTPS address}  
> This operation: {ask the user to choose or show the authorized stopping point}

**When finishing or blocked**, state the business outcome in one sentence, then list the relevant receipts and statuses. Include only applicable items. Report draft, verification, publication, and runtime synchronization separately, based on their receipts. Add the final line only when another action is needed.

> {Completed outcome, or unfinished stage and specific reason}.  
> Records: {relevant IDs, verified statuses, and a safe-to-share error code}.  
> Next step: {who does what}.

## 1. Check for the OpenAny CLI and install it if needed

Start with `command -v openany`. If the CLI is installed, run `openany --version` and `openany --help` to confirm it works and targets the production backend at `https://openany.si`. If it is missing, check `node --version` and `npm --version`. With Node.js 22 or later and npm available, install and verify the CLI.

```bash
npm install -g openany-cli@latest --registry=https://registry.npmjs.org/
openany --version
openany --help
```

If installation or execution fails, tell the user what is missing or report the error. Continue once the issue is resolved. Use this production CLI for all subsequent OpenAny operations.

## 2. Confirm the Skill and service before collecting listing details

**First confirm which Pi Skill will fulfill the service and what the buyer will receive.** Ask the user to confirm the Skill name or ID, what work it will do for buyers, and what it will deliver. If several Skills could fit, describe the service each can provide and ask the user to choose. If the Skill or deliverable remains unclear, ask for the missing details. Read the Service resource template and collect listing details once the user has confirmed the Skill and the service. Check the confirmed skill's `SKILL.md` and whether Pi can discover it from the intended service workspace or load it by explicit path. If the skill has runtime or tool dependencies, agree on them with the user before promising the service. [Pi Skills documentation](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/skills.md)

Reuse a valid OpenAny email session. If sign-in is required, confirm the user's email address, run `openany auth email send --email EMAIL_ADDRESS -j`, and verify the code for that same sign-in with `openany auth email verify --code SIX_DIGITS -j`. If the CLI requires human verification, have the user complete the original challenge and then continue signing in through the CLI. If several sellers are available, ask the user to choose one. Replace `APPLICATION_ID` with the selected seller's ID.

```bash
openany seller applications list -j
openany seller imports template --type service -j
openany seller schema --type api --application APPLICATION_ID -j
openany seller categories list --type tools -j
```

Prepare listing information using the current **Service resource template**, including its `templateGuide`, `fieldGuide`, and example entry. Check listing content, enabled categories, pricing and billing units, buyer inputs and request mappings, delivery mode, timeout, output format, and examples. Identify the conditional fields for the confirmed delivery and billing modes. When creating a draft directly, use the CLI's API schema to map template fields to the fields accepted by the create command.

- **Required fields** must be confirmed with the user whenever information is missing or unclear. Template examples illustrate the expected format.
- **Optional fields** also require individual confirmation. You can ask about them in one checklist. Explain what each field does, when it applies, and any default defined by the template. Ask the user to supply a value, accept the template default, or explicitly confirm that the field should be left blank or is inapplicable. Keep unanswered items pending. Preserve explicitly confirmed values such as `false` and `0`.
- **Submit all service information in English.** Use English for the listing name, summary, details, usage instructions, parameter and delivery descriptions, connection name, and seller-authored text in public request and response examples. If the user provides materials in another language, draft an English version and ask them to confirm it. Preserve field names, category IDs, paths, and enum values as defined by the template and the actual API.

Recommend a delivery mode based on the longest expected completion time confirmed by the user. Ask the user to confirm the mode and task timeout. Allow time for execution, packaging, and delivery.

- **10 minutes or less.** Recommend polling. This requires an authenticated HTTPS status endpoint.
- **More than 10 minutes.** Recommend webhook callbacks. This requires the seller's OpenAny Seller Key in the execution environment.

## 3. Give the user the endpoint requirements

Pi explains the requirements. The user configures the Pi runtime, service adapter, authentication, domain, and HTTPS. Use a user-managed HTTPS adapter as the public endpoint and run Pi privately behind it. When the setup is ready, ask the user to confirm the HTTPS base URL, actual submission path, polling path if applicable, and a lightweight probe.

**Pi execution.** Check `pi --version` and `pi --help` in the intended runtime. The adapter should launch a fresh Pi process per job in an isolated working directory, use a server-selected model and Skill, and limit tools and credentials to what the service needs. Pass validated buyer fields as data. Keep the executable, runtime options, Skill path, and environment under server control. The following manual smoke test is for a self-contained Skill that needs no tools. Replace the example path with the reviewed `SKILL.md`. Pi includes that file in the initial prompt and uses the model configured for the service runtime.

```bash
pi --print --no-session --no-tools --no-extensions --no-mcp --no-skills \
  @/absolute/path/to/SKILL.md \
  'Follow the attached skill instructions for this sample input: Hello.'
```

For a Skill that requires tools, configure only the tools it needs and enforce host-level isolation separately. Keep Pi model credentials private to the worker. In print mode the adapter captures the final text from stdout, checks process failure and timeout, and converts a successful result into the listing's output format. A probe of the HTTPS endpoint does not invoke Pi. [Pi CLI documentation](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/cli.md)

**Service Bearer Token.** The user configures the token on the service. The submission and polling endpoints must validate `Authorization: Bearer <TOKEN>`. Ask the user to save the same token to **`~/.pi/secrets/openany-service-token`**. The `~` refers to the home directory of the account running Pi for the listing workflow. Store the raw token as one line of plain text, with no `Bearer ` prefix or quotation marks. Set the file permissions to `600` and ensure the Pi execution account can read it. The user only needs to confirm that the file is ready. Pi checks and reads the file itself to probe the service and create the connection. If the file is missing, empty, or unreadable, report only the path and issue and ask the user to fix it before continuing. Keep credentials out of chat and logs. The service Token authenticates incoming requests. Model credentials are for Pi execution, and the Seller Key is for result callbacks.

**Task submission endpoint.** Expose a publicly reachable HTTPS `POST` endpoint, such as `/run`, protected by the dedicated service Bearer Token. The adapter invokes the confirmed Pi Skill through the private worker. For asynchronous submissions, read the outer `task_id`, `deadline_at`, and `output_contract`, then decode the buyer's JSON from `input.body`. Persist and deduplicate submissions by the outer `task_id`, promptly return HTTP `200` with `{"accepted":true}`, and execute the task afterward. Provide a lightweight probe for the actual submission path. For example, after authentication, return HTTP `200` for the exact request body `{"openany_webhook_probe":true}` without creating a task or sending a callback.

**Polling delivery.** Use `executionMode: "async"`, `adapter_type: "webhook"`, and `delivery_mode: "poll"`. Here, `webhook` identifies the submission adapter. Expose `GET /v1/jobs/{task_id}` using the same authentication as the submission endpoint. This endpoint only reads the original task. Return HTTP `200` for accepted tasks with the appropriate JSON body.

- In progress `{"status":"running"}`
- Completed `{"status":"succeeded","result":{"summary":"Task completed."}}`
- Failed `{"status":"failed"}`

**Webhook callback delivery.** Use `executionMode: "async"`, `adapter_type: "webhook"`, and `delivery_mode: "callback"`. The user securely provides that seller's production Seller Key in the execution environment, for example as `OPENANY_SELLER_KEY`. Use the outer platform task UUID to check that the supplied `callback_url` matches `https://api.openany.si/v1/agent-api-tasks/<TASK_ID>/result`. If it matches, send a JSON `POST` to that URL before the deadline with `Authorization: Bearer <SELLER_KEY>`. On success, send `{"status":"completed","result":{"summary":"Task completed."}}`. On failure, send `{"status":"failed","error_code":"SELLER_EXECUTION_FAILED"}`. Record delivery once the response is HTTP `200` with `accepted: true`. Polling and synchronous delivery do not require a Seller Key.

## 4. Check HTTPS connectivity from an external network

After the user confirms the setup, check the domain, TLS certificate, and actual routes from a network outside the service host. If a probe without a token returns `401` or `403`, read the designated token file and run a lightweight authenticated probe against the actual submission path. If the authenticated probe still returns `401` or `403`, ask the user to check that the token configured on the service matches the one in the file. Create the connection once authentication passes. For polling, also probe the status endpoint with the same token. Use a known test task or a valid UUID that produces an explicit task-not-found response. A generic `404` does not establish that the status endpoint is working. Connectivity checks can finish without invoking a model, running a Skill, or executing a full task.

Use the command below if the user configured the example probe. Set `SERVICE_ORIGIN` to the actual public HTTPS base URL and replace the example submission path. Keep shell tracing disabled while running it.

```bash
(
  token_file=~/.pi/secrets/openany-service-token
  service_token=$(<"$token_file") || exit 1
  if [[ -z "$service_token" || "$service_token" == *$'\n'* || "$service_token" == *$'\r'* ]]; then
    printf 'Token file must contain one line with the raw token: %s\n' "$token_file" >&2
    exit 1
  fi
  printf 'Authorization: Bearer %s\n' "$service_token" | \
    curl --header @- --silent --show-error --connect-timeout 5 --max-time 10 \
      --output /dev/null --write-out '%{http_code}\n' \
      --header 'Content-Type: application/json' \
      --data '{"openany_webhook_probe":true}' "$SERVICE_ORIGIN/run"
)
```

**Pause the listing process if public HTTPS is missing, the certificate is invalid, a route is unreachable, or an endpoint required by the chosen delivery mode is missing.** Explain the issue and recheck after the user fixes it. Keep certificate validation enabled. Record the domain, paths, and probe results. Keep credentials out of chat, listing JSON, examples, and logs.

## 5. Create a connection and listing draft through the CLI

Once HTTPS and authentication checks pass and all details are confirmed, show the user the English service information, price, delivery mode, timeout, and verification input. Ask them to choose **Create a draft only** or **Publish after verification passes**. Confirm that the submission text is in English. Then create a new OpenAny connection for the selected seller using the service token that passed the probe.

Prepare `connection.json` from the schema with the connection name in `label`, the verified HTTPS base URL in `baseUrl`, and `authType: "Authorization"`. Pass the same token file that passed the probe to the CLI via `--stdin`. Store only non-secret fields in the connection file. Prepare `api.json` using the confirmed template details and the API schema. Set `connectionId` to the new connection ID returned by the CLI. Include `catalogType: "service"`, the buyer-facing `pathTemplate`, the actual submission path in `servicePathTemplate`, buyer field mappings, and delivery configuration.

```bash
openany seller schema --type connection --application APPLICATION_ID -j
openany seller connections create --application APPLICATION_ID --file connection.json \
  --stdin --operation pi-connection-create -j < ~/.pi/secrets/openany-service-token
# Set connectionId in api.json to the new connection ID before running the next command.
openany seller apis create --application APPLICATION_ID --file api.json --operation pi-service-create -j
```

Use a unique operation name for each new write. If the outcome is unclear, read back the saved state or resume with the original operation name and input. Record the listing ID, listing revision, and connection revision. For a draft-only request, report the draft ID and stop.

## 6. Verify and publish

Continue only if the user chose publication after verification. Save the approved public test request as a separate entry in `config.samples[]`. In `verification.json`, set the current `expectedRevision`, `expectedConnectionRevision`, and `request`. Put the buyer's JSON in `request.body`.

```bash
openany seller apis verify --application APPLICATION_ID --id API_ID --file verification.json --operation pi-service-verify -j
openany seller apis get --application APPLICATION_ID --id API_ID --verification-id VERIFICATION_ID -j
```

If asynchronous verification is still running, query the original verification ID until it finishes or reaches its deadline. Confirm the receipt shows `state: "passed"` and `stale: false`, refers to the same listing and connection, and confirms OpenAny received the agreed result. Read back the example to confirm the sanitized actual response was saved and the public example text is in English. If changes are needed, ask the user to confirm the public English example before proceeding. Once the seller is `live` and the current listing meets the publication requirements, set the latest `expectedRevision` and `expectedConnectionRevision` and the passing `verificationId` in `publication.json`.

```bash
openany seller apis publish --application APPLICATION_ID --id API_ID --file publication.json --operation pi-service-publish -j
openany seller apis get --application APPLICATION_ID --id API_ID -j
```

Report HTTPS connectivity, delivery mode, listing ID, verification outcome, publication status, and runtime synchronization status. If a step fails, keep the existing draft and receipts and tell the user what blocked progress.
