# askopenai: Ask OpenAI

> askopenai (Ask OpenAI) is a 1001fx API function in the group AI: POST https://api.1001fx.com/ai/askopenai, 4 credits per 1,000 tokens (minimum 4). It works as a ready-made module in Make and n8n or as a plain HTTP call.

Get answer from OpenAI GPT. Will be charged per used OpenAI tokens.

- This service is provided by an external service provider: Microsoft Azure OpenAI. The data of the call is sent to the provider. [More about service providers](https://1001fx.com/functions#serviceproviders)

- Group: AI
- Endpoint: `POST https://api.1001fx.com/ai/askopenai`
- Authentication: header `X-API-KEY: YOURSECRETAPIKEY`
- Content type: application/json
- Credits: 4 credits per 1,000 tokens (minimum 4)
- Ready-made in: Make and n8n
- Service provider: OpenAI
- Docs: https://1001fx.com/functions/askopenai

## Parameters

- `prompt` (string, required) – Prompt: Prompt that will be send to OpenAI
- `temperature` (number, optional, default `1`, min 0, max 2) – Temperature: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
- `maxTokens` (number, optional, default `16`) – Max Tokens: The maximum number of tokens to generate in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length. Most models have a context length of 2048 tokens(except for the newest models, which support 4096). 1 token ~= 4 chararcters in english, 1 token ~= 3/4 words
- `model` (enum, required, one of `text-davinci-003`, `text-davinci-002`, `text-curie-001`, `text-babbage-001`, `text-ada-001`, `gpt-6.1-terra`, `gpt-6-luna`, default `gpt-6-luna`) – Model: Open AI model to be used. Defaults to gpt-6-luna

## Example: Ask open ai

```bash
curl -X POST 'https://api.1001fx.com/ai/askopenai' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"prompt":"Explain nocode software development to a six year old kid.","temperature":0.8,"maxTokens":16,"model":"text-davinci-003"}'
```
