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

# OpenAI

> Query OpenAI models, generate text responses, embeddings, and images via the OpenAI API

## At a glance

* **Availability**: Experimental ([how to enable](/cloud/integrations)).
* **Auth**: API key.
* **Connection**: The key from `OPENAI_API_KEY` is sent as the `Bearer` prefixed `Authorization` header.
* **Docs**: [https://platform.openai.com/docs/api-reference/authentication](https://platform.openai.com/docs/api-reference/authentication)

## Credentials

Set these per environment. See [Connect an integration](/cloud/integrations).

| Variable         | Required | Description                                                                    |
| ---------------- | -------- | ------------------------------------------------------------------------------ |
| `OPENAI_API_KEY` | Yes      | OpenAI API key (starts with sk-) [Docs](https://platform.openai.com/api-keys). |

## Setup

1. **Create an OpenAI account**: Go to [https://platform.openai.com](https://platform.openai.com) and sign up or sign in. New accounts may need to add billing details under Settings → Billing before API calls succeed.
2. **Create an API key**: Open [https://platform.openai.com/api-keys](https://platform.openai.com/api-keys), click 'Create new secret key', give it a descriptive name (e.g. 'Veryfront Integration'), and select the project it belongs to.
3. **Copy and store the key**: Copy the key immediately - it is only shown once. Add it to your .env file as OPENAI\_API\_KEY=sk-...
4. **Verify access**: Run the List Models tool to confirm the key works. If you get a 401, check the key; if a 429, check your billing/quota.

* Use project-scoped API keys to limit blast radius; you can revoke keys at any time from the dashboard
* API usage is billed per token - set usage limits under Settings → Limits
* The Get Completions Usage and Get Costs tools call the organization usage API, which only accepts admin API keys created at [https://platform.openai.com/settings/organization/admin-keys](https://platform.openai.com/settings/organization/admin-keys) - set one as OPENAI\_API\_KEY to use them
* The Upload File tool sends multipart/form-data with a binary file part; pass the file content base64-encoded

Provider API reference: [https://platform.openai.com/docs/api-reference](https://platform.openai.com/docs/api-reference)

## Tools

| Tool                   | Access | Description                                                                                                                                                                                                                          |
| ---------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| List Models            | Read   | List the models available to the API key                                                                                                                                                                                             |
| Get Model              | Read   | Get details about a specific model                                                                                                                                                                                                   |
| Create Response        | Write  | Generate a model response using the OpenAI Responses API                                                                                                                                                                             |
| Create Chat Completion | Write  | Generate a chat completion from a list of messages                                                                                                                                                                                   |
| Create Embedding       | Write  | Create an embedding vector for input text                                                                                                                                                                                            |
| Generate Image         | Write  | Generate an image from a text prompt                                                                                                                                                                                                 |
| Upload File            | Write  | Upload a file for use with assistants, batch, fine-tune, vision, user\_data, or evals                                                                                                                                                |
| List Files             | Read   | List files uploaded to the organization, optionally filtered by purpose                                                                                                                                                              |
| Get File               | Read   | Get metadata about an uploaded file by ID                                                                                                                                                                                            |
| Delete File            | Write  | Delete an uploaded file and remove it from all vector stores                                                                                                                                                                         |
| Get Completions Usage  | Read   | Get token usage for completions across the organization, bucketed over time. Requires an organization admin API key (created under Settings → Organization → Admin keys) set as OPENAI\_API\_KEY - a regular project key returns 401 |
| Get Costs              | Read   | Get daily spend (in USD) for the organization, bucketed by day. Requires an organization admin API key (created under Settings → Organization → Admin keys) set as OPENAI\_API\_KEY - a regular project key returns 401              |
| Get File Content       | Read   | Download the raw contents of an uploaded file by ID - required to read batch output files and other generated artifacts                                                                                                              |
| Get Embeddings Usage   | Read   | Get token usage for embeddings across the organization, bucketed over time. Requires an organization admin API key (created under Settings → Organization → Admin keys) set as OPENAI\_API\_KEY - a regular project key returns 401  |

## Example prompts

* List the OpenAI models available to my API key and summarize what each is best for.
* Use OpenAI to generate a response to a prompt I provide.
