Skip to content

[DEV-2189] Document the Decisions REST endpoint — hold merge - #318

Open
Arpanexe wants to merge 4 commits into
masterfrom
feature/DEV-2189-decisions-docs
Open

Arpanexe wants to merge 4 commits into
masterfrom
feature/DEV-2189-decisions-docs

Conversation

@Arpanexe

@Arpanexe Arpanexe commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Hold merge. Publish only when we choose to (per Tony, the API can ship before the docs). Pricing is still provisional. API PR: Fliplet/fliplet-api#8775.

Product areas affected

Developer docs: docs/REST-API/fliplet-ai.md, docs/API/core/ai/models.md.

What does this PR do?

Documents POST /v1/apps/:app/ai/decisions:

  • request fields and the three question types
  • a curl example
  • an illustrative response, plus how to read refusals, fractional scores and boolean choices
  • credits (input-only, failures not charged)
  • an error/status table and retry rules

It's REST only, with no Fliplet.AI wrapper, and pricing is marked provisional. OpenAI's rates (2× over 272K input tokens, +10% for regional processing) are noted. Also adds a "Decisions models" section (gpt-6-luna only, no fallback) to the model catalog.

JIRA ticket

DEV-2189

Result

Every status code and error type in the docs was checked against the API branch and against real local calls (the usage example matches what OpenAI actually returns).

Deployment instructions

None. Hold merge until we decide to publish (see top).

Author concerns

The curl example uses the production host. The earlier staging-host note is gone now that the endpoint isn't staging-only.

🤖 Generated with Claude Code

Adds POST /v1/apps/:app/ai/decisions to the app AI REST reference and a
Decisions models section to the model catalog. Marked internal staging
trial, REST-only, no customer production availability.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Deploying fliplet-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7187d0f
Status: ✅  Deploy successful!
Preview URL: https://0d79851c.fliplet-cli.pages.dev
Branch Preview URL: https://feature-dev-2189-decisions-d.fliplet-cli.pages.dev

View logs

Comment thread docs/API/core/ai/models.md Outdated

### Decisions models

[POST /v1/apps/:app/ai/decisions](/REST-API/fliplet-ai#decisions) accepts only the ID below. It is an internal trial on staging, available through REST only, with no JavaScript method.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really going to be limited to staging? I'm happy with it being available on production too.

@tonytlwu tonytlwu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review (via /fliplet-pr-review)

Requested documentation clarification: question names are optional.

Review basis: subject=5b3dbc415b3519dd667f372a67912dc43cd4bae7 standards=fliplet-engineering@0.18.0 revision=d8c727a0419f9d87a6e38a767a4b95b84380cc44+dirty source=fliplet-pr-review digest=sha256:40c49b60a8bd5384

Comment thread docs/REST-API/fliplet-ai.md Outdated
| --- | --- | --- |
| `model` | Yes | Must be `gpt-6-luna`. Fliplet rejects a missing or different model with `400` and has no fallback. |
| `input` | Yes | Shared evidence: a string, or user messages containing text and inline base64 image data URLs. OpenAI rejects non-user roles, tools, audio, files and hosted image URLs. |
| `questions` | Yes | Array of questions, each with `type`, `instructions` and `name`. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name is optional in OpenAI's Decisions contract. This table currently makes it appear required, although the response section correctly documents name: null for unnamed questions. Please make the optionality explicit; no Fliplet validation rule is needed.

Suggested change
| `questions` | Yes | Array of questions, each with `type`, `instructions` and `name`. |
| `questions` | Yes | Array of questions, each with `type`, `instructions` and optional `name`. |

Reference: https://developers.openai.com/api/reference/resources/decisions/methods/create

Copy link
Copy Markdown
Contributor

Accepted documentation clarifications from Tony for DEV-2189:

Billing: retain input-only Decisions billing, matching this endpoint's provider pricing. Please qualify the current blanket claim that every successful call is charged. Suggested wording:

“For apps subject to AI credit metering, Decisions charges are calculated from input tokens only. Failed or timed-out requests are not charged. Existing V2 metering rules remain unchanged.”

Do not present an HTTP 200 as proof that deferred credit settlement has completed. Missing provider usage or accounting failures remain observable engineering exceptions; the public reference does not need queue implementation details.

Retry guidance: replace “don't retry 4xx errors without changing the request” with guidance specific to the outcome:

  • Invalid payload/model (400): correct the request before retrying.
  • Authentication/access (401/403): restore valid credentials or permissions first.
  • Insufficient credits (402): restore credit capacity first; the same payload can then be resent.
  • Rate limit (429): wait/back off and resend the same payload; honour Retry-After if supplied.
  • Provider unavailable/timeout (502/504): retry cautiously after a delay. A retry is a separate request, and a timeout does not prove provider processing stopped.

Production API availability is accepted independently of documentation publication. Keep this docs PR unpublished until publication is chosen, but update its staging-only availability wording to match the intended production API release. The optional question-name correction is already captured in the inline comment; no need to duplicate it.

Arpanexe and others added 2 commits October 13, 2026 16:30
The endpoint is now available through REST (still no Fliplet.AI wrapper).
Pricing stays marked as provisional.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Arpanexe Arpanexe changed the title [DEV-2189] Document the Decisions REST endpoint (internal trial) — hold merge [DEV-2189] Document the Decisions REST endpoint — hold merge Oct 13, 2026

Copy link
Copy Markdown
Contributor

Tony has agreed the following consumer-facing billing wording. Please replace the current blanket claims that every successful call/every caller is charged in docs/REST-API/fliplet-ai.md (Decisions → Credits) with:

Successful requests are subject to input-token credit charges under the app’s applicable metering rules. Failed or timed-out requests are not charged.

Retain the credit precheck / 402 explanation and provisional-pricing note. Missing-usage and accounting-failure handling should remain in internal engineering documentation; the public API reference does not need those implementation details.

This updates the billing wording requested in the earlier review comment. The optional question name and error-specific retry corrections in the existing comments still apply. Documentation publication remains a separate decision; keep the merge hold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants