---
title: "Chat Completions Openai"
method: POST
path: "/agents/v1/{api_key}/chat/completions"
tags: ["agents"]
---

# Chat Completions Openai

`POST /agents/v1/{api_key}/chat/completions`

OpenAI-compatible chat completions endpoint.

Use this endpoint to integrate with any OpenAI-compatible client.

Example with OpenAI Python client:
```python
from openai import OpenAI

client = OpenAI(
    api_key="your-agent-api-key",
    base_url="https://studio-api.meganova.ai/api/agents/v1/your-agent-api-key"
)

response = client.chat.completions.create(
    model="agent",
    messages=[{"role": "user", "content": "Hello!"}]
)
```

## Path parameters

- `api_key` string, required

## Request body

- OpenAIChatCompletionRequest — OpenAI-compatible chat completion request.
  - `model` string, nullable
  - `messages` OpenAIChatMessage[], required
    - `role` string, required
    - `content` string, required
  - `temperature` number, nullable
  - `max_tokens` integer, nullable
  - `stream` boolean, nullable
  - `top_p` number, nullable
  - `frequency_penalty` number, nullable
  - `presence_penalty` number, nullable
  - `stop` string[], nullable
  - `user` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/meganova/apis/fastapi.md) · [All operations](https://skmtc.net/meganova/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/meganova/fastapi/revisions/2b2bab8b9017/schema)
