Hello World
Your first API call with MyTokenGate.
Prerequisites
- MyTokenGate account
- API key from Dashboard
- Python 3.8+ or Node.js 18+
Quick Start
Python
pip install openaifrom openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://gateway.mytokengate.com/v1"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "user", "content": "Hello, MyTokenGate!"}
]
)
print(response.choices[0].message.content)Node.js
npm install openaiimport OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'YOUR_API_KEY',
baseURL: 'https://gateway.mytokengate.com/v1'
});
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [
{ role: 'user', content: 'Hello, MyTokenGate!' }
]
});
console.log(response.choices[0].message.content);cURL
curl https://gateway.mytokengate.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello, MyTokenGate!"}]
}'Expected Output
Hello! I'm your AI assistant powered by MyTokenGate. How can I help you today?Next Steps
- Quick Start Guide - Full setup instructions
- API Documentation - Complete API reference
- Models - Available models
Last updated on