---
name: x402-gateway-production.up.railway.app
description: x402-gateway-production.up.railway.app exposes four distinct API skills: remote code execution in a sandboxed environment, a snapshot of top cryptocurrency market data, text embedding generation, and text completion via a hosted Llama-family model. It is a general-purpose API gateway rather than a domain-specific service. Each skill is stateless and invoked independently via HTTP.
host: x402-gateway-production.up.railway.app
---

# x402-gateway-production.up.railway.app

This host aggregates four unrelated capabilities under a single payment gateway: sandboxed code execution, crypto market snapshots, vector embeddings, and LLM text generation. It serves agents that need one or more of these primitives without standing up separate infrastructure. It is not specialized in any single domain and does not offer streaming, persistence, or inter-skill orchestration natively.

## When to use this host

Use this host when an agent needs sandboxed code execution, a bulk crypto market snapshot, text embeddings, or Llama-based text generation and does not want to manage separate infrastructure for each. For real-time or streaming crypto prices, use a dedicated ticker or WebSocket feed instead. For streaming LLM token output, confirm stream=true is supported or use a purpose-built streaming LLM endpoint. For image or audio generation, this host has no applicable skills. For persistent or long-running code processes (over 5 minutes), use a dedicated compute environment. For fine-tuned or non-Llama models (e.g. GPT-4, Claude), use their respective provider APIs. This host is best suited for agents that need one or two of these primitives in a single-call, stateless fashion.

## Capabilities

### LLM Text Generation

Generates text completions, structured JSON, summaries, and conversational responses using a hosted Llama-family model with configurable sampling parameters.

- **`generate-text-llama`** — Sends a chat-style prompt to a hosted Llama-family model and returns a text completion, supporting structured JSON output, multi-turn messages, and sampling controls.

### Text Embeddings

Converts text strings into dense vector representations suitable for semantic search, clustering, and similarity scoring.

- **`generate-text-embeddings`** — Generates vector embeddings for one or more text inputs, suitable for semantic search, clustering, and similarity comparisons.

### Remote Code Execution

Runs arbitrary code snippets in a remote sandbox and returns stdout, stderr, exit code, and timing, eliminating the need for local execution infrastructure.

- **`run-code-snippet`** — Executes a code snippet in a specified language on a remote sandbox and returns stdout, stderr, exit code, and execution time.

### Crypto Market Data

Retrieves a ranked snapshot of top cryptocurrency market entries including price, volume, market cap, supply, and 24h change metrics for multiple coins in a single call.

- **`fetch-crypto-markets`** — Returns a ranked list of cryptocurrency market entries including current price, 24h high/low, volume, market cap, circulating supply, ATH, and price change metrics for top coins.

## Workflows

### Crypto Market Analysis with LLM Summary

*Use when an agent needs to fetch current crypto market data and then produce a human-readable analysis, summary, or structured report from that data.*

1. **`fetch-crypto-markets`** — Retrieve current price, volume, market cap, and 24h change data for top cryptocurrencies.
2. **`generate-text-llama`** — Pass the market data as context in a prompt to generate a natural-language summary, trend analysis, or structured JSON report.

### Semantic Search Index Builder

*Use when an agent needs to embed a corpus of text and then use an LLM to reason over or rank the most semantically relevant results.*

1. **`generate-text-embeddings`** — Convert candidate text documents or query strings into vector representations.
2. **`generate-text-llama`** — Use the LLM to synthesize, rerank, or explain the results identified via embedding similarity.

### LLM-Generated Code Execution

*Use when an agent needs to generate a code snippet with an LLM and then immediately execute it to verify correctness or retrieve computed output.*

1. **`generate-text-llama`** — Prompt the Llama model to produce a code snippet in a target language based on a task description.
2. **`run-code-snippet`** — Execute the generated code in the remote sandbox and return stdout, stderr, and exit code to validate the result.

## Skill reference

### `run-code-snippet`

**CodeRun API** — Executes a code snippet in a specified language on a remote sandbox and returns stdout, stderr, exit code, and execution time.

*Use when:* Use when an agent needs to run arbitrary code (e.g. Python) remotely and retrieve the output, logs, or errors without managing local execution infrastructure.

*Not for:* Do not use for long-running persistent processes or interactive sessions; the maximum timeout is 5 minutes and execution is stateless per call.

**Inputs:**

- `code` (string, required) — The source code to execute as a string.
- `language` (string, required) — Programming language of the code snippet (e.g. 'python').
- `args` (array) — Command-line arguments passed to the script at runtime.
- `env` (object) — Key-value pairs of environment variables injected into the execution context.
- `stdin` (string) — String piped to the process's standard input.
- `timeout_ms` (integer) — Maximum wall-clock time in milliseconds before the process is killed.
- `return_logs` (boolean) — Whether to include log output in the response.
- `return_errors` (boolean) — Whether to include error output (stderr) in the response.
- `return_output` (boolean) — Whether to include stdout in the response.
- `resource_limits` (object) — Resource constraints for the execution: cpu_time_ms (max CPU time), max_memory_mb (memory cap), max_output_chars (stdout/stderr character cap).

**Returns:** Returns success=true, stdout containing the script's printed output, stderr as empty string, exit_code 0, execution_time_ms of ~444, and an empty outputs array.

**Example:** `{"language": "python", "code": "import sys, json\nprint(json.dumps({'args': sys.argv[1:]}))", "args": ["hello"], "env": {}, "stdin": "", "timeout_ms": 5000, "return_logs": true, "return_errors": true, "return_output": true, "resource_limits": {"cpu_time_ms": 4500, "max_memory_mb": 256, "max_output_chars": 20000}}`

---

### `fetch-crypto-markets`

**Crypto Markets Data** — Returns a ranked list of cryptocurrency market entries including current price, 24h high/low, volume, market cap, circulating supply, ATH, and price change metrics for top coins.

*Use when:* Use when an agent needs current market data for multiple cryptocurrencies at once, including prices, 24h price changes, trading volumes, market caps, and supply figures for coins like BTC, ETH, USDT, BNB, XRP, and others.

*Not for:* Do not use for real-time streaming price feeds or single-coin lookups where a lightweight ticker endpoint would suffice. Not suitable for historical OHLCV data or order book depth.

**Returns:** Returns a JSON array of top cryptocurrency market entries, each containing current price, 24h high/low, volume, market cap rank, circulating supply, ATH/ATL, and last-updated timestamp in USD.

**Example:** `GET https://x402-gateway-production.up.railway.app/api/crypto/markets`

---

### `generate-text-embeddings`

**X402 Text Embeddings** — Generates vector embeddings for one or more text inputs, suitable for semantic search, clustering, and similarity comparisons.

*Use when:* Use when an agent needs to convert text strings into numerical vector representations for downstream tasks such as semantic search, nearest-neighbor lookup, document clustering, or cosine similarity scoring.

*Not for:* Do not use for text generation, summarization, or classification tasks that require a language model output; use a completion or chat API instead.

**Inputs:**

- `input` (string, required) — The text string (or array of strings) to embed. Exact parameter name and structure follow the embeddings API convention.

**Returns:** Returns an array of embedding vectors corresponding to each input text, suitable for semantic similarity and search operations.

**Example:** `{"input": "The quick brown fox jumps over the lazy dog"}`

---

### `generate-text-llama`

**x402 Llama Gateway** — Sends a chat-style prompt to a hosted Llama-family model and returns a text completion, supporting structured JSON output, multi-turn messages, and sampling controls.

*Use when:* Use when an agent needs to generate text, structured JSON, summaries, plans, or conversational responses from a Llama-family LLM without managing model infrastructure.

*Not for:* Do not use for real-time streaming token output if stream=false is set; do not use for image, audio, or embedding generation — those require separate endpoints.

**Inputs:**

- `model` (string, required) — Identifier of the Llama model to use for generation.
- `messages` (array, required) — Ordered list of chat messages, each with a 'role' (system, user, assistant) and 'content' string.
- `top_p` (number) — Nucleus sampling probability mass cutoff. Values between 0 and 1; lower values make output more focused.
- `stream` (boolean) — Whether to stream tokens as they are generated. Set false for a single complete response.

**Returns:** Returns a JSON object with a single 'content' key containing the model's generated text, which may be plain prose or a markdown-fenced JSON block matching the requested output schema.

**Example:** `{"model": "llama-3.1-70b-instruct", "top_p": 0.9, "stream": false, "messages": [{"role": "system", "content": "You are a helpful assistant. Return only valid JSON."}, {"role": "user", "content": "List three risks of a cloud migration as a JSON array with keys: risk, likelihood, mitigation."}]}`

---
