Skip to main content

TinyFish pass-through

The /tinyfish route forwards POST /v1/automation/run to the TinyFish Agent API, which drives a browser to complete a goal on a web page. The gateway holds the TinyFish key, checks the virtual key and records each run with its cost. Every other Agent API endpoint, such as vault, wallet, browser profiles and the run listing, is refused, because all gateway callers share one TinyFish account and must not see each other's runs.

A real-world scenario​

A pricing analyst asks a web agent to open competitor sites and read back plan names. Several analysts share one TinyFish account, so they call /tinyfish/v1/automation/run on the gateway with their own virtual keys. Each run is attributed and budgeted per analyst, the TinyFish key stays on the gateway, and nobody can browse another analyst's runs or saved credentials.

Before you start​

The gateway needs a TinyFish credential. It looks first for a model_list deployment of provider TinyFish with use_in_pass_through: true, then for the environment below.

VariablePurpose
TINYFISH_API_KEYThe TinyFish key the gateway sends upstream.
TINYFISH_ALLOW_AUTHENTICATED_RUNSOptional. Set to true to allow runs that use the shared account's saved browser profiles and vault entries. Off by default.

Steps​

  1. Give the gateway the credential. Set TINYFISH_API_KEY in the gateway environment and restart, or add a deployment to the config file.

    model_list:
    - model_name: tinyfish-agent
    spanway_params:
    model: tinyfish/agent
    api_key: os.environ/TINYFISH_API_KEY
    use_in_pass_through: true
  2. Issue a virtual key on /ui/api-keys with + Create New Key, then Create Key.

  3. Run a task through the gateway.

    curl -X POST http://localhost:4000/tinyfish/v1/automation/run \
    -H "Authorization: Bearer $SPANWAY_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"url": "https://example.com", "goal": "Find the pricing page and return the plan names."}'
  4. Open /ui/logs and click the newest row to see the run, the key and its cost.

Expected result​

TinyFish's own response, with its status code and headers.

{"run_id": "run_3f9a", "status": "COMPLETED", "result": {"plans": ["Starter", "Team", "Enterprise"]}}

The spend log row carries the key, team and user and the per-run cost from the bundled TinyFish prices.

Errors​

StatusMessageWhat it means and how to fix it
401Authentication Error, Invalid proxy server token passedThe virtual key is missing, wrong, expired or blocked.
403Key/team denied access to passthrough route /tinyfish/...The key or team lists the route in denied_passthrough_routes. The message goes on with Matched <pattern> in denied_passthrough_routes, naming the pattern to remove from the key or team.
403GET /v1/vault is not an allowed TinyFish Agent passthrough endpoint. Only POST /v1/automation/run is served.Only runs are served. Use /v1/automation/run.
403Request fields [...] run with the shared TinyFish account's saved ...The body uses saved browser profiles or vault entries. Remove those fields, or have the operator set TINYFISH_ALLOW_AUTHENTICATED_RUNS=true.
400TinyFish requests must be a JSON object body sent with Content-Type: application/json.The body is not a JSON object.
400Request fields [...] are Spanway pass-through envelope controls ...The body uses field names the gateway reserves. Rename them.
401TinyFish API key not found. Set the TINYFISH_API_KEY environment variable or add a tinyfish deployment with use_in_pass_through.The gateway has no TinyFish credential.
Any otherTinyFish's own error bodyTinyFish refused the run. The message is returned unchanged.

Pass-through endpoints lists every built-in route. Agent governance explains how agent runs are tracked across the gateway.