📷 Photography · astrophotography exposure

Star Trail Calculator

Lovable AI computes exposure math so you capture the milky way; one x402 call through Anyway SuperAPI buys the signal it needs.

Anyway SuperAPI Call· pay-per-call data
Section · Anyway

The kernel.

full primer →

Astrophotography exposure gets live outside signal: a server function discovers the right API in the Anyway SuperAPI directory, pays for the call in USDC, and photographers read a real answer instead of a guess.

Why this primitiveAnyway SuperAPI is the fastest path to live signal for astrophotography exposure in Photography — 60+ paid APIs behind one x402 interface, settled per call in USDC, no vendor keys.

Kernel
an x402 paid API call through Anyway SuperAPI — discover with `GET https://marketplace-prod.anyway.sh/v1/api/directory`, read the endpoint from `/v1/api/info/{upstream_id}`, then call the `curl_x402` URL and settle in USDC from an Agent Wallet (60+ APIs: web search, social, crypto, markets, AI — no per-vendor keys)
Drives the UI as
a topic box that returns live, paid-for results the user can read, cite or drop into the work
Appendix · Secrets

Required key.

ANYWAY_AGENT_WALLET_KEY
Agent Wallet Key — lets the build pay x402 SuperAPI calls in USDC under a spending policy you set once.
open ↗
ANYWAY_API_KEY
Business API key for payment links, orders and Agent Traces. Only needed for those kernels.
open ↗

Add this in your Lovable project under Settings → Secrets before pasting the prompt below.

Appendix · Mega-prompt

The build prompt.

Paste into a fresh Lovable project. Make sure the key above is set first. read the build strategy →

Build "Star Trail Calculator" as a ONE-SHOT Lovable build. The participant has only
5 credits — this single message must produce a working demo with no follow-ups.
Single-page TanStack Start app. Cut scope ruthlessly.

CONCEPT
Lovable AI computes exposure math so you capture the milky way; one x402 call through Anyway SuperAPI buys the signal it needs.
Discipline: Photography (astrophotography exposure).
Recipe: Anyway SuperAPI Call (pay-per-call data) as the single creative surface.
Why this kernel: Anyway SuperAPI is the fastest path to live signal for astrophotography exposure in Photography — 60+ paid APIs behind one x402 interface, settled per call in USDC, no vendor keys.

LOVABLE BUDGET (HARD CAP: ONE-SHOT, ~5 CREDITS TOTAL):
The participant has FIVE Lovable credits for the whole build. This prompt MUST
ship a working demo on the FIRST message with zero follow-ups. Engineer for that.
- ONE TanStack Start app, ONE route (`src/routes/index.tsx`). No extra pages, no auth, no nav.
- ONE TanStack server function in `src/lib/anyway.functions.ts` that proxies the Anyway call.
- ONE client surface (a textarea + button, a wallet panel, or a pay button) wired to it.
- NO database, NO Lovable Cloud, NO auth, NO file uploads, NO extra integrations.
- NO tests, NO docs pages, NO settings screens, NO theming toggles.
- Libraries: template defaults + `zod`. Nothing else.
- Keep the diff small enough to land in one build pass. If a feature is not on
  screen in the user flow below, do not build it. Cut scope before adding scope.

STACK
- TanStack Start app, the index route only.
- Anyway is the only paid dependency. Every Anyway call lives inside a
  `createServerFn` handler so the keys stay on the server.
- Client surface fits the kernel: a topic box that returns live, paid-for results the user can read, cite or drop into the work.
- Tailwind + shadcn. Editorial look: gold accent on a dark or warm-cream
  background, generous type, one strong headline, one primary action.
- Footer renders: "Built during the Anyway Creative Hackathon organised by StreetKode Fam during Indian Krump Festival 14".

SERVER FUNCTION (src/lib/anyway.functions.ts) — Anyway SuperAPI, real x402 paid call:
```ts
import { createServerFn } from "@tanstack/react-start";
import { z } from "zod";

/** Built during the Anyway Creative Hackathon organised by StreetKode Fam during Indian Krump Festival 14 */
export const runSuperApi = createServerFn({ method: "POST" })
  .inputValidator((d) => z.object({ query: z.string().min(1).max(400) }).parse(d))
  .handler(async ({ data }) => {
    // Server-only signing lives in a *.server.ts sibling, imported inside the handler.
    const { payX402 } = await import("./anyway-wallet.server");

    // 1. DISCOVER — the directory is the source of truth, never hardcode an endpoint.
    const dir = await (await fetch("https://marketplace-prod.anyway.sh/v1/api/directory")).json();
    const upstreamId = dir[0].id; // pick the upstream that fits astrophotography exposure

    // 2. INFO — read the callable x402 URL + per-call price.
    const info = await (await fetch(
      `https://marketplace-prod.anyway.sh/v1/api/info/${upstreamId}`,
    )).json();
    const url = `${info.endpoints[0].curl_x402}`.match(/https?:\/\/\S+/)?.[0] ?? "";

    // 3. PAY & CALL — challenge → wallet-signed EIP-3009 → retry → settled response.
    //    maxAtomic is a hard spend cap in USDC atomic units (10_000 = $0.01).
    return payX402({
      url,
      method: "POST",
      body: JSON.stringify({ q: data.query }),
      maxAtomic: 10_000,
    });
  });
```

`payX402` (src/lib/anyway-wallet.server.ts) — the flow that actually settles:
```ts
// 1) unpaid request → 402 + base64 PAYMENT-REQUIRED header
const challenge = JSON.parse(atob(res.headers.get("PAYMENT-REQUIRED")!));
const accepted = challenge.accepts[0]; // { amount, asset, payTo, network: "eip155:8453", extra }

// 2) build EIP-3009 TransferWithAuthorization typed data for the agent wallet
//    domain: { name: extra.name, version: extra.version, chainId: 8453, verifyingContract: accepted.asset }
//    message: { from: walletAddress, to: accepted.payTo, value: accepted.amount,
//               validAfter: "0", validBefore: now + maxTimeoutSeconds, nonce: random bytes32 }

// 3) have the Agent Wallet sign it — P-256 signed request to
//    POST https://api.anyway.sh/v1/agent-wallet/sign-typed-data
//    headers: X-Agent-Pubkey / X-Agent-Timestamp / X-Agent-Signature
//    (signature = base64 DER ECDSA over `${method}\n/v1/agent-wallet/sign-typed-data\n${ts}`)

// 4) retry with the x402 v2 envelope, base64 in the PAYMENT-SIGNATURE header
const envelope = { x402Version: 2, scheme: accepted.scheme, network: accepted.network,
                   accepted, payload: { signature, authorization } };
// → 200 with the real payload; PAYMENT-RESPONSE carries the settlement/tx info.
```

Secret: `ANYWAY_AGENT_WALLET_KEY` (base64 key bundle → P-256 private key), read
inside `.handler()` only. Credits are spent first, wallet USDC is the fallback.

CLIENT (in `src/routes/index.tsx`): a query input + "Pay & run" button, a flow
log showing challenge → sign → retry → settle, the USDC amount and the response
JSON. Disable the button above your spend cap.

Docs: https://docs.anyway.sh/features/super-api

USER FLOW (the entire app — nothing else exists)
1. Land on the page; the headline previews what the demo does for astrophotography exposure.
2. The primary action (a topic box that returns live, paid-for results the user can read, cite or drop into the work) is one tap away; the rest of the layout supports it.
3. Anyway runs the kernel server-side, the result lands on screen, the user can retry or copy.

KEYS — Anyway secrets (server-side only, never `VITE_`):
1. `ANYWAY_AGENT_WALLET_KEY` — the Agent Wallet Key from
   https://app.anyway.sh/wallets?view=agent (or `anyway login --agent-wallet`).
   Lets the agent pay x402 endpoints in USDC under an owner-set spending policy.
2. `ANYWAY_API_KEY` — the Agent Traces key from Business profile -> Developers.
   Only needed if the build reports traces to https://collector.anyway.sh.
Put them in Project Settings -> Secrets and read them only inside a
`createServerFn` `.handler()` via `process.env.ANYWAY_...`.

CREDIT (must appear in UI footer AND as JSDoc on the server function):
Built during the Anyway Creative Hackathon organised by StreetKode Fam during Indian Krump Festival 14
Appendix · Market

Market sizing.

TAM
$2.4B
global photo software market
SAM
$120M
astronomy photography tools
SOM
$4M
night sky planning apps

Indicative figures for hackathon pitches — refine with your own research before raising.

See also

Adjacent entries.