AI API Quick Start: Make Your First AI Call in 5 Minutes
Never used an AI API before? This tutorial takes you from zero to your first working AI call — no experience required.
If you are new to AI APIs, this is the only tutorial you need. We will walk through every step from creating an account to making your first AI-powered application. By the end, you will be able to call GPT, Claude, GLM, and DeepSeek models from your code.
Step 1: Create Your Account
Go to Token1.US and sign up. You only need an email address — no credit card required to create an account.
Once registered, you will see your dashboard. This is where you manage your API keys, check your balance, and view usage statistics.
Step 2: Top Up Your Balance
AI APIs use prepaid billing. You deposit funds, and each API call deducts from your balance based on token usage. You can start with as little as $1.
With $1, you can make approximately:
- 35,000 calls to GPT-4o-mini
- 250,000 calls to DeepSeek-V3
- 5,000 calls to GPT-4o
That is more than enough to test and experiment. See our pricing guide for detailed cost calculations.
Step 3: Generate Your API Key
In the dashboard, navigate to the API Keys section and click "Create New Key." Copy the key immediately — it looks like sk-xxxxxxxxxxxx.
Step 4: Install the SDK
Token1.US uses the standard OpenAI SDK, which is the most widely supported AI client library. Install it for your language:
Python
pip install openai
Node.js
npm install openai
Other Languages
The OpenAI community maintains SDKs for Go, Java, Ruby, PHP, and more. Any HTTP client also works — the API is just REST + JSON.
Step 5: Make Your First AI Call
Python Example
from openai import OpenAI
# Initialize the client
client = OpenAI(
api_key="sk-your-key-here",
base_url="https://discount-token.com/v1"
)
# Make your first call
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "user", "content": "Hello! What can you do?"}
]
)
print(response.choices[0].message.content)
print(f"\nTokens used: {response.usage.total_tokens}")
Node.js Example
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-your-key-here",
baseURL: "https://discount-token.com/v1",
});
const response = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Hello! What can you do?" }],
});
console.log(response.choices[0].message.content);
curl Example (No Installation Needed)
curl https://discount-token.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-key-here" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Hello!"}]
}'
If everything works, you will see an AI-generated response. Congratulations — you just called your first AI API!
Switching Between Models
The beauty of a unified gateway is that switching models requires changing just one parameter:
# Use GPT-4o
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Write a poem."}]
)
# Use Claude Sonnet
response = client.chat.completions.create(
model="claude-sonnet-4-20250514",
messages=[{"role": "user", "content": "Write a poem."}]
)
# Use DeepSeek-V3 (cheapest)
response = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Write a poem."}]
)
# Use GLM-4-Plus (best for Chinese)
response = client.chat.completions.create(
model="glm-4-plus",
messages=[{"role": "user", "content": "Write a poem."}]
)
Same code, same SDK, different models. Compare all models →
Build a Simple Chatbot (Next Step)
Now let's build something slightly more useful — a multi-turn chatbot that remembers conversation history:
from openai import OpenAI
client = OpenAI(
api_key="sk-your-key-here",
base_url="https://discount-token.com/v1"
)
conversation = [
{"role": "system", "content": "You are a friendly, concise assistant."}
]
print("Chatbot ready! Type 'quit' to exit.\n")
while True:
user_input = input("You: ")
if user_input.lower() == "quit":
break
conversation.append({"role": "user", "content": user_input})
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=conversation,
max_tokens=300
)
reply = response.choices[0].message.content
print(f"AI: {reply}\n")
conversation.append({"role": "assistant", "content": reply})
Using AI APIs Without Coding
If you are not a developer, you can still use AI APIs through no-code tools:
Cursor (AI Code Editor)
Settings → Models → OpenAI Base URL: https://discount-token.com/v1 → enter your API key. Cursor will use AI models for code completion and chat.
Dify (No-code AI App Builder)
Add a model provider with base URL https://discount-token.com/v1 and your Token1.US API key. Build chatbots and AI apps visually.
Open WebUI (Self-hosted ChatGPT Alternative)
Settings → Connections → add OpenAI API with base URL https://discount-token.com/v1.
Common Beginner Mistakes to Avoid
| Mistake | What Happens | How to Fix |
|---|---|---|
Forgetting base_url | Calls go to OpenAI directly, may fail | Always set base_url="https://discount-token.com/v1" |
| Wrong model name | 404 or model not found error | Check model names list |
No max_tokens limit | Long responses cost more | Always set max_tokens for cost control |
| API key in code | Security risk | Use environment variables instead |
| Not handling errors | App crashes on network issues | Wrap calls in try/except with retry logic |
Secure Your API Key
Never hardcode your API key. Use environment variables instead:
import os
from openai import OpenAI
# Set in terminal: export TOKEN1_API_KEY="sk-your-key"
client = OpenAI(
api_key=os.environ.get("TOKEN1_API_KEY"),
base_url="https://discount-token.com/v1"
)
Create a .env file (and add it to .gitignore):
TOKEN1_API_KEY=sk-your-key-here
What to Build Next
Now that you can call AI APIs, here are some project ideas:
- Content generator: Auto-generate blog posts, product descriptions, or social media content
- Code reviewer: Send code snippets to Claude for review and suggestions
- Customer support bot: Build a FAQ bot using your knowledge base
- Data extractor: Use structured output to parse unstructured text into JSON
- Translation tool: Build a multi-language translator using GLM or GPT
- Summarizer: Condense long articles or meeting transcripts
Frequently Asked Questions
How do I start using an AI API?
Sign up at Token1.US, top up $1+, generate an API key, install the OpenAI SDK, set base_url="https://discount-token.com/v1", and call any model. The whole process takes about 5 minutes.
Do I need to know how to code?
Basic coding helps, but our copy-paste examples work out of the box. For no-code usage, tools like Cursor, Dify, and Open WebUI accept custom API URLs without programming.
Which model should I try first?
Start with GPT-4o-mini or DeepSeek-V3. They are the cheapest models with excellent quality, so you can experiment freely without worrying about cost.
How much does it cost to try?
You can start with $1. A single API call costs $0.001-$0.01. With $1, you can make hundreds of test calls to budget models.
What programming languages are supported?
Any language with HTTP support works. The OpenAI SDK is available for Python, Node.js, Go, Java, Ruby, PHP, Rust, and more. You can also use curl directly.
Can I use AI APIs without an OpenAI account?
Yes. Token1.US provides access to all major models with a single account. No separate OpenAI, Anthropic, or other provider accounts needed.