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 osfrom openai import OpenAIclient = 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 osfrom openai import OpenAIclient = 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 osfrom openai import OpenAIclient = 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."}, ],)