# Strale Code Convert

> Strale Code Convert is a paid API for AI agents from api.strale.io, paid per call via x402, $0.054/call, status unknown (last checked 2026-09-15).

Converts source code from one programming language to another, preserving logic and structure.

## Facts

- Endpoint: POST https://api.strale.io/x402/v2/code-convert
- Price: $0.054/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/strale-code-convert-ad6ae7a2
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_D1WWMiOr-B_2hxnBfBHzj

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 strale-code-convert-ad6ae7a2 -d '<json body>'
```

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

## When to prefer this

Choose this endpoint when you need a quick, auditable, pay-per-call code conversion without setting up a local LLM or IDE plugin. Particularly useful in automated pipelines, migration workflows, or agent-driven codebases where auditability (cryptographic chain hashing) matters. Best for single-function or small-to-medium code snippets across mainstream programming languages.

## Known failure modes

- Unsupported or unrecognized source/target language returns an error
- Ambiguous or syntactically broken input code may produce incorrect translations
- Very language-specific idioms or libraries may not have direct equivalents and could result in partial or approximate conversion
- Missing required fields (code, to_language) will return a validation error
- Complex multi-file or framework-dependent code may not convert well from a single snippet

## How this service works

Convert code between programming languages. Uses idiomatic patterns for the target language. Supports all major languages.

## Output

Returns the equivalent source code rewritten in the target programming language, preserving the original logic, variable names where idiomatic, and structure. The response includes the converted code and may include audit metadata with cryptographic chain hashing for traceability.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "code",
  "to_language"
 ],
 "properties": {
  "code": {
   "type": "string"
  },
  "to_language": {
   "type": "string"
  },
  "from_language": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "confidence": {
  "type": "string"
 },
 "converted_code": {
  "type": "string"
 },
 "source_language": {
  "type": "string"
 },
 "target_language": {
  "type": "string"
 },
 "dependencies_needed": {
  "type": "array"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/strale-code-convert-ad6ae7a2/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.strale.io](https://www.zero.xyz/host/api.strale.io/llms.txt)
