# fastapi.online — Code Translation (Cross-Language Code Converter)

> fastapi.online — Code Translation (Cross-Language Code Converter) is a paid API for AI agents from api.fastapi.online, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-14).

Translates source code from one programming language to another using AI inference, preserving logic and structure.

## Facts

- Endpoint: POST https://api.fastapi.online/code-translate
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/fastapi-online-code-translation-cross-language-code-converter-275a46a0
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_XutQ2CVzd0bcPkjs5YZxP

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability fastapi-online-code-translation-cross-language-code-converter-275a46a0 -d '<json body>'
```

Example prompt: Can you translate this Python function to JavaScript? Here's the code: `def add(a, b): return a + b`

## When to prefer this

Choose this endpoint when you need a quick, pay-per-call code translation without signing up for a full service. Ideal for one-off conversions or agent workflows that need to port code snippets between languages programmatically. At $0.002 per call it is cost-effective for high-volume automated translation pipelines.

## Known failure modes

- Unsupported language pair may produce poor or garbled output
- Code exceeding 20,000 characters will be rejected
- Ambiguous or missing from_language may cause incorrect translation
- Complex language-specific constructs (e.g. macros, metaprogramming) may not translate accurately
- Payment failure or missing credentials returns a 402 error

## How this service works

Chat, embeddings, OCR, speech-to-text, image editing, image understanding (captioning/Q&amp;A), text-to-speech, translation, writing tools, classification tools, developer tools, local utilities, format/checksum validators, encoding &amp; crypto utilities, date/time calculators, geo/coordinate math, math &amp; finance calculators, novelty tools, and business/social writing generators — 179 endpoints in all, across multiple specialized self-hosted models. Pay per call with crypto — no signup — or get an API key.

## Output

Returns the translated source code in the target programming language, preserving the logic and structure of the original code.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "code": {
   "type": "string",
   "maxLength": 20000,
   "minLength": 1
  },
  "to_language": {
   "type": "string",
   "maxLength": 40,
   "minLength": 1
  },
  "from_language": {
   "type": "string",
   "maxLength": 40
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/fastapi-online-code-translation-cross-language-code-converter-275a46a0/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.fastapi.online](https://www.zero.xyz/host/api.fastapi.online/llms.txt)
