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.
| Variable | Purpose |
|---|---|
TINYFISH_API_KEY | The TinyFish key the gateway sends upstream. |
TINYFISH_ALLOW_AUTHENTICATED_RUNS | Optional. Set to true to allow runs that use the shared account's saved browser profiles and vault entries. Off by default. |
Steps
-
Give the gateway the credential. Set
TINYFISH_API_KEYin the gateway environment and restart, or add a deployment to the config file.model_list:- model_name: tinyfish-agentspanway_params:model: tinyfish/agentapi_key: os.environ/TINYFISH_API_KEYuse_in_pass_through: true -
Issue a virtual key on
/ui/api-keyswith + Create New Key, then Create Key. -
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."}' -
Open
/ui/logsand 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
| Status | Message | What it means and how to fix it |
|---|---|---|
401 | Authentication Error, Invalid proxy server token passed | The virtual key is missing, wrong, expired or blocked. |
403 | Key/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. |
403 | GET /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. |
403 | Request 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. |
400 | TinyFish requests must be a JSON object body sent with Content-Type: application/json. | The body is not a JSON object. |
400 | Request fields [...] are Spanway pass-through envelope controls ... | The body uses field names the gateway reserves. Rename them. |
401 | TinyFish 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 other | TinyFish's own error body | TinyFish refused the run. The message is returned unchanged. |
Related
Pass-through endpoints lists every built-in route. Agent governance explains how agent runs are tracked across the gateway.