Tutorials / Provider setup / OpenAI / GPT-4
📝 Written ● Beginner

OpenAI / GPT-4

Connect GPT-4o or other OpenAI models to LingCode for a balanced mix of quality, speed, and cost.

Why use OpenAI?

OpenAI's models (especially GPT-4o) offer:

Best for: When you want solid quality at a reasonable price. A middle ground between DeepSeek (cheap) and Claude (premium).

Getting started

1

Create an OpenAI account

Go to platform.openai.com and sign up or log in. You'll need:

  • Email address
  • Password
  • Payment method (credit card)

Add billing information before creating your first API key.

2

Generate your API key

Once logged in, go to "API Keys" in the sidebar. Click "Create new secret key" and copy the full key. It will look like: sk-proj-...

Keep this key safe. Never share it or commit it to git.

Adding OpenAI to LingCode

3

Open the playground and configure

Go to /try.html and scroll to the bottom. Click "Advanced" to reveal provider configuration.

4

Paste your API key

Find the "OpenAI" row. Click the input field and paste your key (sk-proj-...).

Click "Save" and the key is stored securely in your browser.

Testing your connection

5

Run a test prompt

Type a simple prompt:

Build a simple landing page with a hero section, features list, and CTA button.

Click the "OpenAI" provider button to select it, then click "Send". If OpenAI responds with a complete HTML page, you're connected! ✓

OpenAI models

OpenAI offers multiple models for design work:

LingCode automatically uses GPT-4o (the latest) for your requests. You don't need to choose manually.

OpenAI pricing

As of 2026, typical costs per build:

More expensive than DeepSeek, cheaper than Claude for similar quality.

When to use OpenAI

Comparing GPT-4 to other providers

Provider Speed Quality Cost When to use
Claude ⭐⭐⭐⭐ ⭐⭐⭐⭐⭐ High Premium design
GPT-4 ⭐⭐⭐ ⭐⭐⭐⭐⭐ Medium Balanced choice
DeepSeek ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐ Low Fast & cheap

Smart workflow: DeepSeek + GPT-4 + Claude

For important work, use all three strategically:

  1. Start with DeepSeek (quick, cheap prototype)
  2. If good, upgrade to GPT-4 (better polish, moderate cost)
  3. If still not perfect, try Claude (best quality, premium cost)

This workflow usually finds the perfect balance of quality and cost.

Troubleshooting

Q: "Invalid API key" error

A: Make sure you've copied the full key from OpenAI's dashboard (starts with sk-proj-). Avoid extra spaces.

Q: OpenAI is returning errors about rate limits

A: Check your OpenAI account at platform.openai.com/account/limits. You may have hit usage limits. Wait a few moments and try again, or add more funds to your account.

Q: Which GPT-4 model am I using?

A: LingCode automatically uses GPT-4o (the latest and fastest). You don't need to select a model manually.

Q: Can I use GPT-4 and Claude together?

A: Yes. Set up both providers, then select both in the playground and run your prompt on both to compare results side-by-side.

API usage and tracking

To monitor your spending:

  1. Log in to OpenAI's dashboard
  2. Go to "Usage" to see your API costs
  3. Go to "Limits" to set spending caps and see rate limit info

Set a monthly spending limit to avoid surprises.