# Default Configuration

ShipWithDjango provides the capability to integrate with OpenAI's powerful tools, including DALL-E for generating images from textual descriptions. To use these features, you need to configure your OpenAI API key.

The configuration settings for OpenAI are managed in the `CONFIG/openai.py` file.

### Setting the OpenAI API Key

To enable the integration with OpenAI, you need to set the `OPENAI_API_KEY` variable in your environment variable. This key is essential for authenticating your requests to OpenAI's API, allowing your application to leverage the capabilities of OpenAI models, including DALL-E.

```python
OPENAI_API_KEY = secret_manager.get_secret('OPENAI_API_KEY')
```

[Find out here how you can set your OpenAI API key as an environment variable.](/secret-management/setting-your-environment-variables.md)

#### Obtaining Your OpenAI API Key

1. **Sign Up or Log In**: If you don't already have an OpenAI account, you'll need to sign up at [OpenAI's website](https://beta.openai.com/signup/). If you have an account, log in.
2. **API Key Access**: Once logged in, navigate to the API section of your account where you can generate a new API key.
3. **Set the API Key**: Copy the generated API key and set it your `OPENAI_API_KEY` environment variable.

#### Using OpenAI and DALL-E in Your Application

Once your API key is configured, your application will be able to interact with OpenAI's services. This includes generating images with DALL-E based on textual input, which can be a powerful feature in various use cases, from creative projects to dynamic content generation.

#### Security Considerations

It's important to keep your OpenAI API key secure. Do not expose this key in public repositories or share it openly. In ShipWithDjango, the `secret_manager` handles the retrieval of sensitive information, such as your API key, ensuring it is stored securely.

### Summary

To enable OpenAI integration in ShipWithDjango:

1. Obtain your OpenAI API key from [OpenAI's website](https://beta.openai.com/signup/).
2. Set the `OPENAI_API_KEY` variable in your environment.
3. Ensure that your API key is kept secure and is not exposed publicly.

With these steps, you can unlock the full potential of OpenAI and DALL-E within your ShipWithDjango project, enabling advanced AI-driven features and capabilities.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shipwithdjango.com/openai-dall-e/default-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
