Skip to content

Instantly share code, notes, and snippets.

@by-openai
by-openai / example.py
Created September 6, 2025 00:09
Responses API function call mock example
import openai
response = openai.responses.create(
model="gpt-5-mini-2025-08-07",
input=[
{
"type": "message",
"role": "developer",
"content": "You are a bot that tells the weather. Follow the example below."
},
curl --request POST \
--url http://127.0.0.1:8081/v1/chat/completions \
--header 'Authorization: Bearer $OPENAI_API_KEY' \
--header 'Content-Type: application/json' \
--header 'OpenAI-Internal-EnableASRSupport: true' \
--header 'Openai-Internal-AllowAnyInput: true' \
--header 'Openai-Internal-AllowAnyOutput: true' \
--header 'Openai-Internal-AllowChatCompletion: true' \
--header 'Openai-Internal-AllowChatLogprobs: true' \
--header 'Openai-Internal-AllowConstrainedSamplingExtension: true' \