Skip to content
In development: Molkit Script and the AI chat are not available to accounts yet. These pages describe work in progress and may change.

Use the AI chat

The AI chat needs your own API key from an AI provider (see Set up your key). To open the AI chat, click the AI chat button (a speech bubble) at the bottom of the tool palette on the left. The chat opens in a panel at the right of the canvas. Click the button again to close it; if the panel is folded, the button opens it. The script console also has an AI chat button that opens the same window.

You describe what you want; the AI writes a Molkit Script, checks it, and then runs it or proposes it to you, depending on the mode you choose. Everything the AI does is a script that you can read, keep, and change.

The Molkit window with the AI chat open at the right: a request to draw acetic acid and acetate in equilibrium, the AI's answer with its steps and a run card with Undo and Show in script window, and on the canvas the two Lewis structures joined by an equilibrium arrow.
One exchange in Do it mode: the request, the run card, and the answer, with the drawing on the canvas.

The chat window and the script console are separate windows, so you can keep both open, talk to the AI in one, and watch your script in the other. The chat sits in a panel at the right and the console in a panel under the canvas, so the canvas is never covered. To put the chat somewhere else, click More (…) in its title bar and choose Move to > Bottom, Right, or Float. For the panels, their sizes, and their keys, see Where the windows sit.

To put the chat in a browser window of its own, for example on a second monitor, choose Move to > Pop out, or click the pop-out button in its title bar. Close that window to bring the chat back into Molkit. For more, see Pop out.

  • The conversation, a request the AI is working on, the mode, and a message you have not sent all go with it, and the AI still works on the script in the console.

  • In Chrome, Edge, and Firefox 151 or later, the new window has no address bar and stays on top. In other browsers it is a pop-up window, and Firefox shows a read-only address bar in it.

  • When the chat acts on the canvas from its own window (for example, when you click a name in a run card), the canvas changes in the Molkit window, and the card says so.

  • The title bar shows AI chat, the model in use (click it to open the Key panel; point to it to see the provider), and five buttons: New conversation, More (…), pop out (or bring back), close, and collapse (the arrow, always at the right end). When the chat shares the panel with the docs, each has a tab with its own close button (×), which closes only that tab; Delete on a focused tab does the same. More holds Save as script, Copy conversation, Key, Text size, Theme, and Move to. Copy conversation copies the whole chat as plain text, each turn under its own header (User:, AI:, or Molkit: for run reports), with scripts on lines of their own and no button text. Text you select and copy inside the conversation is copied the same way.

  • The middle of the window is the conversation. The newest message is at the bottom. Your messages are on the right; the AI’s answers use the full width, with headings, lists, links, and math. The AI writes most symbols as text (ΔG‡, H2O); an equation it writes in LaTeX, between $ signs, is drawn as an equation.

  • The bottom of the window is the message box. Press Enter to send, or Shift+Enter to start a new line. The box grows to six lines as you type. Under the box are Examples, the number of tokens the conversation has used, and a row with @, the mode (Do it, With me, or Ask first), the paperclip, and Send. Examples lists example requests; a click puts one in the message box, to change or send, and its last row opens AI chat examples, a longer list by task. Until you send your first message in this browser, an empty conversation offers four examples. While the AI works, Send becomes Stop, which cancels the request. Escape anywhere in the chat window cancels it too, and so does Ctrl+C in the message box when no text there is highlighted (with text highlighted, Ctrl+C copies it, as always), or typing /stop. Run, Check, and Step in the console are off until the AI is done, and a line in the console says why.

  • Escape closes the More menu or the Key panel when one is open. Otherwise it moves the focus to the chat window itself, so a message you are writing is never lost; press Escape again to close the window.

The AI works on the script box of the console. In With me mode, the changes you accept appear in the script box as you accept them, so keep the console open beside the chat to see them. The AI works with the console closed, too. Each run card has Show in script window, which opens the console with the script that run used, selected. If your script box already has other work in it, the run’s script is added at the end; nothing of yours is replaced. When the box already holds that script, it is selected where it is.

The chat window uses the colors of the console: choose Match Molkit, Light, or Dark under Theme in the More menu of either window.

To make the text in the chat larger or smaller, choose a size under Text size in the chat’s More menu, or press Ctrl+=, Ctrl+-, or Ctrl+0 (100%) while you are in the chat window. The size changes the conversation, the message box, and the Key panel; the top of the window stays the same size. The chat and the console share one text size. For more about text size, see The console.

  • Scripts in an answer show as cards in the answer, in the colors of the console. Each card has Copy, Insert into script, which puts the script into the console the same way as Show in script window, and, in Do it mode, Run. Code in another language shows with Copy only.
  • Steps folds what the AI did in one turn, such as “Read the canvas” or “Ran a script”. Click it to see each step. When the AI asks for something the mode does not allow, the step says so in plain words.
  • While the AI works, the last line of the conversation says what it is doing, such as “Thinking” or “Running a script”, and how many seconds have passed.
  • The answer appears as it arrives, a few words at a time. While the AI writes a script, the last line says “Writing a script”, and the script shows when it is complete. With Z.ai, the answer shows when it is complete, because Z.ai’s answers come through the Molkit server in one piece.
  • If the provider sends nothing for 90 seconds, Molkit stops waiting and shows an error card, such as “Gemini has not answered in 90 s”, with Retry.
  • A run card names what the run made and has Undo and Show in script window. Click Script in the card to see the script that ran, with Copy. When the script exports files, the card says how many are ready, such as “2 files ready: water.svg, water.png”, with Save. Nothing is saved until you click Save; several files save as one ZIP.
  • An error shows in a red card with a short title. Retry sends the same request again. When the provider does not accept the key, the card also has Key, which opens the Key panel.
  • Stopped. shows as a quiet line when you stop a request. Stop works while an answer is arriving, too; the words that had arrived stay in the conversation.

The AI chat uses your own API key from one of the providers below. Molkit does not supply a key, and the provider bills your account with them for what the chat uses.

  1. Get a key from one of these providers:

    Provider Key from
    Anthropic (Claude) console.anthropic.com
    OpenAI (GPT) platform.openai.com
    Google (Gemini) aistudio.google.com
    OpenRouter (many models) openrouter.ai
    Z.ai (GLM) z.ai
  2. Click the AI chat button in the tool palette. Until you save a key, the Key panel opens at the top of the chat window, ready for your key. Later, click the model name in the chat’s title bar, or More > Key, to open the panel again.

  3. In Provider, choose your key’s provider. Paste the key and click Save.

  4. Click Test. One small request goes to the provider, and the answer is a message such as “Works: claude-… answered in 0.8 s”, or the provider’s own error.

The Model field holds the provider’s default model. To use another model, type its name in the field. With a Gemini 3 model, the panel also has Thinking: Low (the default) answers fastest; Medium and High think longer first, which is slower and uses more tokens, for harder requests.

How the key is kept:

  • For this session only, by default: closing the tab forgets it.
  • Remember this key on this device: the key is stored encrypted in this browser. Anyone who uses this browser profile can use it, so leave this off on shared or classroom computers.
  • Clear stored key forgets every stored key in this browser.
  • Your key is sent only to its provider. The one exception is a Z.ai key, which goes through molkit.com (see the next item). Molkit does not send a key to any other address.
  • Z.ai goes through molkit.com. Z.ai does not accept calls from a web page, so a Z.ai call goes to molkit.com first, which passes it on to Z.ai. molkit.com does not store or log the key. A Z.ai GLM Coding Plan key also works.

You choose what the AI may do with the mode buttons left of Send; the AI never changes the mode itself. Point to a mode to see what it does.

ModeWhat happens
Do itThe AI writes a script and runs it. Each run gets a card that names what it made, with Undo.
With meYou and the AI work on the script in the box. The AI reads your script and proposes changes; you Accept or Reject each one, then run the script yourself. The AI never runs anything.
Ask firstBefore any script runs, a card shows it with Run it and Don’t run. If you click Stop while the card waits, the script does not run and the card says it stopped.

When a conversation starts, the mode follows what is in the box: a script of yours selects With me, and an empty box selects Do it. You can pick another mode at any time.

The AI sees your document through Molkit, not through the screen. It can:

  • List every object by name, with what it is attached to, the document’s settings, and what you have selected (as describe does).
  • Look up an object’s size, neighbors, colors (with the atoms and bonds each color is on), chemistry (formula, SMILES, charges, structure warnings), and animations. When it draws mechanism arrows, it can also ask where each atom sits and which way each bond points.
  • Take a picture of part of the canvas, only when how something looks matters. Models that cannot read pictures skip this.
  • Read the calculations stored with the document (a mechanism’s barrier and reaction energy, a spectrum) and each animation’s panes and timing.
  • Read an image placed on the canvas, such as a photographed structure, to build from.
  • Find the tested example scripts closest to your request, and look up the full entry of a command.
  • Check a script for problems before it runs, explain what one line would do, and try a script in a run that is undone at once.

What you have selected goes with every message, so a request such as “make these blue” works. The @ button beside the message box puts the names of the selected objects into your message.

You can ask the AI to draw what a picture shows: a structure from a textbook page, a mechanism from a slide, a reaction from a paper. There are two ways to give it the picture.

  • On the canvas. Paste or import the picture, select it, and ask, for example, “draw this as a Lewis structure”. Pictures are named like everything else (image-1, image-2), so you can also name one: “draw the mechanism in image-2”. The AI reads the picture itself, as you cropped it: a part you cropped away is never sent. If several pictures could be meant and none is selected, it asks which; a request for all of them, such as “draw every structure in these pictures”, reads each one without asking. The picture stays where it is, and the AI places what it draws beside it, on a side with room, so it does not cover what already sits next to the picture. A Plotly figure is read as its data, not as a picture.
  • In the message. Click the paperclip beside the mode switch, or paste or drop files on the message box. Each file shows as a box above the message box; its × removes it. You can attach pictures (PNG, JPEG, WebP, GIF, BMP), SVG files, PDF files, and text files such as .tex, .csv, .xyz, or .mol: up to 5 files, at most 10 MB each and 15 MB together (8 MB with Z.ai). A file that cannot go is not added, and the line under the boxes says why.
    • PDF pages. A PDF’s box has a pages field: leave it empty to send every page, or type the pages you want, such as 1-3, 7. At most 20 pages go with a message; a longer PDF is added with pages 1-20 chosen, and the line under the boxes says so. Molkit cannot always count a PDF’s pages when you add it; such a PDF goes whole, and the provider’s own page limit applies, unless you choose pages. Pressing Enter in the pages field returns you to the message box.

Molkit scales a picture down to at most 1568 pixels on its longer side before sending it. A file goes with its message only: once the AI has answered, the file’s contents leave the conversation and are not sent again; the conversation keeps only the file’s name. After Stop, Retry sends the file again, but a new message does not.

Some models cannot read pictures: Z.ai’s GLM text models (the GLM V models can) and DeepSeek models through OpenRouter. With one of those, the AI is not offered pictures, and an attached picture is refused before anything is sent; an attached PDF goes as the text of its pages instead.

Most providers read a PDF file directly. For Z.ai, or when you choose pages, Molkit draws each page as a picture and sends it with the page’s text. The first PDF sent as pages takes a moment longer.

When a provider refuses a file:

  • If it refuses a picture, the chat says so and stops sending pictures in the conversation.
  • If it refuses a PDF file, later PDFs go as page pictures.
  • New conversation starts afresh.
  • A busy provider or a lost connection does not count: Retry sends the file again.
  • A run’s Undo takes back that run only, and only while it is the latest change. If you have changed the document since, Undo says so instead of undoing your work too.
  • Ctrl+Z works as usual: each AI run is one undo step.
  • If you switch document tabs while the AI is working, it stops acting, so nothing it does lands in the other document.

Above the message box of a new conversation, the chat says what goes to the provider: your request; the names, structures (as SMILES), positions, and texts on the canvas; your script when the AI reads it; pictures of the canvas when it looks; a picture on the canvas when it reads one; and the files you attach. Got it hides the note for that provider.

Each document tab has its own conversation. It is kept until you close the tab (never in the .mkit file), and New conversation starts a new one. A new conversation does not clear the script box, and when that box holds a script, the new conversation starts in With me mode.

Typing /clear or /new in the message box and pressing Enter does the same as New conversation; nothing is sent to the provider.

  • Anything typed after it is not sent either, and the chat says so.
  • Files you attached stay for your next message.
  • While a request is running, /clear asks you to stop it first.
  • Any other word after a slash at the start of a message, such as /reset, is answered by Molkit and not sent. To send a message that starts with a slash, start it with a space.

Save as script writes the scripts the AI ran, each under the request that asked for it, as one .mkscript file. The number of tokens the conversation has used shows under the message box.

With every request, the AI gets a short summary of the language and a list of every command with its options. When it needs the details of a command, such as every value an option takes, it looks the command up in the Command reference; Steps shows this as, for example, “Looked up draw, arrow”.

The AI can do only what Molkit Script can do, and it says so when you ask for something else. See the Command reference for what the language covers.