---
title: TranspilerService (latest version)
description: API reference for qiskit_ibm_transpiler.transpiler_service.TranspilerService in the latest version of qiskit-ibm-transpiler
source: https://quantum.cloud.ibm.com/docs/en/api/qiskit-ibm-transpiler/transpiler-service-transpiler-service
---

# TranspilerService

*class* `qiskit_ibm_transpiler.transpiler_service.TranspilerService(optimization_level, ai='true', coupling_map=None, backend_name=None, qiskit_transpile_options=None, ai_layout_mode=None, optimization_preferences=None, use_fractional_gates=False, **kwargs)`

[GitHub](https://github.com/Qiskit/qiskit-ibm-transpiler/tree/stable/0.18/qiskit_ibm_transpiler/transpiler_service.py#L40-L129)

Bases: [`object`](https://docs.python.org/3/library/functions.html#object)

Class for using the transpiler service.

**Parameters**

- **optimization\_level** ([*int*](https://docs.python.org/3/library/functions.html#int)) – The optimization level to use during the transpilation. There are 4 optimization levels ranging from 0 to 3, where 0 is intended for not performing any optimizations and 3 spends the most effort to optimize the circuit.
- **optimization\_preferences** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)  *|*[*list*](https://docs.python.org/3/library/stdtypes.html#list)*\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str)*], optional*) – Describe your preferences with a value or a list of values when prioritizing optimization. Allowed options: noise, n\_cnots, n\_gates, cnot\_layers, layers.
- **ai** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)*, optional*) – Specifies if the transpilation should use AI or not, defaults to True.
- **coupling\_map** ([*list*](https://docs.python.org/3/library/stdtypes.html#list)*\[*[*list*](https://docs.python.org/3/library/stdtypes.html#list)*\[*[*int*](https://docs.python.org/3/library/functions.html#int)*]], optional*) – A list of pairs that represents physical links between qubits.
- **backend\_name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)*, optional*) – Name of the backend used for doing the transpilation.
- **qiskit\_transpile\_options** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict)*, optional*) – Other options to transpile with qiskit.
- **ai\_layout\_mode** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)*, optional*) – Specifies how to handle the layout selection. There are 3 layout modes: keep (respects the layout set by the previous transpiler passes), improve (uses the layout set by the previous transpiler passes as a starting point) and optimize (ignores previous layout selections).
- **use\_fractional\_gates** ([*bool*](https://docs.python.org/3/library/functions.html#bool)) –

Initializes the instance.

## Methods

### run

`run(circuits)`

[GitHub](https://github.com/Qiskit/qiskit-ibm-transpiler/tree/stable/0.18/qiskit_ibm_transpiler/transpiler_service.py#L99-L129)

Transpile the circuit(s) by calling the service /transpile endpoint.

**Parameters**

**circuits** ([*list*](https://docs.python.org/3/library/stdtypes.html#list)*\[*[*QuantumCircuit*](/docs/api/qiskit/qiskit.circuit.QuantumCircuit)*] |* [*QuantumCircuit*](/docs/api/qiskit/qiskit.circuit.QuantumCircuit)) – circuit(s) to transpile.

**Returns**

The transpiled circuit(s)
