curl --request POST \
--url 'https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY=' \
--header 'Content-Type: application/json' \
--data '
{
"circuit_ids": [
"circ-abc123",
"circ-def456"
],
"experiment_id": "exp-123",
"parameters": {
"compression_level": "balanced",
"fine_tuning": "low",
"noise_profile": "default"
}
}
'import requests
url = "https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY="
payload = {
"circuit_ids": ["circ-abc123", "circ-def456"],
"experiment_id": "exp-123",
"parameters": {
"compression_level": "balanced",
"fine_tuning": "low",
"noise_profile": "default"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
circuit_ids: ['circ-abc123', 'circ-def456'],
experiment_id: 'exp-123',
parameters: {compression_level: 'balanced', fine_tuning: 'low', noise_profile: 'default'}
})
};
fetch('https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'circuit_ids' => [
'circ-abc123',
'circ-def456'
],
'experiment_id' => 'exp-123',
'parameters' => [
'compression_level' => 'balanced',
'fine_tuning' => 'low',
'noise_profile' => 'default'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY="
payload := strings.NewReader("{\n \"circuit_ids\": [\n \"circ-abc123\",\n \"circ-def456\"\n ],\n \"experiment_id\": \"exp-123\",\n \"parameters\": {\n \"compression_level\": \"balanced\",\n \"fine_tuning\": \"low\",\n \"noise_profile\": \"default\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY=")
.header("Content-Type", "application/json")
.body("{\n \"circuit_ids\": [\n \"circ-abc123\",\n \"circ-def456\"\n ],\n \"experiment_id\": \"exp-123\",\n \"parameters\": {\n \"compression_level\": \"balanced\",\n \"fine_tuning\": \"low\",\n \"noise_profile\": \"default\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"circuit_ids\": [\n \"circ-abc123\",\n \"circ-def456\"\n ],\n \"experiment_id\": \"exp-123\",\n \"parameters\": {\n \"compression_level\": \"balanced\",\n \"fine_tuning\": \"low\",\n \"noise_profile\": \"default\"\n }\n}"
response = http.request(request)
puts response.read_body{
"context": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Compress Circuit With State Compression
Submit state-compression jobs for existing or inline circuits.
Use this tool when the caller wants to run Haiqu state compression on
either an existing stored circuit or a new inline QASM payload. At least
one of circuit_ids or circuit_qasm must be supplied, and the
response schema is a lightweight {"context": ...} wrapper rather than a
structured job object.
When to Use:
- Call this when the workflow needs a compressed or optimized circuit derived from an existing circuit or from inline QASM.
- Call this before later execution or circuit analysis when the user wants Haiqu state compression applied first.
Constraints:
- Provide at least one of
circuit_idsorcircuit_qasm. - The response is a lightweight context wrapper; use
get_job_results_and_statusto retrieve terminal outputs such as the generated circuit ID. - This docstring does not promise normalized
404handling for every invalid circuit reference because the lower-layer compression path owns part of that behavior.
Notes:
- If inline QASM is provided, the endpoint may create a circuit first and then submit compression.
- The created or reused input circuit is stored as
input_circuit_idin the job record. - There is no practical size limit on
circuit_qasm. For circuits already stored, prefercircuit_idsso large QASM payloads are sent at most once; never downscale an instance because its QASM looks large.
The batch of compression jobs could be submitted via circuit_ids. If both
circuit_ids and circuit_id are provided, circuit_ids will be used and
circuit_id will be ignored, it is deprecated.
Args:
user: Authenticated user resolved from the API key.
data: Compression payload. One of circuit_ids or circuit_qasm
must be provided.
db: Active database session.
Returns: A lightweight context wrapper summarizing the submission and next polling step.
Raises:
HTTPException: Raised with 400 when neither circuit input mode is
provided, 402 when the caller cannot submit billable jobs, or
404 when the experiment is not available to the caller.
curl --request POST \
--url 'https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY=' \
--header 'Content-Type: application/json' \
--data '
{
"circuit_ids": [
"circ-abc123",
"circ-def456"
],
"experiment_id": "exp-123",
"parameters": {
"compression_level": "balanced",
"fine_tuning": "low",
"noise_profile": "default"
}
}
'import requests
url = "https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY="
payload = {
"circuit_ids": ["circ-abc123", "circ-def456"],
"experiment_id": "exp-123",
"parameters": {
"compression_level": "balanced",
"fine_tuning": "low",
"noise_profile": "default"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
circuit_ids: ['circ-abc123', 'circ-def456'],
experiment_id: 'exp-123',
parameters: {compression_level: 'balanced', fine_tuning: 'low', noise_profile: 'default'}
})
};
fetch('https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'circuit_ids' => [
'circ-abc123',
'circ-def456'
],
'experiment_id' => 'exp-123',
'parameters' => [
'compression_level' => 'balanced',
'fine_tuning' => 'low',
'noise_profile' => 'default'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY="
payload := strings.NewReader("{\n \"circuit_ids\": [\n \"circ-abc123\",\n \"circ-def456\"\n ],\n \"experiment_id\": \"exp-123\",\n \"parameters\": {\n \"compression_level\": \"balanced\",\n \"fine_tuning\": \"low\",\n \"noise_profile\": \"default\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY=")
.header("Content-Type", "application/json")
.body("{\n \"circuit_ids\": [\n \"circ-abc123\",\n \"circ-def456\"\n ],\n \"experiment_id\": \"exp-123\",\n \"parameters\": {\n \"compression_level\": \"balanced\",\n \"fine_tuning\": \"low\",\n \"noise_profile\": \"default\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/ai/compress_circuit_with_state_compression?HAIQU_API_KEY=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"circuit_ids\": [\n \"circ-abc123\",\n \"circ-def456\"\n ],\n \"experiment_id\": \"exp-123\",\n \"parameters\": {\n \"compression_level\": \"balanced\",\n \"fine_tuning\": \"low\",\n \"noise_profile\": \"default\"\n }\n}"
response = http.request(request)
puts response.read_body{
"context": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Body
Define payload for MCP state-compression submissions.
The request may reference either an existing circuit_id or inline
circuit_qasm; endpoint-level validation enforces that at least one is
present.
Attributes: experiment_id: Parent experiment identifier for the compression job. name: Optional name to use when a new circuit must be created from inline QASM. circuit_id: Existing circuit ID to compress. Deprecated. circuit_ids: Existing circuit IDs to compress. circuit_qasm: Inline QASM source to persist and compress. compression_type: Compression backend or mode identifier. The default value should normally be left unchanged. parameters: Compression configuration forwarded to the backend.
State compression options: compression_level (low|balanced|high|max), noise_profile (e.g. default, ibm_heron_r2, iqm_garnet), fine_tuning (disabled|low|heavy, defaults to disabled if omitted), and optional approximation_level (int or null).
List of existing circuit IDs to compress.
Class for compression_type.
StateCompression, StateCompression2D, Su2EquivariantCompilation Name for the circuit to compress. Required if circuit_qasm is provided without circuit_id.
ID of the existing circuit to compress. Deprecated.
Quantum circuit in QASM 2.0 or 3.0 format. Use either this field or circuit_id field to specify the existing circuit ID to compress.
Response
Successful Response
Represent context payload returned after compression job creation.
Attributes:
context: Submission summary text including the created job ID and next
polling step. This response model does not expose structured
job_id or output circuit_id fields outside the text.