This method is currently no longer valid.
What is ChatGPT?
ChatGPT is a language model developed by OpenAI, utilizing generative pre-trained transformers (GPT) to learn natural language processing capabilities through extensive textual content. It understands user inputs and generates corresponding responses based on the context.
In programming, ChatGPT can answer questions about various programming languages, libraries, and frameworks, provide code snippets, and explain their workings or give relevant suggestions.
It can also offer advice on editing and proofreading or translate content into English, Japanese, and other languages.
While it is an essential tool for modern computer users, it should not be overly relied upon, as the output may sometimes contain incorrect information.
ChatGPT API Key
Traditionally, to use ChatGPT, you would visit the official website and use the web interface to interact and receive responses.
With the API key provided by OpenAI, you can access the service through the official API, integrating it with other services.
For example, using an API key, you can:
- Integrate with VS Code plugins (Genie AI for coding queries and suggestions)
- Use browser extensions (ChatGPT Summary for Chrome for page summaries)
- Use command line interfaces (SGPT for direct interaction with ChatGPT in the terminal)
- Translation software
- Mobile apps (Keybot, OpenCat, etc.)
The pricing for API keys, according to the official description, can be summarized in the table below:
Model | Input | Output |
---|---|---|
gpt-3.5-turbo-1106 | $0.0010 / 1K tokens | $0.0020 / 1K tokens |
gpt-3.5-turbo-instruct | $0.0015 / 1K tokens | $0.0020 / 1K tokens |
gpt-4-1106-preview | $0.01 / 1K tokens | $0.03 / 1K tokens |
gpt-4-1106-vision-preview | $0.01 / 1K tokens | $0.03 / 1K tokens |
gpt-4 | $0.03 / 1K tokens | $0.06 / 1K tokens |
gpt-4-32k | $0.06 / 1K tokens | $0.12 / 1K tokens |
A verified phone number provides $5 of usage credit within three months. You can generate an API key via the official channel and start using it immediately.
For unverified accounts or accounts that have exhausted their credit, a session API key is generated when logging into the API page. This key allows access to ChatGPT API without any cost.
Obtaining the Session API Key
First, log in at the official website (Login). If you don’t have an account, you can register one without phone number verification.
After logging in, the URL should be https://platform.openai.com/docs/overview
Open Developer Tools (F12) and find the Network tab.
Refresh the page to see the login entry. In the preview on the right, you will find the
sensitive_id
, which is the session key or API key.
Conclusion
After copying the API key, you can paste it into any third-party application requiring the API. The key features are:
- Valid for 14 days; a new key is required after expiry.
- Re-logging within 14 days will invalidate the key.
- Supports only gpt-3.5 and lower versions; gpt-4 is not supported.
- Use it discreetly.
References
- ChatGPT