Suanlimao
← Back to all tutorials

Connect your tools

PDFMathTranslate (pdf2zh)

The paper translator that keeps formula layout: three environment variables.

About 4 minFor:Researchers and students who translate whole PDF papers

Before you start

  • pdf2zh is installed (pdf2zh --version works)
  • A key and a model name

Step 1 · STEP 0x01

Set three environment variables

bash
export OPENAI_BASE_URL=https://api.suanlimao.shop/v1
export OPENAI_API_KEY=<YOUR_API_KEY>
export OPENAI_MODEL=<MODEL_NAME>
terminal
$ export OPENAI_BASE_URL=https://api.suanlimao.shop/v1$ export OPENAI_API_KEY=<YOUR_API_KEY>$ export OPENAI_MODEL=<MODEL_NAME>
  • The docs stress that OPENAI_BASE_URL must end with /v1; without it you get 404.
  • OPENAI_MODEL is the name copied from the plaza. Whole papers use many tokens, so a cheaper model pays off.
The full key is shown only once, at creation. Missed it? Revoke it and create a new one.

Create a key →

Step 2 · STEP 0x02

Translate with the openai service

terminal
$ pdf2zh paper.pdf -s openai…$ lspaper-mono.pdf  paper-dual.pdf
  • -s openai selects the service; instead of setting OPENAI_MODEL you can write -s openai:<model>.
  • Two outputs: -mono is translation only, -dual is bilingual.
Don't guess the model name: open the model plaza, click “Copy model id” on a model card and paste it. A wrong model name is the most common error.

Open the model plaza →

Step 3 · STEP 0x03

The newer pdf2zh-next (optional)

terminal
$ pdf2zh_next paper.pdf --openai --openai-base-url https://api.suanlimao.shop/v1 --openai-api-key <YOUR_API_KEY> --openai-model <MODEL_NAME>(参数名以 pdf2zh_next -h 的输出为准)
The newer pdf2zh-next lists OpenAI and “OpenAI Compatible” as first-tier engines; flag names derive from its config fields (official rule: the env var replaces -- with PDF2ZH_ and - with _). Check pdf2zh_next -h for the exact flags.

✓ How to tell it worked

  • The -mono and -dual PDFs are produced and the Usage page shows the requests.

FAQ

404?

The docs say a missing /v1 suffix on OPENAI_BASE_URL gives 404. Make sure it is https://api.suanlimao.shop/v1.

401?

OPENAI_API_KEY is unset or truncated; on Windows, PowerShell and cmd set variables differently.

How much does one paper cost?

It depends on page count and model price. Give the key a budget cap first, then check actual spend on the Usage page.

Related tutorials

Still stuck?

Read the troubleshooting tutorials first. If that does not help, open a ticket with the request_id, time, model and the exact error (never paste your key).