Execution

Execution

Run any managed service with a single call. Wayforth handles authentication, billing, retries, and provider failover so your code doesn't have to.

wayforth_execute()

Execute a managed service by its slug. Parameters vary by service — check the catalog or call wayforth_search() first to discover available services.

def wayforth_execute( slug: str, **params: Any ) -> dict
slug str Service identifier from wayforth_search(). required
**params Any Service-specific parameters. Passed directly to the underlying API. varies

Examples

mcp tool
# Translation
wayforth_execute(slug="deepl", text="Hello world", target_lang="ES")

# Transcription
wayforth_execute(slug="whisper-large", audio_url="https://example.com/clip.mp3")

# Embeddings
wayforth_execute(slug="openai-embeddings", input="The quick brown fox", model="text-embedding-3-large")

# Web search
wayforth_execute(slug="perplexity-sonar", query="latest AI research 2025", num_results=5)

Response envelope

All responses include billing metadata alongside the service's native output:

json
{
  // Service-native fields (varies by service)
  "translation": "¡Hola, mundo!",
  "detected_source_lang": "EN",

  // Wayforth billing fields (always present)
  "billed_calls": 1,
  "credits_remaining": 97,
  "latency_ms": 423,
  "provider": "deepl"
}

Error handling

python
from wayforth import WayforthError, InsufficientCreditsError, ServiceUnavailableError

try:
    result = wayforth_execute(slug="deepl", text="Hello", target_lang="ES")
except InsufficientCreditsError:
    print("Top up at https://wayforth.io/billing")
except ServiceUnavailableError:
    print("Provider degraded — Wayforth will retry automatically")
except WayforthError as e:
    print(f"Error {e.status_code}: {e}")

Managed services

Wayforth manages authentication, rate limits, and retries for these 15 services. You never handle upstream API keys for managed services — use Wayforth credits instead.

deepl
DeepL Translation
translation WRI 94
openai-embeddings
OpenAI Embeddings
embeddings WRI 96
cohere-rerank
Cohere Rerank v3
embeddings WRI 91
stability-sdxl
Stability SDXL 1.0
generation WRI 88
whisper-large
Whisper Large v3
audio WRI 93
eleven-turbo
ElevenLabs Turbo v2
audio WRI 89
perplexity-sonar
Perplexity Sonar
search WRI 92
aws-textract
AWS Textract
extraction WRI 95
google-vision
Google Cloud Vision
vision WRI 97
azure-speech
Azure Speech STT
audio WRI 94
serp-search
SERP Search API
search WRI 90
clearbit-enrich
Clearbit Enrichment
data WRI 87
hunter-find
Hunter.io Email Finder
identity WRI 85
ipapi
IP Geolocation
geo WRI 98
twilio-sms
Twilio SMS Gateway
notifications WRI 96

Browse the full catalog: The catalog grows weekly. Use wayforth_services() or visit wayforth.io/catalog for the live list.

BYOK — Bring Your Own Key

For services where you already have an API subscription, BYOK lets you route calls through Wayforth's infrastructure (retry, failover, observability) while using your own upstream credentials. You are only charged the Wayforth gateway fee — not the underlying service cost.

Setup

Register your key

Go to Settings → BYOK in the dashboard, or use the API:

bash
curl -X POST https://gateway.wayforth.io/v1/byok \
  -H "x-wayforth-api-key: $WAYFORTH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"service": "deepl", "upstream_key": "your-deepl-key"}'

Use as normal

Once registered, your key is used automatically whenever you execute that service. No change to your call syntax:

python
# Wayforth routes through your DeepL key transparently
wayforth_execute(slug="deepl", text="Hello", target_lang="FR")

BYOK billing

ModeUpstream costWayforth fee
Managed (default)Included in credits1 credit per call
BYOKBilled to your upstream account0.1 credits per call (routing only)

Security: Upstream keys are encrypted at rest with AES-256 and never logged in plaintext. You can revoke a BYOK key at any time from the dashboard.

x402 native execution

x402 is an open HTTP payment protocol that embeds micropayment settlement directly into the request lifecycle. With x402, you pay per call on-chain (USDC on Base) with no subscription or pre-funded credits needed.

How it works

  1. Your client sends a request to the gateway without an API key
  2. The gateway returns 402 Payment Required with a payment descriptor
  3. Your x402-capable client signs and broadcasts a USDC microtransaction on Base
  4. The gateway settles the transaction and proxies your request to the service
  5. The response is returned along with a payment receipt
python
from x402 import X402Client  # x402 Python client

client = X402Client(wallet_key="0x...")

# No Wayforth API key needed — payment is on-chain
result = client.post(
    "https://gateway.wayforth.io/v1/execute/deepl",
    json={"text": "Hello", "target_lang": "ES"}
)
print(result.json()["translation"])  # Hola

x402 vs credits

Credits (Track A/B)x402 (Track C)
Auth requiredYes (API key)No
BillingMonthly / top-upPer call (on-chain)
SettlementStripe / USDC batchUSDC per request
Latency overhead~0 ms~50–80 ms (chain confirm)
Best forRegular usage, budgetsAnonymous, ephemeral, agents

x402 is experimental. The protocol is in active development. Production use requires a compatible x402 client library. See Track C for full details.

Self-healing payments

Wayforth's execution layer continuously monitors service health and automatically reroutes calls when a provider degrades — without any action from you.

How it works

  1. Health monitoring: Each managed service is probed every 30 seconds. WRI score is updated continuously.
  2. Threshold detection: If a service's WRI drops below its tier's minimum or 3 consecutive calls fail, it enters degraded state.
  3. Automatic failover: Subsequent calls are rerouted to the next-best provider in the same category with the highest WRI score.
  4. Billing protection: Failed calls that were rerouted are not charged to your account. The retry is billed once success is confirmed.
  5. Recovery: When the original provider recovers (WRI returns above threshold), traffic is automatically shifted back.

Failover visibility

Every response includes a provider field so you can see which upstream handled your call:

json
{
  "translation": "Hola",
  "provider": "google-translate",
  "failover": true,
  "original_provider": "deepl",
  "billed_calls": 1
}

Zero-downtime guarantee: For tier 3+ services, Wayforth guarantees at least one backup provider is always available. If no backup is available, you receive a 503 with "failover_exhausted": true and the call is not charged.