Skip to content

protocols

AI requests

Send prompts to OpenAI, Anthropic, Google Gemini and OpenAI-compatible models from Cloak Proxy, stream answers, give the model MCP tools and test the output.

An AI request sends a prompt to a language model and shows its answer as it streams in. You pick the provider and model, write a system prompt and a user prompt with {{variables}}, and can give the model tools from your saved MCP servers, which Cloak Proxy runs for it in a loop. Use it to try prompts against your API’s data, to compare models, to test an MCP server the way an assistant would use it, or to check model output in the collection runner.

  1. Store your provider’s API key in the vault. New AI requests look for a vault entry named anthropic_api_key. Name keys for other providers as you like, for example openai_api_key.

  2. In the API client, click New › Other Protocols › AI, or right-click a collection and choose Add Other Request › AI. Search Everything (⇧ ⌘ A) also has New AI Request.

  3. Choose a provider and a model at the top of the request.

  4. Open Settings and check the API key field references your vault entry, for example {{vault:openai_api_key}}.

  5. Write your prompt in Prompt, and optionally a system prompt in System.

  6. Press ⌘ ↩ or click Send. The answer streams into Response.

A new AI request. The answer streams into Response; the log on the right shows the request and any tool calls.

  1. Provider
  2. Model from the suggestions, or Default
  3. Any model id
  4. Send (⌘↩)
  5. MCP Tools: give the model tools
  6. New Conversation clears the history
  7. Messages log
An AI request with provider Anthropic, model Default (claude-opus-5-5), a Model id field, and the prompt Summarize what this API does in one paragraph, above an empty Response pane and Messages log
Provider API Default base URL API key sent as
Anthropic (default) Messages API https://api.anthropic.com x-api-key header
OpenAI Chat Completions https://api.openai.com/v1 Authorization: Bearer header
Google Gemini generateContent https://generativelanguage.googleapis.com/v1beta x-goog-api-key header
OpenAI-compatible Chat Completions at a base URL you choose http://localhost:11434/v1 (Ollama) Authorization: Bearer header, only when a key is set

OpenAI-compatible covers any server that speaks the Chat Completions format, such as Ollama, LM Studio, vLLM and OpenRouter. Local servers usually need no key.

The model menu offers Default (the first model below) and a list of suggestions for the provider:

Provider Suggested models
Anthropic claude-opus-5-5, claude-sonnet-5-5, claude-haiku-5-5, claude-opus-4-8, claude-sonnet-4-6, claude-haiku-4-5
OpenAI gpt-4.1, gpt-4.1-mini, gpt-4o, gpt-4o-mini, o4-mini, o3
Google Gemini gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite
OpenAI-compatible llama3.2, qwen2.5, mistral, openai/gpt-4o-mini

To use any other model, type its id in Model id (any). Whatever you type there is the model the request uses.

Typical setups:

Field Value
Provider Anthropic
API key {{vault:anthropic_api_key}}
Base URL Empty
Tab What it holds
Prompt The user message. {{variables}} are filled in when you send.
System An optional system prompt, also with {{variables}}. A dot on the tab means it’s set.
MCP Tools MCP servers whose tools the model may call (see below). The badge counts the selected servers.
Settings The key, base URL and generation settings.
Setting Default What it does
API key {{vault:anthropic_api_key}} The provider key. Type a reference such as {{vault:openai_api_key}} rather than the key itself. If the reference can’t be resolved, the request is sent without a key and the provider answers with an authentication error.
Base URL (optional; Ollama: http://localhost:11434/v1) Empty Overrides the provider’s default base URL. For OpenAI-compatible servers, /chat/completions is added to the base URL; a full URL that already ends in /chat/completions (optionally with a query string) is used as is. {{variables}} work.
Temperature 1.0 Randomness, from 0 to 2.
Max tokens 1024 The longest answer allowed, from 16 to 64,000 in steps of 256.
JSON output Off Asks for a single JSON object: OpenAI-style JSON mode for OpenAI and compatible servers, a JSON response type for Gemini, and an instruction added to the system prompt for Anthropic.

In the editor, answers stream token by token into Response, with You and Assistant labels. Each Send adds your current prompt to the same conversation, so you can ask follow-up questions; click New Conversation to start over. Stop cancels an answer in progress.

Next to the Response heading, Cloak Proxy shows the latency, the time to the first token, and the input and output token counts the provider reported.

Without MCP tools, the Messages log on the right shows the exact HTTP request sent to the provider as a cURL command, with the API key redacted. Errors appear there as Request failed, with the provider’s message.

An AI request can let the model call tools from MCP servers you’ve saved as MCP requests. Cloak Proxy connects to those servers, offers their tools to the model, runs each tool call the model makes, and sends the results back, repeating until the model gives a final answer. This is the same loop an AI assistant runs.

  1. Save at least one MCP request in a collection. Requests in the MCP section count.

  2. In the AI request, open MCP Tools. Every MCP request in your workspace is listed as name · command or URL.

  3. Check the servers whose tools the model may use.

  4. Set Max steps, from 1 to 30 (default 8). A step is one call to the model; the loop stops when the model answers without calling a tool, or after this many steps.

  5. Send the prompt.

While the loop runs, the log shows how many tools are available, each tool call as server · tool with its arguments, and each result as tool · 140 ms (in red when the tool reported an error). The answer area shows the model’s text from every step.

How the loop works:

  • Tools from all selected servers are offered together. When two servers have a tool with the same name, the second is renamed to server__tool. Names are made safe for the model’s API and kept to 64 characters.
  • All tool calls the model makes in one step run at the same time; their results go back in the order the model asked.
  • Arguments are checked against the tool’s input schema first. Invalid arguments, unknown tools and failed calls are sent back to the model as error results, so it can correct itself.
  • A server that fails to list its tools is logged and skipped; the others still work.
  • The MCP servers are connected when you send, and closed when the answer is complete.

The collection runner and cloakctl send a saved AI request as a single, non-streaming call with the Prompt as the only user message. With MCP servers selected, they run the tool loop to the end. The run waits at least 60 seconds for the model to start answering, or the request timeout if that’s longer.

Response part Value
Status 200 OK when the model answered. Provider errors, such as a bad key or an unknown model, are reported as an error with no response.
Content-Type text/plain; charset=utf-8, or application/json with JSON output on.
x-ai-provider openAI, anthropic, gemini or openAICompatible.
x-ai-model The model that answered.
x-ai-input-tokens, x-ai-output-tokens Token usage, summed over every step of a tool loop, when the provider reports it.
x-ai-stop-reason The provider’s stop reason, or for a tool loop finalAnswer or maxStepsReached.
Body The model’s final text. With JSON output on, a surrounding Markdown code fence is removed so pm.response.json() works.

AI requests have no Scripts tab of their own. Put tests in the collection’s or a folder’s post-response script, and check pm.info.requestName for tests meant for one request:

Collection post-response script
if (pm.info.requestName === "Classify ticket") {
pm.test("model returned a known category", () => {
const answer = pm.response.json();
pm.expect(["bug", "question", "feature"]).to.include(answer.category);
});
pm.test("stayed within budget", () => {
pm.expect(Number(pm.response.headers.get("x-ai-output-tokens"))).to.be.below(300);
});
}

Model output varies from run to run, even with a low temperature. Test for structure and ranges rather than exact text.