Code Converter
Translate code into another programming language, written the way that language is normally written.
Pay by wallet (x402) AI-generated
code-convert Example
Input
{
"code": "function hello() { return 'world'; }",
"to_language": "en",
"from_language": "en"
} Answer
{
"confidence": "high",
"converted_code": "function hello() { return 'world'; }",
"source_language": "en",
"target_language": "en",
"conversion_notes": [
"Source and target languages are identical; no conversion needed"
],
"dependencies_needed": []
} Inputs
| Field | Type | Required | What it is |
|---|---|---|---|
code | string | Yes | — |
to_language | string | Yes | — |
from_language | string | No | — |
Output fields
How reliably each field appears in a successful answer.
| Field | Type | Appears |
|---|---|---|
confidence | string | Always (present in every successful answer) |
converted_code | string | Always (present in every successful answer) |
source_language | string | Always (present in every successful answer) |
target_language | string | Always (present in every successful answer) |
dependencies_needed | array | Always (present in every successful answer) |
How to call it
The same tool through each route. MCP clients reach it through Strale’s server at https://api.strale.io/mcp; the call below is what the agent sends.
# Needs an API key. max_price_cents caps what this call may cost.
curl -X POST https://api.strale.io/v1/do \
-H "Authorization: Bearer $STRALE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"capability_slug": "code-convert",
"inputs": {
"code": "function hello() { return 'world'; }",
"to_language": "en",
"from_language": "en"
},
"max_price_cents": 5
}' {
"tool": "strale_execute",
"arguments": {
"slug": "code-convert",
"inputs": {
"code": "function hello() { return 'world'; }",
"to_language": "en",
"from_language": "en"
},
"max_price_cents": 5
}
} import { Strale } from "straleio";
const strale = new Strale({ apiKey: process.env.STRALE_API_KEY! });
const result = await strale.do({
capability_slug: "code-convert",
inputs: {
"code": "function hello() { return 'world'; }",
"to_language": "en",
"from_language": "en"
},
max_price_cents: 5,
}); import os
from straleio import Strale, DoRequest
strale = Strale(api_key=os.environ["STRALE_API_KEY"])
result = strale.do(DoRequest(
capability_slug="code-convert",
inputs={
"code": "function hello() { return 'world'; }",
"to_language": "en",
"from_language": "en",
},
max_price_cents=5,
)) # No account. The first request answers 402 with the price in USDC;
# an x402 client pays it from your wallet and repeats the request.
curl -i -X POST https://api.strale.io/x402/v2/code-convert \
-H 'Content-Type: application/json' \
-d '{
"code": "function hello() { return 'world'; }",
"to_language": "en",
"from_language": "en"
}' Limitations
Converted code can need manual adjustment
AI-powered code conversion — language-specific idioms, standard library differences, and edge cases may require manual adjustment
What to do instead: Run the converted code through the target language's linter and test suite before using in production
Related tools
- Agent Trace Analysis €0.20
- API Docs Generator €0.20
- API Mock Responses €0.05
- Changelog Generator €0.03
- Commit Message Generator €0.05
- Context Window Optimiser €0.03