Image Generator API using Dall-E, C# ASP .NET, oAuth & Json Web Token
Report Bug
.
Request Feature
This project is created using C# ASP .NET and OpenAI Dall-E API to generate image.
This project use oAuth to log in users & using Json Web Token to validate requests. The users are registered in a Postgresql database.
It also uses AWS S3 to store the generated images.
At creation, the registered user has 1 credit. Each time he generates an image, he loses 1 credit. but there is an option to refill the credits by paying with Stripe (1€ / 5 credits).
To get a local copy up and running follow these simple example steps.
-
Get an API Key at [https://openai.com/]
-
Configure AWS IAM user, S3 and create a bucket. You will need the bucket name, region, access key and secret key.
-
Create a Stripe account and get the secret key.
-
Create a Postgresql database.
-
Clone the repo
git clone https://github.com/manesjonathan/image-generator-.NET.git
- Enter your credentials in
appsettings.json
{
"ConnectionStrings": {
"DatabaseURL": "Host=[DB_URL]; Database=[DB_NAME]; Username=[DB_USER]; Password=[DB_PASS]",
"StripeApiKey": "[SK_TEST]",
"StripePublishableKey": "[PK_TEST]",
"JWTSecret": "[JWT_SECRET]",
"WebhookSecret": "[WH_SECRET]",
"OpenAiApiKey": "[OPENAI_API_KEY]",
"AWSAccessKey": "[AWS_ACCESS_KEY]",
"AWSSecretKey": "[AWS_SECRET_KEY]"
}
}
-
Create the Stripe webhook in your Stripe account. If you run locally, you can use ngrok to create a public URL for your localhost. You need to configure webhook for the following event:
payment_intent.succeeded
-
Run the project
The following features are planned for the next release:
- Add a feature to rate the generated images
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- If you have suggestions for adding or removing projects, feel free to open an issue to discuss it.
- Please make sure you check your spelling and grammar.
- Create individual PR for each suggestion.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Jonathan Manes - Full Stack Developer