ai

Code translator

Translate a piece of code from one programming language to another (for example Python to TypeScript, JavaScript to Go, VBA to Python, jQuery to plain JavaScript, SQL between dialects). Keeps the behaviour, uses the idioms of the target language, and lists what could not be translated one to one: libraries without an equivalent, integer sizes, error handling, concurrency. Meant for snippets and single files up to about 10,000 characters, not whole projects. Costs 10 credits per call with an API key or a signed-in session, drawn from the same monthly balance as REST calls (1 credit) and renders (25). Without either, a small free demo allowance per day. Also available on the MCP server as translate_code.

post/api/v1/ai/code-translate

Request

  • Base URL: https://toolforte.com
  • URL: https://toolforte.com/api/v1/ai/code-translate
  • Auth: one of:
    • HTTP bearer
    • none

Request body

codestring required

The source code.

fromstring

Source language. Detected when left out.

tostring required

Target language, for example TypeScript, Python 3, Go, Rust, C#, Kotlin, PHP 8.

notesstring

Optional wishes: a framework, a style, a runtime version.

Response

The tool's answer plus metering

okboolean

Changes

No recorded changes to this operation across all 1 revision of this API.