LLM SDK translator
Translate one openai, anthropic or google-genai SDK call into another provider's SDK, in Python or TypeScript, with a report of what did not carry over.
What it does
Paste one SDK call and choose the SDK to write it for. For example, client.chat.completions.create(…) from openai-python becomes client.messages.create(…) for anthropic, in Python and in TypeScript.
It works in three steps:
- Read the call. It finds one call it recognises and the client it was made on. The call is
chat.completions.create,responses.create,messages.createormodels.generate_content(generateContentin TypeScript). From the client it reads the base URL and the key's variable. Only values written out are read: a variable, a function call or a spread is refused with its line, because nothing is run. A client whose base URL is read from a variable, set after the client is made (client.base_url = …,with_options), read from a profile, or a Vertex AI client is refused too: translated with the provider's default address, code written for a gateway would send its key to the provider. - Convert the request. The request inside the call goes through the LLM request converter, the same reader and writer as that tool. So the system prompt, messages, images, tools, tool calls and results, a JSON schema and the sampling parameters carry over as they would there.
- Write the call with the other SDK's template, checked against the release named under the code.
Try it: openai-python to anthropic, Anthropic TypeScript to OpenAI Chat Completions, or google-genai to OpenAI Responses.
The lossy-conversion report
Under the code, every change is listed:
- No equivalent (a warning): a field the target has no place for, which is left out. For example,
seedin Anthropic Messages. - Carried in a different form (a note): the same meaning, written the target's way. For example, a system message becomes Anthropic's
system. - Required and missing (an error): the target needs a field the source did not have. For example, Anthropic Messages requires
max_tokens. - The SDK's own changes: a field the target SDK's method does not declare goes in
extra_body. The base URL goes back to the target SDK's default. The model id is carried as written, so choose one the target provider serves.
The key
The translated code reads the key from an environment variable: the target SDK's own, or one you name. A base URL keeps no query, fragment or user and password, because a token can hide in each of them. A key written into the pasted code is not in the output, the address or a share link. The link holds the call as the tool writes it back, with the key as a variable, or the settings only.
What it does not know
- It translates one call, not a program. Loops, retries, streaming handlers and how the answer is read are yours to change. The answer's shape differs between SDKs too:
choices[0].message.content,content[0].textorresponse.text. - It does not map model ids between providers.
- It writes Python and TypeScript only, and it runs nothing.
Sources
The SDK templates are read from each SDK's source at a named release, as in cURL to SDK code. The request conversion is the request converter's.
Where the numbers come from
This tool works only on what you enter. It uses no external data and runs entirely in your browser.
