๐ Using Your API Key
This page is dedicated to using an API key you already have. If you do not have one yet, create or refresh it first on the API Key Management page.
Start with this API URL
https://api.tokenreply.com/v1https://api.tokenreply.com/v1/chat/completionsBearer sk-your-token-here๐ก Most common setup
If your client asks for a Base URL, OpenAI URL, or API URL, use https://api.tokenreply.com/v1. If it expects a raw HTTP endpoint, use https://api.tokenreply.com/v1/chat/completions.
๐ก About the example model
The examples below use gpt-4o. Replace it with a model your account can call. See the Models page. Free accounts are limited to free and Featured models; see Plans & Tiers.
โ๏ธ Environment Variables
This is the most universal and safest way to integrate. Many OpenAI-compatible SDKs read these environment variables automatically.
export OPENAI_API_KEY="sk-your-token-here"
export OPENAI_BASE_URL="https://api.tokenreply.com/v1"๐ Python (openai)
Install: pip install openai
from openai import OpenAI
client = OpenAI(
api_key="sk-your-token-here",
base_url="https://api.tokenreply.com/v1"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
)
print(response.choices[0].message.content)๐ฆ Node.js (openai)
Install: npm install openai
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-your-token-here",
baseURL: "https://api.tokenreply.com/v1"
});
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello!" }]
});
console.log(response.choices[0].message.content);๐ cURL
If you want to verify the API quickly, cURL is the fastest way to start.
curl https://api.tokenreply.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token-here" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'๐งฉ Other Usage Scenarios
- Third-Party Apps: configuration details for CherryStudio, OpenCode, and more
- Base URL & Auth: understand the difference between the base URL, raw endpoints, and the Authorization header
- Code Examples: see more full snippets and streaming examples
๐ Next Steps
- API Key Management: create, rename, refresh, or restrict your API keys
- Models: choose the model name you want to call
- FAQ & Troubleshooting: troubleshooting guidance for 401, 429, or model-related errors
