Text tools

The key you use for chat, images and video also runs text tools, from the same balance. A text tool reads what you send it (a picture, a video, a recording, a 3D model or text) and writes text back. Models from Ai2 (Molmo 2), Moondream, Baidu (PaddleOCR-VL), Meta (SAM 3), OpenBMB (MiniCPM-V), MiniMax, Mureka, HeartMuLa, ElevenLabs and Meshy, and MartLLM's own tools. The same route also trains your own LoRA from your pictures (Train your own LoRA). Each model's page shows its price and a working request.

You want What you send
A caption of a picture image_url
The text, tables and formulas of a document picture (OCR) image_url
An answer to a question about a picture image_url (or images) and the question in prompt
Boxes or points around something in a picture, or its mask image_url and what to find in prompt
A caption, a summary or an answer about a video video_url (and a question in prompt)
The subtitles burned into a video, as SRT text video_url
A safe or unsafe check of text, a picture or a video the text in prompt, or image_url / video_url
Song lyrics, or more lines for lyrics you have prompt
A detailed picture or video prompt from a short idea or a picture prompt or image_url
A story from a theme prompt
A song's genre, mood and instruments, its name, or its lyrics written down audio_url
When each word of a transcript is said in a recording audio_url and the transcript in prompt
Word-by-word captions burned into your video, plus an SRT file video_url
Which celebrity a face looks like image_url
Whether a 3D model is ready to 3D print, and what to fix model_url
Your own LoRA, trained on your pictures or videos training_data (a .zip)

Everything goes to one route, POST /v1/answers. Most answers come back in the same call, within a few seconds.

What you pay

A text tool that reads a picture, a recording, a 3D model or text has one price per answer (its pricing unit is job). One that reads a video is priced per run or per second of the video (unit second): we measure the video before anything is charged, and its page says the shortest length billed (a 2-second clip billed as 3 seconds, say) and whether it bills in whole blocks (the subtitle reader and the video captioner bill each started minute). A LoRA trainer is priced per training step (unit step; its page shows the price per 1,000 steps), times the steps you ask for. Ask for the price first, for free, with "validate": true or POST /v1/quote (see Get the price first), and send "max_cost" (US dollars) so a request that could cost more is refused before anything is charged. A request that fails costs nothing.

List the text tools

curl -H "Authorization: Bearer $MARTLLM_API_KEY" \
  "https://api.martllm.com/v1/models?type=answer"

Each entry has "type": "answer", "endpoints": ["/v1/answers"] and its pricing. What it reads is in input_modalities and media_options.features:

media_options.features It reads
reads-picture pictures: media_options.min_images says how many it needs (0 = a picture is optional), max_images how many it takes
reads-video a video in video_url, always needed
needs-prompt words in prompt (the question, the text to check, the theme); media_options.prompt_hint says what for
takes-prompt optional words in prompt
prompt-or-picture words or a picture, either one
reads-audio a recording in audio_url, always needed
reads-3d-model a 3D model in model_url, always needed
trains-lora a .zip of training pictures or videos in training_data, always needed; media_options.lora_for lists the models the trained LoRA is for

Add &parameters=1 to get each model's request as a JSON Schema, or ask for one model with GET /v1/models/<model id>: its parameters list the model's own settings (a caption's detail level, a story's genre, the OCR output format) with the values each takes; a setting marked required must be sent. Send only settings it lists: a request is checked against them before anything is charged. ?type=all lists text tools with every other kind.

Ask about a picture

curl https://api.martllm.com/v1/answers \
  -H "Authorization: Bearer $MARTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "moondream/moondream3-preview-query",
       "image_url": "https://example.com/receipt.jpg",
       "prompt": "What is the total on this receipt?"}'

HTTP 200, once the answer is written:

{
  "id": "4c1a…",
  "object": "media.job",
  "kind": "answer",
  "status": "succeeded",
  "model": "moondream/moondream3-preview-query",
  "answer": "The total is $42.17.",
  "results": [{ "artifact_index": 0, "url": "https://api.martllm.com/v1/media/artifacts/4c1a…/0",
                "content_type": "text/plain; charset=utf-8", "text": "The total is $42.17." }],
  "usage": { "cost_usd": 0.00525 }
}

answer is the text, all of it. results lists each part the model wrote: text comes with its text; a structured answer (boxes, points, a moderation verdict, OCR in JSON) has content_type application/json and its JSON as text; a model that also makes a file (SAM 3 with apply_mask draws the mask on your picture) gives that file as a url to download with the same key, kept for about 3 hours. The text itself stays on the job.

Each picture is a public https:// link or the id of a picture you uploaded to POST /v1/files (see Upload a picture or video once). A model that needs a picture refuses a request without one with 400 image_required before anything is charged. Molmo 2 Image Q&A reads one or two pictures, sent in images.

Read a document (OCR)

curl https://api.martllm.com/v1/answers \
  -H "Authorization: Bearer $MARTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "baidu/paddleocr-vl", "image_url": "https://example.com/invoice.png",
       "output_format": "markdown"}'

output_format markdown gives readable text with its tables; json gives structured data. Both cost the same.

Read a video

curl https://api.martllm.com/v1/answers \
  -H "Authorization: Bearer $MARTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "allenai/molmo-2-video-qa", "video_url": "https://example.com/clip.mp4",
       "prompt": "How many people walk past the camera?"}'

The video is a public https:// link or the id of a video you uploaded to POST /v1/files: MP4 or MOV, up to 50 MB and up to the length its page says (the Molmo 2 video captioner, Q&A and understanding models read up to 2 minutes, the others up to 10). A longer video is refused with 400 video_too_long before anything is charged. studio/subtitle-ocr gives the video's burned-in subtitles back as SRT text in answer.

Read a recording

curl https://api.martllm.com/v1/answers \
  -H "Authorization: Bearer $MARTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "mureka/mureka-describe-song", "audio_url": "https://example.com/song.mp3"}'

The recording is an https:// link, a data: URI or the id of a file you uploaded to POST /v1/files: MP3, WAV, M4A, AAC or OGG, up to 50 MB. Its length is read before anything is charged. Some models take fewer formats (Mureka Describe Song: MP3 or M4A only); any other is refused in plain words, for free.

  • mureka/mureka-describe-song: the song's genre, mood and instruments.
  • mureka/mureka-v7-6-recognize-song: the song's name.
  • heartmula/heartmula-transcribe-lyrics: the song's lyrics, written down.
  • elevenlabs/elevenlabs-forced-alignment: when each word and character of a transcript is said. Send the transcript in prompt with the recording (up to one hour).

Burn captions into a video

curl https://api.martllm.com/v1/answers \
  -H "Authorization: Bearer $MARTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "studio/ai-video-captioner", "video_url": "https://example.com/clip.mp4"}'

studio/ai-video-captioner writes animated word-by-word captions onto your video and gives the captions as an SRT file too. Its settings (in GET /v1/models/<id>) pick one of 12 caption styles, the spoken language (about 100) and a language to translate the captions into; send the transcript in prompt if you have one. The video comes back as a file in results, the SRT as answer. It is billed per started minute of your video, one minute at least.

Check a 3D model before you print it

curl https://api.martllm.com/v1/answers \
  -H "Authorization: Bearer $MARTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "meshy/meshy-print-analyze", "model_url": "https://example.com/part.stl",
       "printer_type": "fdm", "intended_print_height_mm": 120}'

The answer says whether the model is ready to 3D print and lists what to fix. The 3D model is an https:// link or the id of a file you uploaded to POST /v1/files (GLB, GLTF, FBX, OBJ or STL, uploads up to 50 MB). printer_type is fdm, sla or full_color.

Train your own LoRA

A LoRA teaches a picture or video model one face, product, character or style from your own pictures. Train it here, then use it on the model it was made for: each trainer's media_options.lora_for (and its page) names those models.

  1. Put your pictures in a .zip (videos for a video trainer). A caption is optional: a .txt file with the same name as the picture (cat1.jpg and cat1.txt). Upload it once (up to 50 MB; for a bigger one, send a public link instead):

    curl https://api.martllm.com/v1/files \
      -H "Authorization: Bearer $MARTLLM_API_KEY" -F [email protected]
    # → {"id": "file_…", …}
    
  2. Start the training. trigger_word is the word that calls up what you trained; steps sets how long it trains (and the price):

    curl https://api.martllm.com/v1/answers \
      -H "Authorization: Bearer $MARTLLM_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"model": "studio/flux-dev-lora-trainer", "training_data": "file_…",
           "trigger_word": "TOK", "steps": 1000}'
    

    It answers HTTP 202 with the job: training takes minutes.

  3. Ask for it every 30 seconds until status is succeeded:

    curl -H "Authorization: Bearer $MARTLLM_API_KEY" \
      https://api.martllm.com/v1/answers/<job id>
    

    answer is empty for a trainer; the trained LoRA is the file in results[0], at https://api.martllm.com/v1/media/artifacts/<job id>/0 (a .safetensors file; download it with the same key). A key that saves requests keeps it for 90 days; a key that saves none gets a link that works for about 3 hours, so download it.

  4. Use it: send that link in loras with a prompt that says the trigger word.

    curl https://api.martllm.com/v1/images/generations \
      -H "Authorization: Bearer $MARTLLM_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"model": "black-forest-labs/flux-dev", "prompt": "a photo of TOK on a beach at sunset",
           "loras": [{"path": "https://api.martllm.com/v1/media/artifacts/<job id>/0", "scale": 1}]}'
    

    See Use a LoRA.

Each trainer's settings are in GET /v1/models/<id>: steps with its smallest, largest and default value, trigger_word, and on some learning_rate and lora_rank. The Pruna trainers take steps and default_caption (the caption for pictures that have none). A training that fails costs nothing.

Trainer Trains for Steps (default)
studio/flux-dev-lora-trainer FLUX.1 dev pictures 500 to 10,000 (1,000)
studio/flux-dev-lora-trainer-turbo FLUX.1 dev pictures (turbo) 1,000 to 10,000
studio/qwen-image-lora-trainer Qwen-Image pictures 500 to 10,000
studio/qwen-image-2512-lora-trainer Qwen-Image 2512 pictures 500 to 10,000
studio/z-image-lora-trainer Z-Image Turbo pictures 500 to 10,000
studio/z-image-base-lora-trainer Z-Image Base pictures 500 to 10,000
studio/wan-2-2-image-lora-trainer Wan 2.2 pictures 1,000 to 10,000
studio/wan-2-1-14b-lora-trainer Wan 2.1 videos 1,000 to 10,000 (2,000)
studio/wan-2-2-i2v-lora-trainer Wan 2.2 videos from a picture (a .zip of videos) 50 to 1,500 (100)
studio/ltx-2-19b-video-lora-trainer LTX-2 videos (a .zip of videos) 100 to 5,000
pruna-ai/p-image-text-to-image-trainer Pruna P-Image pictures (101)
pruna-ai/p-image-edit-trainer Pruna P-Image Edit (101)

Prices change with the market; each trainer's page and GET /v1/models?type=answer show the price now.

Check text, a picture or a video (moderation)

curl https://api.martllm.com/v1/answers \
  -H "Authorization: Bearer $MARTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "studio/content-moderator-text", "prompt": "the comment to check"}'

The answer says whether it is safe and why. The picture and video moderators read image_url or video_url, with optional words in prompt for context.

Write lyrics, a prompt or a story

curl https://api.martllm.com/v1/answers \
  -H "Authorization: Bearer $MARTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "studio/prompt-optimizer", "prompt": "a cat on a roof at night",
       "mode": "video", "style": "photographic"}'

minimax/minimax-lyrics writes a whole song from a theme (mode write_full_song, the default) or changes the lyrics you send (mode edit with lyrics); mureka/mureka-extend-lyrics continues the lyrics in prompt; studio/ai-story-generator writes a story from a theme, with genre, length, audience and format.

A slow answer

An answer that takes longer than about 25 seconds (a long video, say) comes back as the job, HTTP 202 with "status": "running". Ask for it every few seconds, or send callback_url with the request and we tell you when it ends (see Callbacks):

curl -H "Authorization: Bearer $MARTLLM_API_KEY" \
  https://api.martllm.com/v1/answers/<job id>

HTTP 202 while it runs, HTTP 200 with answer once it ends. status is queued, running, succeeded, failed, canceled or expired, as for a video (see Job status); on failed, error.message says why. To stop one: curl -X DELETE … https://api.martllm.com/v1/answers/<job id>. The Idempotency-Key header works as for a video: send the same request again with the same key within 24 hours and you get the same job back, never a second one.

Get the price first

Add "validate": true to the same request. Nothing is read or charged, and the reply says what it costs:

curl https://api.martllm.com/v1/answers \
  -H "Authorization: Bearer $MARTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "baidu/paddleocr-vl", "image_url": "https://example.com/invoice.png", "validate": true}'
{ "object": "quote", "model": "baidu/paddleocr-vl", "kind": "answer", "valid": true,
  "cost_usd": 0.0105, "max_cost_usd": 0.0105, "unit": "job", "units": 1, "note": "Nothing was charged. …" }

POST /v1/quote takes the same body and answers cost_usd too, with a quote_id that holds the price for 15 minutes (see Hold a price for 15 minutes). Then send the request with "max_cost" set to the price you agreed to: if it can cost more, it is refused with 400 max_cost_too_low and nothing is charged.

Errors

Text tools answer the same errors as video jobs (see Errors). The ones you are most likely to meet:

HTTP code meaning
400 wrong_endpoint the model is not a text tool, or a text tool was sent to another route; the message names the right one. Nothing is charged
400 invalid_request the request is wrong, for example no prompt where the model needs one, a setting it does not take, a required setting left out, no audio_url, model_url or training_data where the model needs it, or a recording in a format it does not take; the message says what to fix. Nothing is charged
400 image_required the model reads a picture and was sent none. Nothing is charged
400 video_required / video_too_long / invalid_video the model reads a video and was sent none, one longer than it reads, or one whose length could not be read. Nothing is charged
400 max_cost_too_low it can cost more than your max_cost; nothing was charged
402 insufficient_credits your balance can't cover it; the message says how much it needs
404 model_not_found / not_found no such model, or no such job on your account
503 no_available_provider no seller can answer right now; try again in a minute or pick another model