Skip to content

AI assistant

The built-in AI assistant is a chat panel that can read the current request and response as context — useful for explaining an API, drafting a payload, debugging a failed response, or generating a test script.

  • OpenAI (GPT-4o, GPT-4.1, o-series).
  • Anthropic (Claude Sonnet 4.x, Haiku 4.x).
  • OpenRouter — any model OpenRouter relays.

For each provider, paste your own API key (stored as a SecretRef, never plaintext in the renderer). You can also point any of them at a custom base URL for self-hosted gateways or local model servers.

When you invoke a chat that references the current request, Restura builds a context snapshot:

  • The request URL (path only — host is redacted).
  • The request method and selected protocol.
  • Headers (sensitive ones — Authorization, Cookie, X-Api-Key — redacted).
  • The request body (JSON pretty-printed, large blobs truncated).
  • The response status, headers, and body (with the same redaction rules).
  • The active environment name (variables not exposed).

The snapshot is what goes to the provider. Secrets and absolute URLs are stripped before the prompt is sent.

  • Desktop — fully wired. The renderer streams chunks from the Electron main process over IPC; the main process talks to the provider directly. primary path
  • Web — not available. There is no /api/ai Worker route, so the AI assistant is Electron-only. (Web support is on the roadmap but requires care around browser-side API-key handling.)
  • Explain the current request or response in plain language.
  • Generate a body, a header value, a test script, or a curl command for the current request.
  • Debug — paste in the response and ask why it’s 4xx.
  • Compose a saved request or explain how to carry values through collection scripts. OWS workflows do not provide response extraction semantics.

You don’t have to open the chat to use the assistant on the request you’re editing. The URL bar’s AI menu (the sparkle icon) and the test script tab expose one-click actions:

  • Fix request — diagnoses the current request and its response, then proposes a corrected request.
  • Generate tests — writes assertions for the response (status, fields, edge cases) into the test script.
  • Enrich docs — writes markdown documentation for the request (it shows under the URL bar and in generated collection docs).

Each action opens the assistant and proposes a change as a card. Nothing is applied until you click Apply — the same propose-&-apply consent model as the chat. The buttons only appear once a provider is configured.

For multi-step work, click the robot icon in the assistant header and give it a goal — e.g. “make this request succeed and add tests for it.” The agent works one step at a time:

  1. It proposes a single action (a tool call).
  2. You review and Apply it (or Dismiss to stop).
  3. The updated request context is sent back and the agent proposes the next step.

It stops when the goal is met, when you hit Stop, or at a hard step limit. Every mutation is still explicitly approved — Agent Mode never changes your request without a click. A status banner shows the goal and step count while it runs.

  • Keep prompts short and reference the current request explicitly — the snapshot is dense; you don’t need to repeat what’s already there.
  • For long debugging sessions, save the chat to history — chat history lives alongside request history.
  • AI Lab — the desktop-only workbench for testing prompts and models (datasets, evals, LLM-as-judge, local runtimes).
  • MCP server mode — expose Restura’s data to an external agent.
  • Architecture / Security — secrets-at-rest, redaction.