> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Profile API • AI Agents Framework

> profile_api: Decorator to profile a function as an API call.

# profile\_api

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**profiler**](../modules/profiler) module.

Decorator to profile a function as an API call.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def profile_api(func: Optional[Callable]) -> Any
```

## Parameters

<ParamField query="func" type="Optional" required={false}>
  No description available.
</ParamField>

### Returns

<ResponseField name="Returns" type="Any">
  The result of the operation.
</ResponseField>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
@profile_api(endpoint="openai/chat")
    def call_openai():
        pass
```

## Uses

* `Profiler.is_enabled`
* `fn`
* `time.perf_counter`
* `Profiler.record_api_call`
* `functools.wraps`
* `decorator`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai/praisonai/profiler.py#L1010">
  `praisonai/profiler.py` at line 1010
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Agent Profiles" icon="id-card" href="/docs/features/agent-profiles" />

  <Card title="Profiling" icon="chart-line" href="/docs/features/profiling" />
</CardGroup>
