> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI File Input Direct

> Attach files by URL, local path, or raw bytes to a Responses API agent.

```python file_input_direct.py theme={null}
"""
Openai File Input Direct
========================

Cookbook example for `openai/responses/file_input_direct.py`.
"""

from pathlib import Path

from agno.agent import Agent
from agno.media import File
from agno.models.openai.responses import OpenAIResponses
from agno.utils.media import download_file

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

agent = Agent(
    model=OpenAIResponses(id="gpt-5.6-luna"),
    markdown=True,
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    # File via URL
    agent.print_response(
        "Summarize the key contribution of this paper in 2-3 sentences.",
        files=[File(url="https://arxiv.org/pdf/1706.03762")],
    )

    # File via local filepath
    pdf_path = Path(__file__).parent.joinpath("ThaiRecipes.pdf")
    download_file(
        "https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf", str(pdf_path)
    )

    agent.print_response(
        "List the first 3 recipes from this cookbook.",
        files=[File(filepath=pdf_path, mime_type="application/pdf")],
    )

    # File via raw bytes
    csv_content = b"name,role,team\nAlice,Engineer,Platform\nBob,Designer,Product\nCharlie,PM,Growth"

    agent.print_response(
        "Describe the team structure from this CSV.",
        files=[File(content=csv_content, filename="team.csv", mime_type="text/csv")],
    )
```

## Run the Example

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno openai
```

**2. Export your OpenAI API key**

```bash Mac/Linux theme={null}
export OPENAI_API_KEY="your_openai_api_key_here"
```

```bash Windows theme={null}
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

**3. Run the example**

Save the code above as `file_input_direct.py`, then run:

```bash theme={null}
python file_input_direct.py
```

Full source: [cookbook/90\_models/openai/responses/file\_input\_direct.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/90_models/openai/responses/file_input_direct.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.