# convert_to_openai_data_block

> **Function** in `langchain_core`

📖 [View in docs](https://reference.langchain.com/python/langchain-core/messages/block_translators/openai/convert_to_openai_data_block)

Format standard data content block to format expected by OpenAI.

"Standard data content block" can include old-style LangChain v0 blocks
(URLContentBlock, Base64ContentBlock, IDContentBlock) or new ones.

## Signature

```python
convert_to_openai_data_block(
    block: dict,
    api: Literal['chat/completions', 'responses'] = 'chat/completions',
) -> dict
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `block` | `dict` | Yes | The content block to convert. |
| `api` | `Literal['chat/completions', 'responses']` | No | The OpenAI API being targeted. Either "chat/completions" or "responses". (default: `'chat/completions'`) |

## Returns

`dict`

The formatted content block.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/02991cb4cf2063d51a07268edafb05fe53de1826/libs/core/langchain_core/messages/block_translators/openai.py#L58)