Published :
July 7, 2023

2 minutes

Use OpenAI's API Without Your Own API Key

Large language models are fantastic tools for many workflows. Simply using an AI chatbot like ChatGPT can speed up tasks from writing prose to wrangling data. But to really unlock the power of LLMs, you can combine them with a bit of programming to build your own tools.

At Neptyne, our mission is to make programming universally accessible. A Neptyne spreadsheet is the perfect place to build your own LLM-based tool: with a powerful spreadsheet and a zero-configuration Python environment, you're up and running in seconds.

But developing with third-party APIs like OpenAI typically means dealing with API keys. You register an account with OpenAI, provide your credit card, and add your key to your code. If you want to share your app with friends or colleagues, it means either sharing your key or forcing them to provision their own.

In Neptyne, we've removed this step. We've launched an AI proxy service that means you can experiment with OpenAI's ChatGPT API without setting up a developer account. Just use the openai Python package, and Neptyne will handle the rest:

import openai


def chat(prompt):
    # No key needed; Neptyne provides one:
    client = OpenAI()

    completion = client.chat.completions.create(
        model="gpt-4o",
        messages=[
            {
                "role": "assistant",
                "content": prompt,
            },
        ],
    )
    return completion.choices[0].message.content

# In the spreadsheet, try setting A1 to `=chat("What's the capital of Mongolia?")`

(Of course, you can always set your own API key too if you prefer to.)

For a more complete example, check out this LLM-powered recipe generator. Try making your own copy and modifying the prompt to add dietary restrictions, or create a shopping list for missing ingredients.

Our goal is to make it easier to build your own useful applications. Spreadsheets, Python, and LLMs are all powerful tools for your toolbox, and we built the API proxy to lower their barriers to entry.

Do you have other favorite APIs or tools that make it easier to develop with LLMs? We want to hear about it! Find us on Twitter, or join our Discord.