curl https://ai-gateway.helicone.ai/v1/chat/completions \
-H "Authorization: Bearer $HELICONE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Say hello in one sentence." }
]
}'
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://ai-gateway.helicone.ai/v1",
apiKey: process.env.HELICONE_API_KEY,
});
const response = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Say hello in one sentence." },
],
});
import os
from openai import OpenAI
client = OpenAI(
base_url="https://ai-gateway.helicone.ai/v1",
api_key=os.environ.get("HELICONE_API_KEY"),
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hello in one sentence."},
],
)
AI Gateway
Chat Completions (Gateway)
Create chat completions via the AI Gateway
POST
/
v1
/
chat
/
completions
curl https://ai-gateway.helicone.ai/v1/chat/completions \
-H "Authorization: Bearer $HELICONE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Say hello in one sentence." }
]
}'
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://ai-gateway.helicone.ai/v1",
apiKey: process.env.HELICONE_API_KEY,
});
const response = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Say hello in one sentence." },
],
});
import os
from openai import OpenAI
client = OpenAI(
base_url="https://ai-gateway.helicone.ai/v1",
api_key=os.environ.get("HELICONE_API_KEY"),
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hello in one sentence."},
],
)
This request schema applies when using the Helicone AI Gateway with pass‑through billing (credits). In BYOK mode, the standard OpenAI Chat Completions schema is allowed. The schema is defined based on fields that are stable across all provider-model mappings.
Learn more about pass‑through billing vs BYOK.
curl https://ai-gateway.helicone.ai/v1/chat/completions \
-H "Authorization: Bearer $HELICONE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Say hello in one sentence." }
]
}'
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://ai-gateway.helicone.ai/v1",
apiKey: process.env.HELICONE_API_KEY,
});
const response = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Say hello in one sentence." },
],
});
import os
from openai import OpenAI
client = OpenAI(
base_url="https://ai-gateway.helicone.ai/v1",
api_key=os.environ.get("HELICONE_API_KEY"),
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hello in one sentence."},
],
)
Body
application/json
Minimum array length:
1- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Required range:
0 <= x <= 20Show child attributes
Show child attributes
Available options:
auto, default, flex, scale, priority Available options:
text Available options:
low, medium, high Available options:
minimal, low, medium, high Show child attributes
Show child attributes
Required range:
-9007199254740991 <= x <= 9007199254740991Required range:
-2 <= x <= 2Required range:
-2 <= x <= 2- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Required range:
-9007199254740991 <= x <= 9007199254740991Required range:
1 <= x <= 128Show child attributes
Show child attributes
Required range:
-9007199254740991 <= x <= 9007199254740991Show child attributes
Show child attributes
- Option 1
- Option 2
Show child attributes
Show child attributes
Available options:
none, auto, required Available options:
none, auto Required array length:
1 - 128 elementsShow child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
200
Request accepted
Was this page helpful?