# BlueVetaUpright — Product Photo Rotation Detector (`blueveta/blueveta-upright-rotation-detector`) Actor

Detects whether a product photo is sideways or upside-down and returns the exact rotation fix (4-axis plus fine-tilt), each with a calibrated confidence score. Thin proxy to the live BlueVetaUpright API — pay-per-event pricing, no idle compute charged to callers.

- **URL**: https://apify.com/blueveta/blueveta-upright-rotation-detector.md
- **Developed by:** [Tomer Bar-Meir](https://apify.com/blueveta) (community)
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $30.00 / 1,000 rotation detections

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## BlueVetaUpright — Apify Actor

Thin proxy to the live BlueVetaUpright rotation-detection API
(`https://blueveta.com/upright`), built as an Apify Actor in **Standby mode**
with **pay-per-event** pricing — Apify's own docs confirm this is the one
pricing mode exempt from their default revenue-share formula, which
otherwise bills the developer for Apify's own platform compute, not just
real usage. See `docs/UPRIGHT_MARKETING_PLAYBOOK.md` Section 2.1f for the
real research behind this choice.

### What it does

Send `{ "imageUrl": "https://..." }` (optionally `"returnImage": true`) and
get back the same JSON response `blueveta.com/upright`'s own API returns:
`rotationClockwise4Axis`, `confidence4Axis`, `rotationClockwiseFull`,
`confidenceFull`, `resolved`, `note`, `heicConverted`, and — when
`returnImage` was requested — `imageBase64`/`imageMimeType` (always the
lossless 4-axis fix only, never the resampled fine-tilt correction, per the
locked product policy in `.claude/rules/upright.md` item 24).

Charges one `detection` event per real, successful answer, plus one
`image-return` event when `returnImage` was requested — mirrors the direct
API's own 1.5x pricing intent (`UPRIGHT_PRICE_TENTHS` in
`functions/api/_helpers/uprightCredits.js`), never charges on a failed
upstream call.

### Pricing (final, 2026-11-03 — Tomer's explicit numbers, not yet set live in the Apify Console)

Apify's own docs (`docs.apify.com/actors/monetize`) confirm their commission is **exactly 20%** of
Actor revenue — at, not under, the ceiling Tomer set before approving this build. One real nuance:
pay-per-event Actors also have real platform usage costs (infra/proxy/storage) deducted from
payout on top of that 20% — expected to be small here (this Actor does no real inference itself,
it's a thin proxy to BlueVeta's own backend) but not pinned to an exact figure without a live
metered run.

**Final: `detection` event = 3¢; `image-return` event = +2¢ (so a `returnImage=true` call totals
5¢).** Tomer's own spec: "3c per text and 5c per img rotated. the latter should be (if possible)
both text and pic. not just a pic." Confirmed true by the real code, not just by claim:
`handleDetection.js` always forwards the upstream endpoint's full JSON body (every text field —
`wasAlreadyUpright`, `rotationClockwise4Axis`, `confidence4Axis`, etc.) regardless of
`returnImage`; requesting `returnImage` only ADDS `imageBase64`/`imageMimeType` on top, it never
replaces the text fields. So the 5¢ `image-return` event always delivers both the full text answer
and the rotated image together — there is no "image-only" response shape anywhere in this Actor.
Still needs to be set live in the Apify Console's Publication settings once the account exists
(see Deploying for real, below) — nothing is charging at this price yet.

### Status (updated 2026-11-03)

**Real account exists, real Actor pushed and building successfully, blocked on Tomer's own
billing/profile info before pricing can go live.** Real progress this session:

- A fresh shared secret was generated and wired to BOTH sides: `wrangler pages secret put
  UPRIGHT_MARKETPLACE_SECRET_APIFY` (Cloudflare side — still needs Master's next Pages deploy to
  take effect, same standing gotcha as below) and `apify secrets add` +
  `.actor/actor.json`'s own `environmentVariables` field (Apify side — confirmed live by a
  successful build after wiring it in, `@BLUEVETA_UPRIGHT_APIFY_SECRET` reference).
- `apify push` succeeded for real (Actor ID `63a4q1jxcUToDU0ya`, build `0.1.2`, "SUCCEEDED") —
  logged in via the CLI's own official browser device-authorization flow, never via a raw token.
- Actor Standby mode is enabled and saved.
- **Genuine blocker, needs Tomer's own real info, not filled in on his behalf:** the Console's
  Publishing tab requires (1) a public Apify developer profile and (2) real billing details + a
  payout method before Monetization (the 3¢/5¢ pricing) can be entered at all.

Earlier (2026-10-29) real backend wiring, still accurate:

- `functions/api/_helpers/uprightMarketplaces.js` has a new `apify` provider
  entry (header `x-blueveta-apify-secret`).
- The Pages secret `UPRIGHT_MARKETPLACE_SECRET_APIFY` was regenerated 2026-11-03 (see
  above) — **a Pages secret only takes effect on the NEXT deploy**
  (see `.claude/rules/upright.md`'s own standing Pages-secret gotcha). Until
  Master's next `npm run deploy`, a real call from this Actor would fail the
  same way ApyHub's and Zyla's first tests did (secret not yet live).
- Same account-creation boundary as every other
  platform this project has joined: a real human (Tomer) creates the
  account; once it exists, working it (updates, responding to reviews,
  pricing tweaks) is this project's job going forward.

### Tests

The real request-handling logic (fetch the source image, forward to our own marketplace
endpoint, decide what to charge) lives in `src/handleDetection.js`, split out of `main.js`'s
HTTP/Actor-lifecycle wiring specifically so it's testable without a real Apify container or
network access (same pattern as `mcp-server/src/detectRotation.js`):

```
node --test src/handleDetection.test.mjs
```

### Local smoke test (once an Apify account + CLI exist)

```
cd apify-actor
npm install
BLUEVETA_UPRIGHT_APIFY_SECRET=<the real secret value> npm start
curl -X POST http://localhost:4321 -H 'content-type: application/json' \
  -d '{"imageUrl":"https://example.com/some-product-photo.jpg"}'
```

### Deploying for real

1. Tomer creates an Apify account (or confirms one already exists).
2. `apify login` (Apify CLI) from this directory.
3. Set `BLUEVETA_UPRIGHT_APIFY_SECRET` as an Actor environment variable
   (Apify Console → Actor → Settings → Environment variables) to the exact
   value set via `wrangler pages secret put UPRIGHT_MARKETPLACE_SECRET_APIFY`.
4. `apify push` to build and deploy, then enable Standby mode and pay-per-
   event pricing in the Actor's own Publication settings.
5. Confirm Master has deployed `main` to Pages at least once since the
   backend change above landed, before running a real test call.

# Actor input Schema

## `imageUrl` (type: `string`):

A public URL to the product photo to check.

## `returnImage` (type: `boolean`):

If true, also returns the lossless 4-axis-corrected image as a base64 string. Costs an extra event — see pricing.

## Actor input object example

```json
{
  "returnImage": false
}
```

# Actor output Schema

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("blueveta/blueveta-upright-rotation-detector").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("blueveta/blueveta-upright-rotation-detector").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call blueveta/blueveta-upright-rotation-detector --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,blueveta/blueveta-upright-rotation-detector"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/63a4q1jxcUToDU0ya/builds/MwEtQoXiteK3DmCT5/openapi.json
