SpyBara
Go Premium

Reference 2026-10-05 22:59 UTC to 2026-10-06 22:58 UTC

38 files changed +5,416 −614. View all changes and history on the product overview
2026
Fri 9 22:57 Thu 8 23:01 Wed 7 23:57 Tue 6 22:58 Mon 5 22:59 Sun 4 22:58 Sat 3 22:58 Fri 2 23:58 Thu 1 22:59
Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

22 22 

23 A unique identifier for the chat completion. Each chunk has the same ID.23 A unique identifier for the chat completion. Each chunk has the same ID.

24 24 

25- `choices: array of object { delta, finish_reason, index, logprobs }`25- `choices: array of object { delta, index, finish_reason, logprobs }`

26 26 

27 A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the27 A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the

28 last chunk if you set `stream_options: {"include_usage": true}`.28 last chunk if you set `stream_options: {"include_usage": true}`.

29 29 

30 - `delta: object { content, function_call, refusal, 2 more }`30 - `delta: object { audio, content, function_call, 3 more }`

31 31 

32 A chat completion delta generated by streamed model responses.32 A chat completion delta generated by streamed model responses.

33 Streamed audio can arrive in partial updates with an ID, base64 data, or33 Streamed audio can arrive in partial updates with an ID, base64 data, or

34 transcript text. The final audio update contains only its expiry timestamp.34 transcript text. The final audio update contains only its expiry timestamp.

35 35 

36 - `audio: optional object { id, data, expires_at, transcript }`

37 

38 A partial audio response. Audio chunks may carry an ID, base64 data, or

39 transcript text; the final audio update contains only its expiry timestamp.

40 

41 - `id: optional string`

42 

43 Unique identifier for this audio response.

44 

45 - `data: optional string`

46 

47 Base64 encoded audio bytes generated by the model, in the format

48 specified in the request.

49 

50 - `expires_at: optional number`

51 

52 The Unix timestamp (in seconds) for when this audio response will no

53 longer be accessible on the server for use in multi-turn conversations.

54 

55 - `transcript: optional string`

56 

57 Transcript text from this audio chunk.

58 

36 - `content: optional string or null`59 - `content: optional string or null`

37 60 

38 The contents of the chunk message.61 The contents of the chunk message.


91 114 

92 - `"function"`115 - `"function"`

93 116 

94 - `finish_reason: "stop" or "length" or "tool_calls" or 2 more or null`117 - `index: number`

118 

119 The index of the choice in the list of choices.

120 

121 - `finish_reason: optional "stop" or "length" or "tool_calls" or 2 more or null`

95 122 

96 The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,123 The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,

97 `length` if the maximum number of tokens specified in the request was reached,124 `length` if the maximum number of tokens specified in the request was reached,


109 136 

110 - `"function_call"`137 - `"function_call"`

111 138 

112 - `index: number`

113 

114 The index of the choice in the list of choices.

115 

116 - `logprobs: optional object { content, refusal } or null`139 - `logprobs: optional object { content, refusal } or null`

117 140 

118 Log probability information for the choice.141 Log probability information for the choice.

Details

2118 2118 

2119 - `"grammar"`2119 - `"grammar"`

2120 2120 

2121 - `Namespace object { description, name, tools, type }`2121 - `ToolSearchOutputNamespaceTool object { description, name, tools, type }`

2122 2122 

2123 Groups function/custom tools under a shared namespace.2123 Groups function/custom tools under a shared namespace.

2124 2124 


2132 2132 

2133 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`2133 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`

2134 2134 

2135 The function/custom tools available inside this namespace.2135 The function/custom tools loaded inside this namespace.

2136 2136 

2137 - `Function object { name, type, allowed_callers, 6 more }`2137 - `Function object { name, type, allowed_callers, 6 more }`

2138 2138 

2139 - `name: string`2139 - `name: string`

2140 2140 

2141 The name of the loaded function tool.

2142 

2141 - `type: "function"`2143 - `type: "function"`

2142 2144 

2143 - `"function"`2145 - `"function"`

Details

40 40 

41 The file identifier, which can be referenced in the API endpoints.41 The file identifier, which can be referenced in the API endpoints.

42 42 

43 - `bytes: number`43 - `bytes: number or null`

44 44 

45 The size of the file, in bytes. In a completed file upload response, this can45 The size of the file, in bytes. In a completed file upload response, this can

46 be null when the file size is not yet available.46 be null when the file size is not yet available.

Details

36 36 

37 The file identifier, which can be referenced in the API endpoints.37 The file identifier, which can be referenced in the API endpoints.

38 38 

39 - `bytes: number`39 - `bytes: number or null`

40 40 

41 The size of the file, in bytes. In a completed file upload response, this can41 The size of the file, in bytes. In a completed file upload response, this can

42 be null when the file size is not yet available.42 be null when the file size is not yet available.

Details

20 20 

21 The file identifier, which can be referenced in the API endpoints.21 The file identifier, which can be referenced in the API endpoints.

22 22 

23 - `bytes: number`23 - `bytes: number or null`

24 24 

25 The size of the file, in bytes. In a completed file upload response, this can25 The size of the file, in bytes. In a completed file upload response, this can

26 be null when the file size is not yet available.26 be null when the file size is not yet available.

Details

252 252 

253 - `"high"`253 - `"high"`

254 254 

255 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`255 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

256 256 

257 Controls which tool the Responses backend uses when handling a task delegated by the Live model.257 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

258 258 

259 - `LiveToolChoiceEnum = "auto" or "none" or "required"`259 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

260 260 

261 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

262 

261 - `"auto"`263 - `"auto"`

262 264 

263 - `"none"`265 - `"none"`

264 266 

265 - `"required"`267 - `"required"`

266 268 

267 - `LiveFunctionToolChoiceParam object { name, type }`269 - `map[unknown]`

268 

269 - `name: string`

270 

271 - `type: "function"`

272 

273 - `"function"`

274 

275 - `LiveMCPToolChoiceParam object { name, server_label, type }`

276 

277 - `name: string`

278 

279 - `server_label: string`

280 

281 - `type: "mcp"`

282 

283 - `"mcp"`

284 270 

285 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`271 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

286 272 

287 Tools available to the Responses backend while it handles tasks delegated by the Live model.273 Tools available to the Responses backend while it handles tasks delegated by the Live model.

288 274 


334 320 

335 - `"code_interpreter"`321 - `"code_interpreter"`

336 322 

337 - `Shell object { environment, type }`323 - `Shell object { type, environment }`

338 324 

339 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.325 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

340 

341 - `environment: map[unknown]`

342 326 

343 - `type: "shell"`327 - `type: "shell"`

344 328 

345 - `"shell"`329 - `"shell"`

346 330 

331 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

332 

333 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

334 

335 - `type: "container_auto"`

336 

337 Automatically creates a container for this request

338 

339 - `"container_auto"`

340 

341 - `file_ids: optional array of string or null`

342 

343 An optional list of uploaded files to make available to your code.

344 

345 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

346 

347 The memory limit for the container.

348 

349 - `"1g"`

350 

351 - `"4g"`

352 

353 - `"16g"`

354 

355 - `"64g"`

356 

357 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

358 

359 Network access policy for the container.

360 

361 - `Disabled object { type }`

362 

363 - `type: "disabled"`

364 

365 Disable outbound network access. Always `disabled`.

366 

367 - `"disabled"`

368 

369 - `Allowlist object { allowed_domains, type }`

370 

371 - `allowed_domains: array of string`

372 

373 A list of allowed domains when type is `allowlist`.

374 

375 - `type: "allowlist"`

376 

377 Allow outbound network access only to specified domains. Always `allowlist`.

378 

379 - `"allowlist"`

380 

381 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

382 

383 An optional list of skills referenced by id or inline data.

384 

385 - `SkillReference object { skill_id, type, version }`

386 

387 - `skill_id: string`

388 

389 The ID of the referenced skill.

390 

391 - `type: "skill_reference"`

392 

393 References a skill created with the /v1/skills endpoint.

394 

395 - `"skill_reference"`

396 

397 - `version: optional string or null`

398 

399 Optional skill version. Use a positive integer or 'latest'. Omit for default.

400 

401 - `Inline object { description, name, source, type }`

402 

403 - `description: string`

404 

405 The description of the skill.

406 

407 - `name: string`

408 

409 The name of the skill.

410 

411 - `source: object { data, media_type, type }`

412 

413 Inline skill payload

414 

415 - `data: string`

416 

417 Base64-encoded skill zip bundle.

418 

419 - `media_type: "application/zip"`

420 

421 The media type of the inline skill payload. Must be `application/zip`.

422 

423 - `"application/zip"`

424 

425 - `type: "base64"`

426 

427 The type of the inline skill source. Must be `base64`.

428 

429 - `"base64"`

430 

431 - `type: "inline"`

432 

433 Defines an inline skill for this request.

434 

435 - `"inline"`

436 

437 - `ContainerReference object { container_id, type }`

438 

439 - `container_id: string`

440 

441 The ID of the referenced container.

442 

443 - `type: "container_reference"`

444 

445 References a container created with the /v1/containers endpoint

446 

447 - `"container_reference"`

448 

449 - `Local object { type, skills }`

450 

451 - `type: "local"`

452 

453 Use a local computer environment.

454 

455 - `"local"`

456 

457 - `skills: optional array of object { description, name, path } or null`

458 

459 An optional list of skills.

460 

461 - `description: string`

462 

463 The description of the skill.

464 

465 - `name: string`

466 

467 The name of the skill.

468 

469 - `path: string`

470 

471 The path to the directory containing the skill.

472 

347 - `ImageGeneration object { type }`473 - `ImageGeneration object { type }`

348 474 

349 - `type: "image_generation"`475 - `type: "image_generation"`

350 476 

351 - `"image_generation"`477 - `"image_generation"`

352 478 

479 - `Mcp object { type }`

480 

481 - `type: "mcp"`

482 

483 - `"mcp"`

484 

485 - `Custom object { type }`

486 

487 - `type: "custom"`

488 

489 - `"custom"`

490 

491 - `Namespace object { type }`

492 

493 - `type: "namespace"`

494 

495 - `"namespace"`

496 

497 - `ToolSearch object { type }`

498 

499 - `type: "tool_search"`

500 

501 - `"tool_search"`

502 

503 - `ProgrammaticToolCalling object { type }`

504 

505 - `type: "programmatic_tool_calling"`

506 

507 - `"programmatic_tool_calling"`

508 

509 - `Computer object { type }`

510 

511 - `type: "computer"`

512 

513 - `"computer"`

514 

515 - `ApplyPatch object { type }`

516 

517 - `type: "apply_patch"`

518 

519 - `"apply_patch"`

520 

353 - `store: optional boolean`521 - `store: optional boolean`

354 522 

355 Whether to store the forked session. Omission inherits the stored session's setting.523 Whether to store the forked session. Omission inherits the stored session's setting.


477 645 

478 - `"ultrafast"`646 - `"ultrafast"`

479 647 

480 - `text: optional object { verbosity } or null`648 - `text: optional object { verbosity } or null`

649 

650 Text generation settings passed to each delegated Responses request.

651 

652 - `verbosity: optional "low" or "medium" or "high" or null`

653 

654 The amount of detail in text generated by the Responses backend. This does not configure the Live model’s spoken delivery.

655 

656 - `"low"`

657 

658 - `"medium"`

659 

660 - `"high"`

661 

662 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

663 

664 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

665 

666 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

667 

668 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

669 

670 - `"auto"`

671 

672 - `"none"`

673 

674 - `"required"`

675 

676 - `map[unknown]`

677 

678 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

679 

680 Tools available to the Responses backend while it handles tasks delegated by the Live model.

681 

682 - `FunctionTool object { name, type, description, 2 more }`

683 

684 A function tool available to the Responses backend when the Live model delegates a task.

685 

686 - `name: string`

687 

688 The name the delegated Responses model uses when calling this function.

689 

690 - `type: "function"`

691 

692 The tool type. Always `function`.

693 

694 - `"function"`

695 

696 - `description: optional string or null`

697 

698 What the function does and when the delegated Responses model should call it.

699 

700 - `parameters: optional map[unknown] or null`

701 

702 A JSON Schema object describing the arguments accepted by the function.

703 

704 - `strict: optional boolean or null`

705 

706 Whether the delegated Responses model must follow the function’s parameter schema exactly.

707 

708 - `WebSearch object { type }`

709 

710 A web search tool available to the Live session’s Responses backend.

711 

712 - `type: "web_search"`

713 

714 The tool type. Always `web_search`.

715 

716 - `"web_search"`

717 

718 - `FileSearch object { type }`

719 

720 - `type: "file_search"`

721 

722 - `"file_search"`

723 

724 - `CodeInterpreter object { type }`

725 

726 - `type: "code_interpreter"`

727 

728 - `"code_interpreter"`

729 

730 - `Shell object { type, environment }`

731 

732 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

733 

734 - `type: "shell"`

735 

736 - `"shell"`

737 

738 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

739 

740 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

741 

742 - `type: "container_auto"`

743 

744 Automatically creates a container for this request

745 

746 - `"container_auto"`

747 

748 - `file_ids: optional array of string or null`

749 

750 An optional list of uploaded files to make available to your code.

751 

752 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

753 

754 The memory limit for the container.

755 

756 - `"1g"`

757 

758 - `"4g"`

759 

760 - `"16g"`

761 

762 - `"64g"`

763 

764 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

765 

766 Network access policy for the container.

767 

768 - `Disabled object { type }`

769 

770 - `type: "disabled"`

771 

772 Disable outbound network access. Always `disabled`.

773 

774 - `"disabled"`

775 

776 - `Allowlist object { allowed_domains, type }`

777 

778 - `allowed_domains: array of string`

779 

780 A list of allowed domains when type is `allowlist`.

781 

782 - `type: "allowlist"`

783 

784 Allow outbound network access only to specified domains. Always `allowlist`.

785 

786 - `"allowlist"`

787 

788 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

789 

790 An optional list of skills referenced by id or inline data.

791 

792 - `SkillReference object { skill_id, type, version }`

793 

794 - `skill_id: string`

795 

796 The ID of the referenced skill.

797 

798 - `type: "skill_reference"`

799 

800 References a skill created with the /v1/skills endpoint.

801 

802 - `"skill_reference"`

803 

804 - `version: optional string or null`

805 

806 Optional skill version. Use a positive integer or 'latest'. Omit for default.

807 

808 - `Inline object { description, name, source, type }`

809 

810 - `description: string`

811 

812 The description of the skill.

813 

814 - `name: string`

815 

816 The name of the skill.

481 817 

482 Text generation settings passed to each delegated Responses request.818 - `source: object { data, media_type, type }`

483 819 

484 - `verbosity: optional "low" or "medium" or "high" or null`820 Inline skill payload

485 821 

486 The amount of detail in text generated by the Responses backend. This does not configure the Live model’s spoken delivery.822 - `data: string`

487 823 

488 - `"low"`824 Base64-encoded skill zip bundle.

489 825 

490 - `"medium"`826 - `media_type: "application/zip"`

491 827 

492 - `"high"`828 The media type of the inline skill payload. Must be `application/zip`.

493 829 

494 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`830 - `"application/zip"`

495 831 

496 Controls which tool the Responses backend uses when handling a task delegated by the Live model.832 - `type: "base64"`

497 833 

498 - `LiveToolChoiceEnum = "auto" or "none" or "required"`834 The type of the inline skill source. Must be `base64`.

499 835 

500 - `"auto"`836 - `"base64"`

501 837 

502 - `"none"`838 - `type: "inline"`

503 839 

504 - `"required"`840 Defines an inline skill for this request.

505 841 

506 - `LiveFunctionToolChoiceParam object { name, type }`842 - `"inline"`

507 843 

508 - `name: string`844 - `ContainerReference object { container_id, type }`

509 845 

510 - `type: "function"`846 - `container_id: string`

511 847 

512 - `"function"`848 The ID of the referenced container.

513 849 

514 - `LiveMCPToolChoiceParam object { name, server_label, type }`850 - `type: "container_reference"`

515 851 

516 - `name: string`852 References a container created with the /v1/containers endpoint

517 853 

518 - `server_label: string`854 - `"container_reference"`

519 855 

520 - `type: "mcp"`856 - `Local object { type, skills }`

521 857 

522 - `"mcp"`858 - `type: "local"`

523 859 

524 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`860 Use a local computer environment.

525 861 

526 Tools available to the Responses backend while it handles tasks delegated by the Live model.862 - `"local"`

527 863 

528 - `FunctionTool object { name, type, description, 2 more }`864 - `skills: optional array of object { description, name, path } or null`

529 865 

530 A function tool available to the Responses backend when the Live model delegates a task.866 An optional list of skills.

531 867 

532 - `name: string`868 - `description: string`

533 869 

534 The name the delegated Responses model uses when calling this function.870 The description of the skill.

535 871 

536 - `type: "function"`872 - `name: string`

537 873 

538 The tool type. Always `function`.874 The name of the skill.

539 875 

540 - `"function"`876 - `path: string`

541 877 

542 - `description: optional string or null`878 The path to the directory containing the skill.

543 879 

544 What the function does and when the delegated Responses model should call it.880 - `ImageGeneration object { type }`

545 881 

546 - `parameters: optional map[unknown] or null`882 - `type: "image_generation"`

547 883 

548 A JSON Schema object describing the arguments accepted by the function.884 - `"image_generation"`

549 885 

550 - `strict: optional boolean or null`886 - `Mcp object { type }`

551 887 

552 Whether the delegated Responses model must follow the function’s parameter schema exactly.888 - `type: "mcp"`

553 889 

554 - `WebSearch object { type }`890 - `"mcp"`

555 891 

556 A web search tool available to the Live session’s Responses backend.892 - `Custom object { type }`

557 893 

558 - `type: "web_search"`894 - `type: "custom"`

559 895 

560 The tool type. Always `web_search`.896 - `"custom"`

561 897 

562 - `"web_search"`898 - `Namespace object { type }`

563 899 

564 - `FileSearch object { type }`900 - `type: "namespace"`

565 901 

566 - `type: "file_search"`902 - `"namespace"`

567 903 

568 - `"file_search"`904 - `ToolSearch object { type }`

569 905 

570 - `CodeInterpreter object { type }`906 - `type: "tool_search"`

571 907 

572 - `type: "code_interpreter"`908 - `"tool_search"`

573 909 

574 - `"code_interpreter"`910 - `ProgrammaticToolCalling object { type }`

575 911 

576 - `Shell object { environment, type }`912 - `type: "programmatic_tool_calling"`

577 913 

578 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.914 - `"programmatic_tool_calling"`

579 915 

580 - `environment: map[unknown]`916 - `Computer object { type }`

581 917 

582 - `type: "shell"`918 - `type: "computer"`

583 919 

584 - `"shell"`920 - `"computer"`

585 921 

586 - `ImageGeneration object { type }`922 - `ApplyPatch object { type }`

587 923 

588 - `type: "image_generation"`924 - `type: "apply_patch"`

589 925 

590 - `"image_generation"`926 - `"apply_patch"`

591 927 

592- `type: "session.update"`928- `type: "session.update"`

593 929 


2945 3281 

2946 - `"grammar"`3282 - `"grammar"`

2947 3283 

2948 - `Namespace object { description, name, tools, type }`3284 - `ToolSearchOutputNamespaceTool object { description, name, tools, type }`

2949 3285 

2950 Groups function/custom tools under a shared namespace.3286 Groups function/custom tools under a shared namespace.

2951 3287 


2959 3295 

2960 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`3296 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`

2961 3297 

2962 The function/custom tools available inside this namespace.3298 The function/custom tools loaded inside this namespace.

2963 3299 

2964 - `Function object { name, type, allowed_callers, 6 more }`3300 - `Function object { name, type, allowed_callers, 6 more }`

2965 3301 

2966 - `name: string`3302 - `name: string`

2967 3303 

3304 The name of the loaded function tool.

3305 

2968 - `type: "function"`3306 - `type: "function"`

2969 3307 

2970 - `"function"`3308 - `"function"`


5446 5784 

5447 The voice used for speech generated by the Live model.5785 The voice used for speech generated by the Live model.

5448 5786 

5449 - `voice: optional string or "alloy" or "ash" or "aube" or 29 more or CustomVoice`5787 - `voice: optional string or "alloy" or "ash" or "ballad" or 28 more or CustomVoice`

5450 5788 

5451 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.5789 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

5452 5790 

5453 - `string`5791 - `string`

5454 5792 

5455 - `"alloy" or "ash" or "aube" or 29 more`5793 - `"alloy" or "ash" or "ballad" or 28 more`

5456 5794 

5457 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.5795 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

5458 5796 


5460 5798 

5461 - `"ash"`5799 - `"ash"`

5462 5800 

5463 - `"aube"`

5464 

5465 - `"ballad"`5801 - `"ballad"`

5466 5802 

5467 - `"beacon"`5803 - `"beacon"`


5642 5978 

5643 - `"priority"`5979 - `"priority"`

5644 5980 

5645 - `"ultrafast"`5981 - `"ultrafast"`

5982 

5983 - `text: optional object { verbosity } or null`

5984 

5985 Text generation settings passed to each delegated Responses request.

5986 

5987 - `verbosity: optional "low" or "medium" or "high" or null`

5988 

5989 The amount of detail in text generated by the Responses backend. This does not configure the Live model’s spoken delivery.

5990 

5991 - `"low"`

5992 

5993 - `"medium"`

5994 

5995 - `"high"`

5996 

5997 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

5998 

5999 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

6000 

6001 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

6002 

6003 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

6004 

6005 - `"auto"`

6006 

6007 - `"none"`

6008 

6009 - `"required"`

6010 

6011 - `map[unknown]`

6012 

6013 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

6014 

6015 Tools available to the Responses backend while it handles tasks delegated by the Live model.

6016 

6017 - `FunctionTool object { name, type, description, 2 more }`

6018 

6019 A function tool available to the Responses backend when the Live model delegates a task.

6020 

6021 - `name: string`

6022 

6023 The name the delegated Responses model uses when calling this function.

6024 

6025 - `type: "function"`

6026 

6027 The tool type. Always `function`.

6028 

6029 - `"function"`

6030 

6031 - `description: optional string or null`

6032 

6033 What the function does and when the delegated Responses model should call it.

6034 

6035 - `parameters: optional map[unknown] or null`

6036 

6037 A JSON Schema object describing the arguments accepted by the function.

6038 

6039 - `strict: optional boolean or null`

6040 

6041 Whether the delegated Responses model must follow the function’s parameter schema exactly.

6042 

6043 - `WebSearch object { type }`

6044 

6045 A web search tool available to the Live session’s Responses backend.

6046 

6047 - `type: "web_search"`

6048 

6049 The tool type. Always `web_search`.

6050 

6051 - `"web_search"`

6052 

6053 - `FileSearch object { type }`

6054 

6055 - `type: "file_search"`

6056 

6057 - `"file_search"`

6058 

6059 - `CodeInterpreter object { type }`

6060 

6061 - `type: "code_interpreter"`

6062 

6063 - `"code_interpreter"`

6064 

6065 - `Shell object { type, environment }`

6066 

6067 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

6068 

6069 - `type: "shell"`

6070 

6071 - `"shell"`

6072 

6073 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

6074 

6075 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

6076 

6077 - `type: "container_auto"`

6078 

6079 Automatically creates a container for this request

6080 

6081 - `"container_auto"`

6082 

6083 - `file_ids: optional array of string or null`

6084 

6085 An optional list of uploaded files to make available to your code.

6086 

6087 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

6088 

6089 The memory limit for the container.

6090 

6091 - `"1g"`

6092 

6093 - `"4g"`

6094 

6095 - `"16g"`

6096 

6097 - `"64g"`

6098 

6099 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

6100 

6101 Network access policy for the container.

6102 

6103 - `Disabled object { type }`

6104 

6105 - `type: "disabled"`

6106 

6107 Disable outbound network access. Always `disabled`.

6108 

6109 - `"disabled"`

6110 

6111 - `Allowlist object { allowed_domains, type }`

6112 

6113 - `allowed_domains: array of string`

6114 

6115 A list of allowed domains when type is `allowlist`.

6116 

6117 - `type: "allowlist"`

6118 

6119 Allow outbound network access only to specified domains. Always `allowlist`.

6120 

6121 - `"allowlist"`

6122 

6123 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

6124 

6125 An optional list of skills referenced by id or inline data.

6126 

6127 - `SkillReference object { skill_id, type, version }`

6128 

6129 - `skill_id: string`

6130 

6131 The ID of the referenced skill.

6132 

6133 - `type: "skill_reference"`

6134 

6135 References a skill created with the /v1/skills endpoint.

6136 

6137 - `"skill_reference"`

6138 

6139 - `version: optional string or null`

6140 

6141 Optional skill version. Use a positive integer or 'latest'. Omit for default.

6142 

6143 - `Inline object { description, name, source, type }`

6144 

6145 - `description: string`

6146 

6147 The description of the skill.

6148 

6149 - `name: string`

5646 6150 

5647 - `text: optional object { verbosity } or null`6151 The name of the skill.

5648 6152 

5649 Text generation settings passed to each delegated Responses request.6153 - `source: object { data, media_type, type }`

5650 6154 

5651 - `verbosity: optional "low" or "medium" or "high" or null`6155 Inline skill payload

5652 6156 

5653 The amount of detail in text generated by the Responses backend. This does not configure the Live model’s spoken delivery.6157 - `data: string`

5654 6158 

5655 - `"low"`6159 Base64-encoded skill zip bundle.

5656 6160 

5657 - `"medium"`6161 - `media_type: "application/zip"`

5658 6162 

5659 - `"high"`6163 The media type of the inline skill payload. Must be `application/zip`.

5660 6164 

5661 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`6165 - `"application/zip"`

5662 6166 

5663 Controls which tool the Responses backend uses when handling a task delegated by the Live model.6167 - `type: "base64"`

5664 6168 

5665 - `LiveToolChoiceEnum = "auto" or "none" or "required"`6169 The type of the inline skill source. Must be `base64`.

5666 6170 

5667 - `"auto"`6171 - `"base64"`

5668 6172 

5669 - `"none"`6173 - `type: "inline"`

5670 6174 

5671 - `"required"`6175 Defines an inline skill for this request.

5672 6176 

5673 - `LiveFunctionToolChoiceParam object { name, type }`6177 - `"inline"`

5674 6178 

5675 - `name: string`6179 - `ContainerReference object { container_id, type }`

5676 6180 

5677 - `type: "function"`6181 - `container_id: string`

5678 6182 

5679 - `"function"`6183 The ID of the referenced container.

5680 6184 

5681 - `LiveMCPToolChoiceParam object { name, server_label, type }`6185 - `type: "container_reference"`

5682 6186 

5683 - `name: string`6187 References a container created with the /v1/containers endpoint

5684 6188 

5685 - `server_label: string`6189 - `"container_reference"`

5686 6190 

5687 - `type: "mcp"`6191 - `Local object { type, skills }`

5688 6192 

5689 - `"mcp"`6193 - `type: "local"`

5690 6194 

5691 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`6195 Use a local computer environment.

5692 6196 

5693 Tools available to the Responses backend while it handles tasks delegated by the Live model.6197 - `"local"`

5694 6198 

5695 - `FunctionTool object { name, type, description, 2 more }`6199 - `skills: optional array of object { description, name, path } or null`

5696 6200 

5697 A function tool available to the Responses backend when the Live model delegates a task.6201 An optional list of skills.

5698 6202 

5699 - `name: string`6203 - `description: string`

5700 6204 

5701 The name the delegated Responses model uses when calling this function.6205 The description of the skill.

5702 6206 

5703 - `type: "function"`6207 - `name: string`

5704 6208 

5705 The tool type. Always `function`.6209 The name of the skill.

5706 6210 

5707 - `"function"`6211 - `path: string`

5708 6212 

5709 - `description: optional string or null`6213 The path to the directory containing the skill.

5710 6214 

5711 What the function does and when the delegated Responses model should call it.6215 - `ImageGeneration object { type }`

5712 6216 

5713 - `parameters: optional map[unknown] or null`6217 - `type: "image_generation"`

5714 6218 

5715 A JSON Schema object describing the arguments accepted by the function.6219 - `"image_generation"`

5716 6220 

5717 - `strict: optional boolean or null`6221 - `Mcp object { type }`

5718 6222 

5719 Whether the delegated Responses model must follow the function’s parameter schema exactly.6223 - `type: "mcp"`

5720 6224 

5721 - `WebSearch object { type }`6225 - `"mcp"`

5722 6226 

5723 A web search tool available to the Live session’s Responses backend.6227 - `Custom object { type }`

5724 6228 

5725 - `type: "web_search"`6229 - `type: "custom"`

5726 6230 

5727 The tool type. Always `web_search`.6231 - `"custom"`

5728 6232 

5729 - `"web_search"`6233 - `Namespace object { type }`

5730 6234 

5731 - `FileSearch object { type }`6235 - `type: "namespace"`

5732 6236 

5733 - `type: "file_search"`6237 - `"namespace"`

5734 6238 

5735 - `"file_search"`6239 - `ToolSearch object { type }`

5736 6240 

5737 - `CodeInterpreter object { type }`6241 - `type: "tool_search"`

5738 6242 

5739 - `type: "code_interpreter"`6243 - `"tool_search"`

5740 6244 

5741 - `"code_interpreter"`6245 - `ProgrammaticToolCalling object { type }`

5742 6246 

5743 - `Shell object { environment, type }`6247 - `type: "programmatic_tool_calling"`

5744 6248 

5745 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.6249 - `"programmatic_tool_calling"`

5746 6250 

5747 - `environment: map[unknown]`6251 - `Computer object { type }`

5748 6252 

5749 - `type: "shell"`6253 - `type: "computer"`

5750 6254 

5751 - `"shell"`6255 - `"computer"`

5752 6256 

5753 - `ImageGeneration object { type }`6257 - `ApplyPatch object { type }`

5754 6258 

5755 - `type: "image_generation"`6259 - `type: "apply_patch"`

5756 6260 

5757 - `"image_generation"`6261 - `"apply_patch"`

5758 6262 

5759 - `type: "responses"`6263 - `type: "responses"`

5760 6264 


6060 6564 

6061 The voice used for speech generated by the Live model.6565 The voice used for speech generated by the Live model.

6062 6566 

6063 - `voice: optional string or "alloy" or "ash" or "aube" or 29 more or CustomVoice`6567 - `voice: optional string or "alloy" or "ash" or "ballad" or 28 more or CustomVoice`

6064 6568 

6065 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.6569 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

6066 6570 

6067 - `string`6571 - `string`

6068 6572 

6069 - `"alloy" or "ash" or "aube" or 29 more`6573 - `"alloy" or "ash" or "ballad" or 28 more`

6070 6574 

6071 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.6575 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

6072 6576 


6074 6578 

6075 - `"ash"`6579 - `"ash"`

6076 6580 

6077 - `"aube"`

6078 

6079 - `"ballad"`6581 - `"ballad"`

6080 6582 

6081 - `"beacon"`6583 - `"beacon"`


6272 6774 

6273 - `"high"`6775 - `"high"`

6274 6776 

6275 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`6777 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

6276 6778 

6277 Controls which tool the Responses backend uses when handling a task delegated by the Live model.6779 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

6278 6780 

6279 - `LiveToolChoiceEnum = "auto" or "none" or "required"`6781 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

6280 6782 

6783 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

6784 

6281 - `"auto"`6785 - `"auto"`

6282 6786 

6283 - `"none"`6787 - `"none"`

6284 6788 

6285 - `"required"`6789 - `"required"`

6286 6790 

6287 - `LiveFunctionToolChoiceParam object { name, type }`6791 - `map[unknown]`

6792 

6793 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

6794 

6795 Tools available to the Responses backend while it handles tasks delegated by the Live model.

6796 

6797 - `FunctionTool object { name, type, description, 2 more }`

6798 

6799 A function tool available to the Responses backend when the Live model delegates a task.

6288 6800 

6289 - `name: string`6801 - `name: string`

6290 6802 

6803 The name the delegated Responses model uses when calling this function.

6804 

6291 - `type: "function"`6805 - `type: "function"`

6292 6806 

6293 - `"function"`6807 The tool type. Always `function`.

6808 

6809 - `"function"`

6810 

6811 - `description: optional string or null`

6812 

6813 What the function does and when the delegated Responses model should call it.

6814 

6815 - `parameters: optional map[unknown] or null`

6816 

6817 A JSON Schema object describing the arguments accepted by the function.

6818 

6819 - `strict: optional boolean or null`

6820 

6821 Whether the delegated Responses model must follow the function’s parameter schema exactly.

6822 

6823 - `WebSearch object { type }`

6824 

6825 A web search tool available to the Live session’s Responses backend.

6826 

6827 - `type: "web_search"`

6828 

6829 The tool type. Always `web_search`.

6830 

6831 - `"web_search"`

6832 

6833 - `FileSearch object { type }`

6834 

6835 - `type: "file_search"`

6836 

6837 - `"file_search"`

6838 

6839 - `CodeInterpreter object { type }`

6840 

6841 - `type: "code_interpreter"`

6842 

6843 - `"code_interpreter"`

6844 

6845 - `Shell object { type, environment }`

6846 

6847 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

6848 

6849 - `type: "shell"`

6850 

6851 - `"shell"`

6852 

6853 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

6854 

6855 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

6856 

6857 - `type: "container_auto"`

6858 

6859 Automatically creates a container for this request

6860 

6861 - `"container_auto"`

6862 

6863 - `file_ids: optional array of string or null`

6864 

6865 An optional list of uploaded files to make available to your code.

6866 

6867 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

6868 

6869 The memory limit for the container.

6870 

6871 - `"1g"`

6872 

6873 - `"4g"`

6874 

6875 - `"16g"`

6876 

6877 - `"64g"`

6878 

6879 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

6880 

6881 Network access policy for the container.

6882 

6883 - `Disabled object { type }`

6884 

6885 - `type: "disabled"`

6886 

6887 Disable outbound network access. Always `disabled`.

6888 

6889 - `"disabled"`

6890 

6891 - `Allowlist object { allowed_domains, type }`

6892 

6893 - `allowed_domains: array of string`

6894 

6895 A list of allowed domains when type is `allowlist`.

6896 

6897 - `type: "allowlist"`

6898 

6899 Allow outbound network access only to specified domains. Always `allowlist`.

6900 

6901 - `"allowlist"`

6902 

6903 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

6904 

6905 An optional list of skills referenced by id or inline data.

6906 

6907 - `SkillReference object { skill_id, type, version }`

6908 

6909 - `skill_id: string`

6910 

6911 The ID of the referenced skill.

6912 

6913 - `type: "skill_reference"`

6914 

6915 References a skill created with the /v1/skills endpoint.

6916 

6917 - `"skill_reference"`

6918 

6919 - `version: optional string or null`

6920 

6921 Optional skill version. Use a positive integer or 'latest'. Omit for default.

6922 

6923 - `Inline object { description, name, source, type }`

6924 

6925 - `description: string`

6926 

6927 The description of the skill.

6928 

6929 - `name: string`

6930 

6931 The name of the skill.

6932 

6933 - `source: object { data, media_type, type }`

6934 

6935 Inline skill payload

6936 

6937 - `data: string`

6938 

6939 Base64-encoded skill zip bundle.

6940 

6941 - `media_type: "application/zip"`

6942 

6943 The media type of the inline skill payload. Must be `application/zip`.

6944 

6945 - `"application/zip"`

6946 

6947 - `type: "base64"`

6948 

6949 The type of the inline skill source. Must be `base64`.

6950 

6951 - `"base64"`

6952 

6953 - `type: "inline"`

6954 

6955 Defines an inline skill for this request.

6956 

6957 - `"inline"`

6958 

6959 - `ContainerReference object { container_id, type }`

6960 

6961 - `container_id: string`

6962 

6963 The ID of the referenced container.

6294 6964 

6295 - `LiveMCPToolChoiceParam object { name, server_label, type }`6965 - `type: "container_reference"`

6296 6966 

6297 - `name: string`6967 References a container created with the /v1/containers endpoint

6298 6968 

6299 - `server_label: string`6969 - `"container_reference"`

6300 6970 

6301 - `type: "mcp"`6971 - `Local object { type, skills }`

6302 6972 

6303 - `"mcp"`6973 - `type: "local"`

6304 6974 

6305 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`6975 Use a local computer environment.

6306 6976 

6307 Tools available to the Responses backend while it handles tasks delegated by the Live model.6977 - `"local"`

6308 6978 

6309 - `FunctionTool object { name, type, description, 2 more }`6979 - `skills: optional array of object { description, name, path } or null`

6310 6980 

6311 A function tool available to the Responses backend when the Live model delegates a task.6981 An optional list of skills.

6312 6982 

6313 - `name: string`6983 - `description: string`

6314 6984 

6315 The name the delegated Responses model uses when calling this function.6985 The description of the skill.

6316 6986 

6317 - `type: "function"`6987 - `name: string`

6318 6988 

6319 The tool type. Always `function`.6989 The name of the skill.

6320 6990 

6321 - `"function"`6991 - `path: string`

6322 6992 

6323 - `description: optional string or null`6993 The path to the directory containing the skill.

6324 6994 

6325 What the function does and when the delegated Responses model should call it.6995 - `ImageGeneration object { type }`

6326 6996 

6327 - `parameters: optional map[unknown] or null`6997 - `type: "image_generation"`

6328 6998 

6329 A JSON Schema object describing the arguments accepted by the function.6999 - `"image_generation"`

6330 7000 

6331 - `strict: optional boolean or null`7001 - `Mcp object { type }`

6332 7002 

6333 Whether the delegated Responses model must follow the function’s parameter schema exactly.7003 - `type: "mcp"`

6334 7004 

6335 - `WebSearch object { type }`7005 - `"mcp"`

6336 7006 

6337 A web search tool available to the Live session’s Responses backend.7007 - `Custom object { type }`

6338 7008 

6339 - `type: "web_search"`7009 - `type: "custom"`

6340 7010 

6341 The tool type. Always `web_search`.7011 - `"custom"`

6342 7012 

6343 - `"web_search"`7013 - `Namespace object { type }`

6344 7014 

6345 - `FileSearch object { type }`7015 - `type: "namespace"`

6346 7016 

6347 - `type: "file_search"`7017 - `"namespace"`

6348 7018 

6349 - `"file_search"`7019 - `ToolSearch object { type }`

6350 7020 

6351 - `CodeInterpreter object { type }`7021 - `type: "tool_search"`

6352 7022 

6353 - `type: "code_interpreter"`7023 - `"tool_search"`

6354 7024 

6355 - `"code_interpreter"`7025 - `ProgrammaticToolCalling object { type }`

6356 7026 

6357 - `Shell object { environment, type }`7027 - `type: "programmatic_tool_calling"`

6358 7028 

6359 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.7029 - `"programmatic_tool_calling"`

6360 7030 

6361 - `environment: map[unknown]`7031 - `Computer object { type }`

6362 7032 

6363 - `type: "shell"`7033 - `type: "computer"`

6364 7034 

6365 - `"shell"`7035 - `"computer"`

6366 7036 

6367 - `ImageGeneration object { type }`7037 - `ApplyPatch object { type }`

6368 7038 

6369 - `type: "image_generation"`7039 - `type: "apply_patch"`

6370 7040 

6371 - `"image_generation"`7041 - `"apply_patch"`

6372 7042 

6373 - `type: "responses"`7043 - `type: "responses"`

6374 7044 


7212 7882 

7213 The voice used for speech generated by the Live model.7883 The voice used for speech generated by the Live model.

7214 7884 

7215 - `voice: optional string or "alloy" or "ash" or "aube" or 29 more or CustomVoice`7885 - `voice: optional string or "alloy" or "ash" or "ballad" or 28 more or CustomVoice`

7216 7886 

7217 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.7887 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

7218 7888 

7219 - `string`7889 - `string`

7220 7890 

7221 - `"alloy" or "ash" or "aube" or 29 more`7891 - `"alloy" or "ash" or "ballad" or 28 more`

7222 7892 

7223 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.7893 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

7224 7894 


7226 7896 

7227 - `"ash"`7897 - `"ash"`

7228 7898 

7229 - `"aube"`

7230 

7231 - `"ballad"`7899 - `"ballad"`

7232 7900 

7233 - `"beacon"`7901 - `"beacon"`


7424 8092 

7425 - `"high"`8093 - `"high"`

7426 8094 

7427 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`8095 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

7428 8096 

7429 Controls which tool the Responses backend uses when handling a task delegated by the Live model.8097 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

7430 8098 

7431 - `LiveToolChoiceEnum = "auto" or "none" or "required"`8099 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

7432 8100 

8101 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

8102 

7433 - `"auto"`8103 - `"auto"`

7434 8104 

7435 - `"none"`8105 - `"none"`

7436 8106 

7437 - `"required"`8107 - `"required"`

7438 8108 

7439 - `LiveFunctionToolChoiceParam object { name, type }`8109 - `map[unknown]`

7440 

7441 - `name: string`

7442 

7443 - `type: "function"`

7444 

7445 - `"function"`

7446 

7447 - `LiveMCPToolChoiceParam object { name, server_label, type }`

7448 

7449 - `name: string`

7450 

7451 - `server_label: string`

7452 

7453 - `type: "mcp"`

7454 

7455 - `"mcp"`

7456 8110 

7457 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`8111 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

7458 8112 

7459 Tools available to the Responses backend while it handles tasks delegated by the Live model.8113 Tools available to the Responses backend while it handles tasks delegated by the Live model.

7460 8114 


7506 8160 

7507 - `"code_interpreter"`8161 - `"code_interpreter"`

7508 8162 

7509 - `Shell object { environment, type }`8163 - `Shell object { type, environment }`

7510 

7511 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.

7512 8164 

7513 - `environment: map[unknown]`8165 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

7514 8166 

7515 - `type: "shell"`8167 - `type: "shell"`

7516 8168 

7517 - `"shell"`8169 - `"shell"`

7518 8170 

8171 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

8172 

8173 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

8174 

8175 - `type: "container_auto"`

8176 

8177 Automatically creates a container for this request

8178 

8179 - `"container_auto"`

8180 

8181 - `file_ids: optional array of string or null`

8182 

8183 An optional list of uploaded files to make available to your code.

8184 

8185 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

8186 

8187 The memory limit for the container.

8188 

8189 - `"1g"`

8190 

8191 - `"4g"`

8192 

8193 - `"16g"`

8194 

8195 - `"64g"`

8196 

8197 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

8198 

8199 Network access policy for the container.

8200 

8201 - `Disabled object { type }`

8202 

8203 - `type: "disabled"`

8204 

8205 Disable outbound network access. Always `disabled`.

8206 

8207 - `"disabled"`

8208 

8209 - `Allowlist object { allowed_domains, type }`

8210 

8211 - `allowed_domains: array of string`

8212 

8213 A list of allowed domains when type is `allowlist`.

8214 

8215 - `type: "allowlist"`

8216 

8217 Allow outbound network access only to specified domains. Always `allowlist`.

8218 

8219 - `"allowlist"`

8220 

8221 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

8222 

8223 An optional list of skills referenced by id or inline data.

8224 

8225 - `SkillReference object { skill_id, type, version }`

8226 

8227 - `skill_id: string`

8228 

8229 The ID of the referenced skill.

8230 

8231 - `type: "skill_reference"`

8232 

8233 References a skill created with the /v1/skills endpoint.

8234 

8235 - `"skill_reference"`

8236 

8237 - `version: optional string or null`

8238 

8239 Optional skill version. Use a positive integer or 'latest'. Omit for default.

8240 

8241 - `Inline object { description, name, source, type }`

8242 

8243 - `description: string`

8244 

8245 The description of the skill.

8246 

8247 - `name: string`

8248 

8249 The name of the skill.

8250 

8251 - `source: object { data, media_type, type }`

8252 

8253 Inline skill payload

8254 

8255 - `data: string`

8256 

8257 Base64-encoded skill zip bundle.

8258 

8259 - `media_type: "application/zip"`

8260 

8261 The media type of the inline skill payload. Must be `application/zip`.

8262 

8263 - `"application/zip"`

8264 

8265 - `type: "base64"`

8266 

8267 The type of the inline skill source. Must be `base64`.

8268 

8269 - `"base64"`

8270 

8271 - `type: "inline"`

8272 

8273 Defines an inline skill for this request.

8274 

8275 - `"inline"`

8276 

8277 - `ContainerReference object { container_id, type }`

8278 

8279 - `container_id: string`

8280 

8281 The ID of the referenced container.

8282 

8283 - `type: "container_reference"`

8284 

8285 References a container created with the /v1/containers endpoint

8286 

8287 - `"container_reference"`

8288 

8289 - `Local object { type, skills }`

8290 

8291 - `type: "local"`

8292 

8293 Use a local computer environment.

8294 

8295 - `"local"`

8296 

8297 - `skills: optional array of object { description, name, path } or null`

8298 

8299 An optional list of skills.

8300 

8301 - `description: string`

8302 

8303 The description of the skill.

8304 

8305 - `name: string`

8306 

8307 The name of the skill.

8308 

8309 - `path: string`

8310 

8311 The path to the directory containing the skill.

8312 

7519 - `ImageGeneration object { type }`8313 - `ImageGeneration object { type }`

7520 8314 

7521 - `type: "image_generation"`8315 - `type: "image_generation"`

7522 8316 

7523 - `"image_generation"`8317 - `"image_generation"`

7524 8318 

8319 - `Mcp object { type }`

8320 

8321 - `type: "mcp"`

8322 

8323 - `"mcp"`

8324 

8325 - `Custom object { type }`

8326 

8327 - `type: "custom"`

8328 

8329 - `"custom"`

8330 

8331 - `Namespace object { type }`

8332 

8333 - `type: "namespace"`

8334 

8335 - `"namespace"`

8336 

8337 - `ToolSearch object { type }`

8338 

8339 - `type: "tool_search"`

8340 

8341 - `"tool_search"`

8342 

8343 - `ProgrammaticToolCalling object { type }`

8344 

8345 - `type: "programmatic_tool_calling"`

8346 

8347 - `"programmatic_tool_calling"`

8348 

8349 - `Computer object { type }`

8350 

8351 - `type: "computer"`

8352 

8353 - `"computer"`

8354 

8355 - `ApplyPatch object { type }`

8356 

8357 - `type: "apply_patch"`

8358 

8359 - `"apply_patch"`

8360 

7525 - `type: "responses"`8361 - `type: "responses"`

7526 8362 

7527 The delegation owner. Always `responses` for tasks handled by the Responses API.8363 The delegation owner. Always `responses` for tasks handled by the Responses API.

Details

156 156 

157 The voice used for speech generated by the Live model.157 The voice used for speech generated by the Live model.

158 158 

159 - `voice: optional string or "alloy" or "ash" or "aube" or 29 more or CustomVoice`159 - `voice: optional string or "alloy" or "ash" or "ballad" or 28 more or CustomVoice`

160 160 

161 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.161 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

162 162 

163 - `string`163 - `string`

164 164 

165 - `"alloy" or "ash" or "aube" or 29 more`165 - `"alloy" or "ash" or "ballad" or 28 more`

166 166 

167 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.167 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

168 168 


170 170 

171 - `"ash"`171 - `"ash"`

172 172 

173 - `"aube"`

174 

175 - `"ballad"`173 - `"ballad"`

176 174 

177 - `"beacon"`175 - `"beacon"`


368 366 

369 - `"high"`367 - `"high"`

370 368 

371 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`369 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

372 370 

373 Controls which tool the Responses backend uses when handling a task delegated by the Live model.371 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

374 372 

375 - `LiveToolChoiceEnum = "auto" or "none" or "required"`373 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

376 374 

375 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

376 

377 - `"auto"`377 - `"auto"`

378 378 

379 - `"none"`379 - `"none"`

380 380 

381 - `"required"`381 - `"required"`

382 382 

383 - `LiveFunctionToolChoiceParam object { name, type }`383 - `map[unknown]`

384 

385 - `name: string`

386 

387 - `type: "function"`

388 

389 - `"function"`

390 

391 - `LiveMCPToolChoiceParam object { name, server_label, type }`

392 

393 - `name: string`

394 

395 - `server_label: string`

396 

397 - `type: "mcp"`

398 

399 - `"mcp"`

400 384 

401 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`385 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

402 386 

403 Tools available to the Responses backend while it handles tasks delegated by the Live model.387 Tools available to the Responses backend while it handles tasks delegated by the Live model.

404 388 


450 434 

451 - `"code_interpreter"`435 - `"code_interpreter"`

452 436 

453 - `Shell object { environment, type }`437 - `Shell object { type, environment }`

454 438 

455 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.439 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

456 

457 - `environment: map[unknown]`

458 440 

459 - `type: "shell"`441 - `type: "shell"`

460 442 

461 - `"shell"`443 - `"shell"`

462 444 

445 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

446 

447 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

448 

449 - `type: "container_auto"`

450 

451 Automatically creates a container for this request

452 

453 - `"container_auto"`

454 

455 - `file_ids: optional array of string or null`

456 

457 An optional list of uploaded files to make available to your code.

458 

459 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

460 

461 The memory limit for the container.

462 

463 - `"1g"`

464 

465 - `"4g"`

466 

467 - `"16g"`

468 

469 - `"64g"`

470 

471 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

472 

473 Network access policy for the container.

474 

475 - `Disabled object { type }`

476 

477 - `type: "disabled"`

478 

479 Disable outbound network access. Always `disabled`.

480 

481 - `"disabled"`

482 

483 - `Allowlist object { allowed_domains, type }`

484 

485 - `allowed_domains: array of string`

486 

487 A list of allowed domains when type is `allowlist`.

488 

489 - `type: "allowlist"`

490 

491 Allow outbound network access only to specified domains. Always `allowlist`.

492 

493 - `"allowlist"`

494 

495 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

496 

497 An optional list of skills referenced by id or inline data.

498 

499 - `SkillReference object { skill_id, type, version }`

500 

501 - `skill_id: string`

502 

503 The ID of the referenced skill.

504 

505 - `type: "skill_reference"`

506 

507 References a skill created with the /v1/skills endpoint.

508 

509 - `"skill_reference"`

510 

511 - `version: optional string or null`

512 

513 Optional skill version. Use a positive integer or 'latest'. Omit for default.

514 

515 - `Inline object { description, name, source, type }`

516 

517 - `description: string`

518 

519 The description of the skill.

520 

521 - `name: string`

522 

523 The name of the skill.

524 

525 - `source: object { data, media_type, type }`

526 

527 Inline skill payload

528 

529 - `data: string`

530 

531 Base64-encoded skill zip bundle.

532 

533 - `media_type: "application/zip"`

534 

535 The media type of the inline skill payload. Must be `application/zip`.

536 

537 - `"application/zip"`

538 

539 - `type: "base64"`

540 

541 The type of the inline skill source. Must be `base64`.

542 

543 - `"base64"`

544 

545 - `type: "inline"`

546 

547 Defines an inline skill for this request.

548 

549 - `"inline"`

550 

551 - `ContainerReference object { container_id, type }`

552 

553 - `container_id: string`

554 

555 The ID of the referenced container.

556 

557 - `type: "container_reference"`

558 

559 References a container created with the /v1/containers endpoint

560 

561 - `"container_reference"`

562 

563 - `Local object { type, skills }`

564 

565 - `type: "local"`

566 

567 Use a local computer environment.

568 

569 - `"local"`

570 

571 - `skills: optional array of object { description, name, path } or null`

572 

573 An optional list of skills.

574 

575 - `description: string`

576 

577 The description of the skill.

578 

579 - `name: string`

580 

581 The name of the skill.

582 

583 - `path: string`

584 

585 The path to the directory containing the skill.

586 

463 - `ImageGeneration object { type }`587 - `ImageGeneration object { type }`

464 588 

465 - `type: "image_generation"`589 - `type: "image_generation"`

466 590 

467 - `"image_generation"`591 - `"image_generation"`

468 592 

593 - `Mcp object { type }`

594 

595 - `type: "mcp"`

596 

597 - `"mcp"`

598 

599 - `Custom object { type }`

600 

601 - `type: "custom"`

602 

603 - `"custom"`

604 

605 - `Namespace object { type }`

606 

607 - `type: "namespace"`

608 

609 - `"namespace"`

610 

611 - `ToolSearch object { type }`

612 

613 - `type: "tool_search"`

614 

615 - `"tool_search"`

616 

617 - `ProgrammaticToolCalling object { type }`

618 

619 - `type: "programmatic_tool_calling"`

620 

621 - `"programmatic_tool_calling"`

622 

623 - `Computer object { type }`

624 

625 - `type: "computer"`

626 

627 - `"computer"`

628 

629 - `ApplyPatch object { type }`

630 

631 - `type: "apply_patch"`

632 

633 - `"apply_patch"`

634 

469 - `type: "responses"`635 - `type: "responses"`

470 636 

471 The delegation owner. Always `responses` for tasks handled by the Responses API.637 The delegation owner. Always `responses` for tasks handled by the Responses API.


781 947 

782 - `"high"`948 - `"high"`

783 949 

784 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`950 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

785 951 

786 Controls which tool the Responses backend uses when handling a task delegated by the Live model.952 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

787 953 

788 - `LiveToolChoiceEnum = "auto" or "none" or "required"`954 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

789 955 

956 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

957 

790 - `"auto"`958 - `"auto"`

791 959 

792 - `"none"`960 - `"none"`

793 961 

794 - `"required"`962 - `"required"`

795 963 

796 - `LiveFunctionToolChoiceParam object { name, type }`964 - `map[unknown]`

797 

798 - `name: string`

799 

800 - `type: "function"`

801 

802 - `"function"`

803 

804 - `LiveMCPToolChoiceParam object { name, server_label, type }`

805 

806 - `name: string`

807 

808 - `server_label: string`

809 965 

810 - `type: "mcp"`966 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

811 

812 - `"mcp"`

813 

814 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`

815 967 

816 Tools available to the Responses backend while it handles tasks delegated by the Live model.968 Tools available to the Responses backend while it handles tasks delegated by the Live model.

817 969 


863 1015 

864 - `"code_interpreter"`1016 - `"code_interpreter"`

865 1017 

866 - `Shell object { environment, type }`1018 - `Shell object { type, environment }`

867 1019 

868 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.1020 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

869 

870 - `environment: map[unknown]`

871 1021 

872 - `type: "shell"`1022 - `type: "shell"`

873 1023 

874 - `"shell"`1024 - `"shell"`

875 1025 

876 - `ImageGeneration object { type }`1026 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

877 1027 

878 - `type: "image_generation"`1028 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

879 1029 

880 - `"image_generation"`1030 - `type: "container_auto"`

881 1031 

882- `type: "session.update"`1032 Automatically creates a container for this request

883 1033 

884 The Live client event type. Always `session.update`.1034 - `"container_auto"`

885 1035 

886 - `"session.update"`1036 - `file_ids: optional array of string or null`

887 1037 

888- `event_id: optional string or null`1038 An optional list of uploaded files to make available to your code.

889 1039 

890 Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.1040 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

891 1041 

892#### Example1042 The memory limit for the container.

893 1043 

894```json1044 - `"1g"`

895{

896 "type": "session.update",

897 "event_id": "evt_update_001",

898 "session": {

899 "delegation": {

900 "type": "responses",

901 "responses": {

902 "instructions": "Check restaurant availability. Ask before confirming a booking.",

903 "max_output_tokens": 1024

904 }

905 }

906 }

907}

908```

909 1045 

910<a id="session.input_audio.append"></a>1046 - `"4g"`

911 1047 

912### session.input_audio.append1048 - `"16g"`

913 1049 

914Send audio to a Live session over its primary WebSocket. WebRTC and SIP sessions send audio over their media transport.1050 - `"64g"`

915 1051 

916#### Schema1052 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

917 1053 

918Schema name: `LiveInputAudioAppendEvent`1054 Network access policy for the container.

919 1055 

920- `audio: string`1056 - `Disabled object { type }`

921 1057 

922 Base64-encoded raw audio in the startup-selected format, without a WAV or other container header. Primary WebSocket only; media transports use their audio track. Audio appends have no acknowledgment. Reflected sideband server events reuse this event type and audio key, with no timestamps or event_id; their audio is always mono PCM16LE at 24 kHz.1058 - `type: "disabled"`

923 1059 

924- `type: "session.input_audio.append"`1060 Disable outbound network access. Always `disabled`.

925 1061 

926 The Live client event type. Always `session.input_audio.append`.1062 - `"disabled"`

927 1063 

928 - `"session.input_audio.append"`1064 - `Allowlist object { allowed_domains, type }`

929 1065 

930- `event_id: optional string or null`1066 - `allowed_domains: array of string`

1067 

1068 A list of allowed domains when type is `allowlist`.

1069 

1070 - `type: "allowlist"`

1071 

1072 Allow outbound network access only to specified domains. Always `allowlist`.

1073 

1074 - `"allowlist"`

1075 

1076 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

1077 

1078 An optional list of skills referenced by id or inline data.

1079 

1080 - `SkillReference object { skill_id, type, version }`

1081 

1082 - `skill_id: string`

1083 

1084 The ID of the referenced skill.

1085 

1086 - `type: "skill_reference"`

1087 

1088 References a skill created with the /v1/skills endpoint.

1089 

1090 - `"skill_reference"`

1091 

1092 - `version: optional string or null`

1093 

1094 Optional skill version. Use a positive integer or 'latest'. Omit for default.

1095 

1096 - `Inline object { description, name, source, type }`

1097 

1098 - `description: string`

1099 

1100 The description of the skill.

1101 

1102 - `name: string`

1103 

1104 The name of the skill.

1105 

1106 - `source: object { data, media_type, type }`

1107 

1108 Inline skill payload

1109 

1110 - `data: string`

1111 

1112 Base64-encoded skill zip bundle.

1113 

1114 - `media_type: "application/zip"`

1115 

1116 The media type of the inline skill payload. Must be `application/zip`.

1117 

1118 - `"application/zip"`

1119 

1120 - `type: "base64"`

1121 

1122 The type of the inline skill source. Must be `base64`.

1123 

1124 - `"base64"`

1125 

1126 - `type: "inline"`

1127 

1128 Defines an inline skill for this request.

1129 

1130 - `"inline"`

1131 

1132 - `ContainerReference object { container_id, type }`

1133 

1134 - `container_id: string`

1135 

1136 The ID of the referenced container.

1137 

1138 - `type: "container_reference"`

1139 

1140 References a container created with the /v1/containers endpoint

1141 

1142 - `"container_reference"`

1143 

1144 - `Local object { type, skills }`

1145 

1146 - `type: "local"`

1147 

1148 Use a local computer environment.

1149 

1150 - `"local"`

1151 

1152 - `skills: optional array of object { description, name, path } or null`

1153 

1154 An optional list of skills.

1155 

1156 - `description: string`

1157 

1158 The description of the skill.

1159 

1160 - `name: string`

1161 

1162 The name of the skill.

1163 

1164 - `path: string`

1165 

1166 The path to the directory containing the skill.

1167 

1168 - `ImageGeneration object { type }`

1169 

1170 - `type: "image_generation"`

1171 

1172 - `"image_generation"`

1173 

1174 - `Mcp object { type }`

1175 

1176 - `type: "mcp"`

1177 

1178 - `"mcp"`

1179 

1180 - `Custom object { type }`

1181 

1182 - `type: "custom"`

1183 

1184 - `"custom"`

1185 

1186 - `Namespace object { type }`

1187 

1188 - `type: "namespace"`

1189 

1190 - `"namespace"`

1191 

1192 - `ToolSearch object { type }`

1193 

1194 - `type: "tool_search"`

1195 

1196 - `"tool_search"`

1197 

1198 - `ProgrammaticToolCalling object { type }`

1199 

1200 - `type: "programmatic_tool_calling"`

1201 

1202 - `"programmatic_tool_calling"`

1203 

1204 - `Computer object { type }`

1205 

1206 - `type: "computer"`

1207 

1208 - `"computer"`

1209 

1210 - `ApplyPatch object { type }`

1211 

1212 - `type: "apply_patch"`

1213 

1214 - `"apply_patch"`

1215 

1216- `type: "session.update"`

1217 

1218 The Live client event type. Always `session.update`.

1219 

1220 - `"session.update"`

1221 

1222- `event_id: optional string or null`

1223 

1224 Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.

1225 

1226#### Example

1227 

1228```json

1229{

1230 "type": "session.update",

1231 "event_id": "evt_update_001",

1232 "session": {

1233 "delegation": {

1234 "type": "responses",

1235 "responses": {

1236 "instructions": "Check restaurant availability. Ask before confirming a booking.",

1237 "max_output_tokens": 1024

1238 }

1239 }

1240 }

1241}

1242```

1243 

1244<a id="session.input_audio.append"></a>

1245 

1246### session.input_audio.append

1247 

1248Send audio to a Live session over its primary WebSocket. WebRTC and SIP sessions send audio over their media transport.

1249 

1250#### Schema

1251 

1252Schema name: `LiveInputAudioAppendEvent`

1253 

1254- `audio: string`

1255 

1256 Base64-encoded raw audio in the startup-selected format, without a WAV or other container header. Primary WebSocket only; media transports use their audio track. Audio appends have no acknowledgment. Reflected sideband server events reuse this event type and audio key, with no timestamps or event_id; their audio is always mono PCM16LE at 24 kHz.

1257 

1258- `type: "session.input_audio.append"`

1259 

1260 The Live client event type. Always `session.input_audio.append`.

1261 

1262 - `"session.input_audio.append"`

1263 

1264- `event_id: optional string or null`

931 1265 

932 Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.1266 Optional client identifier for correlating this command with a server event's client_event_id or error.client_event_id.

933 1267 


3235 3569 

3236 - `"grammar"`3570 - `"grammar"`

3237 3571 

3238 - `Namespace object { description, name, tools, type }`3572 - `ToolSearchOutputNamespaceTool object { description, name, tools, type }`

3239 3573 

3240 Groups function/custom tools under a shared namespace.3574 Groups function/custom tools under a shared namespace.

3241 3575 


3249 3583 

3250 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`3584 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`

3251 3585 

3252 The function/custom tools available inside this namespace.3586 The function/custom tools loaded inside this namespace.

3253 3587 

3254 - `Function object { name, type, allowed_callers, 6 more }`3588 - `Function object { name, type, allowed_callers, 6 more }`

3255 3589 

3256 - `name: string`3590 - `name: string`

3257 3591 

3592 The name of the loaded function tool.

3593 

3258 - `type: "function"`3594 - `type: "function"`

3259 3595 

3260 - `"function"`3596 - `"function"`


5736 6072 

5737 The voice used for speech generated by the Live model.6073 The voice used for speech generated by the Live model.

5738 6074 

5739 - `voice: optional string or "alloy" or "ash" or "aube" or 29 more or CustomVoice`6075 - `voice: optional string or "alloy" or "ash" or "ballad" or 28 more or CustomVoice`

5740 6076 

5741 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.6077 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

5742 6078 

5743 - `string`6079 - `string`

5744 6080 

5745 - `"alloy" or "ash" or "aube" or 29 more`6081 - `"alloy" or "ash" or "ballad" or 28 more`

5746 6082 

5747 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.6083 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

5748 6084 


5750 6086 

5751 - `"ash"`6087 - `"ash"`

5752 6088 

5753 - `"aube"`

5754 

5755 - `"ballad"`6089 - `"ballad"`

5756 6090 

5757 - `"beacon"`6091 - `"beacon"`


5948 6282 

5949 - `"high"`6283 - `"high"`

5950 6284 

5951 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`6285 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

5952 6286 

5953 Controls which tool the Responses backend uses when handling a task delegated by the Live model.6287 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

5954 6288 

5955 - `LiveToolChoiceEnum = "auto" or "none" or "required"`6289 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

5956 6290 

6291 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

6292 

5957 - `"auto"`6293 - `"auto"`

5958 6294 

5959 - `"none"`6295 - `"none"`

5960 6296 

5961 - `"required"`6297 - `"required"`

5962 6298 

5963 - `LiveFunctionToolChoiceParam object { name, type }`6299 - `map[unknown]`

5964 

5965 - `name: string`

5966 

5967 - `type: "function"`

5968 

5969 - `"function"`

5970 

5971 - `LiveMCPToolChoiceParam object { name, server_label, type }`

5972 

5973 - `name: string`

5974 

5975 - `server_label: string`

5976 

5977 - `type: "mcp"`

5978 

5979 - `"mcp"`

5980 6300 

5981 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`6301 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

5982 6302 

5983 Tools available to the Responses backend while it handles tasks delegated by the Live model.6303 Tools available to the Responses backend while it handles tasks delegated by the Live model.

5984 6304 


6030 6350 

6031 - `"code_interpreter"`6351 - `"code_interpreter"`

6032 6352 

6033 - `Shell object { environment, type }`6353 - `Shell object { type, environment }`

6034 6354 

6035 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.6355 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

6036 

6037 - `environment: map[unknown]`

6038 6356 

6039 - `type: "shell"`6357 - `type: "shell"`

6040 6358 

6041 - `"shell"`6359 - `"shell"`

6042 6360 

6043 - `ImageGeneration object { type }`6361 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

6044 6362 

6045 - `type: "image_generation"`6363 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

6046 6364 

6047 - `"image_generation"`6365 - `type: "container_auto"`

6048 6366 

6049 - `type: "responses"`6367 Automatically creates a container for this request

6050 6368 

6051 The delegation owner. Always `responses` for tasks handled by the Responses API.6369 - `"container_auto"`

6052 6370 

6053 - `"responses"`6371 - `file_ids: optional array of string or null`

6054 6372 

6055 - `input: optional array of InitialItem`6373 An optional list of uploaded files to make available to your code.

6056 6374 

6057 Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total.6375 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

6058 6376 

6059 - `Developer object { content, role, id, 2 more }`6377 The memory limit for the container.

6060 6378 

6061 A developer message included in the initial text history of a Live session.6379 - `"1g"`

6062 6380 

6063 - `content: array of object { text, type }`6381 - `"4g"`

6064 6382 

6065 The message content. Supply exactly one text part for the initial Live conversation history.6383 - `"16g"`

6066 6384 

6067 - `text: string`6385 - `"64g"`

6068 6386 

6069 The message text to include in the Live session’s initial conversation history.6387 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

6070 6388 

6071 - `type: optional "input_text"`6389 Network access policy for the container.

6072 6390 

6073 The text content type. Always `input_text`.6391 - `Disabled object { type }`

6074 6392 

6075 - `"input_text"`6393 - `type: "disabled"`

6076 6394 

6077 - `role: "developer"`6395 Disable outbound network access. Always `disabled`.

6078 6396 

6079 The author of this history message. Always `developer`.6397 - `"disabled"`

6080 6398 

6081 - `"developer"`6399 - `Allowlist object { allowed_domains, type }`

6082 6400 

6083 - `id: optional string or null`6401 - `allowed_domains: array of string`

6084 6402 

6085 An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation.6403 A list of allowed domains when type is `allowlist`.

6086 6404 

6087 - `status: optional "incomplete" or "completed" or null`6405 - `type: "allowlist"`

6088 6406 

6089 The supplied message’s status. Live uses its text as history and does not resume an incomplete message.6407 Allow outbound network access only to specified domains. Always `allowlist`.

6090 6408 

6091 - `"incomplete"`6409 - `"allowlist"`

6092 6410 

6093 - `"completed"`6411 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

6094 6412 

6095 - `type: optional "message"`6413 An optional list of skills referenced by id or inline data.

6414 

6415 - `SkillReference object { skill_id, type, version }`

6416 

6417 - `skill_id: string`

6418 

6419 The ID of the referenced skill.

6420 

6421 - `type: "skill_reference"`

6422 

6423 References a skill created with the /v1/skills endpoint.

6424 

6425 - `"skill_reference"`

6426 

6427 - `version: optional string or null`

6428 

6429 Optional skill version. Use a positive integer or 'latest'. Omit for default.

6430 

6431 - `Inline object { description, name, source, type }`

6432 

6433 - `description: string`

6434 

6435 The description of the skill.

6436 

6437 - `name: string`

6438 

6439 The name of the skill.

6440 

6441 - `source: object { data, media_type, type }`

6442 

6443 Inline skill payload

6444 

6445 - `data: string`

6446 

6447 Base64-encoded skill zip bundle.

6448 

6449 - `media_type: "application/zip"`

6450 

6451 The media type of the inline skill payload. Must be `application/zip`.

6452 

6453 - `"application/zip"`

6454 

6455 - `type: "base64"`

6456 

6457 The type of the inline skill source. Must be `base64`.

6458 

6459 - `"base64"`

6460 

6461 - `type: "inline"`

6462 

6463 Defines an inline skill for this request.

6464 

6465 - `"inline"`

6466 

6467 - `ContainerReference object { container_id, type }`

6468 

6469 - `container_id: string`

6470 

6471 The ID of the referenced container.

6472 

6473 - `type: "container_reference"`

6474 

6475 References a container created with the /v1/containers endpoint

6476 

6477 - `"container_reference"`

6478 

6479 - `Local object { type, skills }`

6480 

6481 - `type: "local"`

6482 

6483 Use a local computer environment.

6484 

6485 - `"local"`

6486 

6487 - `skills: optional array of object { description, name, path } or null`

6488 

6489 An optional list of skills.

6490 

6491 - `description: string`

6492 

6493 The description of the skill.

6494 

6495 - `name: string`

6496 

6497 The name of the skill.

6498 

6499 - `path: string`

6500 

6501 The path to the directory containing the skill.

6502 

6503 - `ImageGeneration object { type }`

6504 

6505 - `type: "image_generation"`

6506 

6507 - `"image_generation"`

6508 

6509 - `Mcp object { type }`

6510 

6511 - `type: "mcp"`

6512 

6513 - `"mcp"`

6514 

6515 - `Custom object { type }`

6516 

6517 - `type: "custom"`

6518 

6519 - `"custom"`

6520 

6521 - `Namespace object { type }`

6522 

6523 - `type: "namespace"`

6524 

6525 - `"namespace"`

6526 

6527 - `ToolSearch object { type }`

6528 

6529 - `type: "tool_search"`

6530 

6531 - `"tool_search"`

6532 

6533 - `ProgrammaticToolCalling object { type }`

6534 

6535 - `type: "programmatic_tool_calling"`

6536 

6537 - `"programmatic_tool_calling"`

6538 

6539 - `Computer object { type }`

6540 

6541 - `type: "computer"`

6542 

6543 - `"computer"`

6544 

6545 - `ApplyPatch object { type }`

6546 

6547 - `type: "apply_patch"`

6548 

6549 - `"apply_patch"`

6550 

6551 - `type: "responses"`

6552 

6553 The delegation owner. Always `responses` for tasks handled by the Responses API.

6554 

6555 - `"responses"`

6556 

6557 - `input: optional array of InitialItem`

6558 

6559 Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total.

6560 

6561 - `Developer object { content, role, id, 2 more }`

6562 

6563 A developer message included in the initial text history of a Live session.

6564 

6565 - `content: array of object { text, type }`

6566 

6567 The message content. Supply exactly one text part for the initial Live conversation history.

6568 

6569 - `text: string`

6570 

6571 The message text to include in the Live session’s initial conversation history.

6572 

6573 - `type: optional "input_text"`

6574 

6575 The text content type. Always `input_text`.

6576 

6577 - `"input_text"`

6578 

6579 - `role: "developer"`

6580 

6581 The author of this history message. Always `developer`.

6582 

6583 - `"developer"`

6584 

6585 - `id: optional string or null`

6586 

6587 An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation.

6588 

6589 - `status: optional "incomplete" or "completed" or null`

6590 

6591 The supplied message’s status. Live uses its text as history and does not resume an incomplete message.

6592 

6593 - `"incomplete"`

6594 

6595 - `"completed"`

6596 

6597 - `type: optional "message"`

6096 6598 

6097 The history item type. Always `message`.6599 The history item type. Always `message`.

6098 6600 


6350 6852 

6351 The voice used for speech generated by the Live model.6853 The voice used for speech generated by the Live model.

6352 6854 

6353 - `voice: optional string or "alloy" or "ash" or "aube" or 29 more or CustomVoice`6855 - `voice: optional string or "alloy" or "ash" or "ballad" or 28 more or CustomVoice`

6354 6856 

6355 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.6857 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

6356 6858 

6357 - `string`6859 - `string`

6358 6860 

6359 - `"alloy" or "ash" or "aube" or 29 more`6861 - `"alloy" or "ash" or "ballad" or 28 more`

6360 6862 

6361 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.6863 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

6362 6864 


6364 6866 

6365 - `"ash"`6867 - `"ash"`

6366 6868 

6367 - `"aube"`

6368 

6369 - `"ballad"`6869 - `"ballad"`

6370 6870 

6371 - `"beacon"`6871 - `"beacon"`


6562 7062 

6563 - `"high"`7063 - `"high"`

6564 7064 

6565 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`7065 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

6566 7066 

6567 Controls which tool the Responses backend uses when handling a task delegated by the Live model.7067 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

6568 7068 

6569 - `LiveToolChoiceEnum = "auto" or "none" or "required"`7069 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

6570 7070 

7071 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

7072 

6571 - `"auto"`7073 - `"auto"`

6572 7074 

6573 - `"none"`7075 - `"none"`

6574 7076 

6575 - `"required"`7077 - `"required"`

6576 7078 

6577 - `LiveFunctionToolChoiceParam object { name, type }`7079 - `map[unknown]`

7080 

7081 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

7082 

7083 Tools available to the Responses backend while it handles tasks delegated by the Live model.

7084 

7085 - `FunctionTool object { name, type, description, 2 more }`

7086 

7087 A function tool available to the Responses backend when the Live model delegates a task.

6578 7088 

6579 - `name: string`7089 - `name: string`

6580 7090 

7091 The name the delegated Responses model uses when calling this function.

7092 

6581 - `type: "function"`7093 - `type: "function"`

6582 7094 

6583 - `"function"`7095 The tool type. Always `function`.

7096 

7097 - `"function"`

7098 

7099 - `description: optional string or null`

7100 

7101 What the function does and when the delegated Responses model should call it.

7102 

7103 - `parameters: optional map[unknown] or null`

7104 

7105 A JSON Schema object describing the arguments accepted by the function.

7106 

7107 - `strict: optional boolean or null`

7108 

7109 Whether the delegated Responses model must follow the function’s parameter schema exactly.

7110 

7111 - `WebSearch object { type }`

7112 

7113 A web search tool available to the Live session’s Responses backend.

7114 

7115 - `type: "web_search"`

7116 

7117 The tool type. Always `web_search`.

7118 

7119 - `"web_search"`

7120 

7121 - `FileSearch object { type }`

7122 

7123 - `type: "file_search"`

7124 

7125 - `"file_search"`

7126 

7127 - `CodeInterpreter object { type }`

7128 

7129 - `type: "code_interpreter"`

7130 

7131 - `"code_interpreter"`

7132 

7133 - `Shell object { type, environment }`

7134 

7135 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

7136 

7137 - `type: "shell"`

7138 

7139 - `"shell"`

7140 

7141 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

7142 

7143 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

7144 

7145 - `type: "container_auto"`

7146 

7147 Automatically creates a container for this request

7148 

7149 - `"container_auto"`

7150 

7151 - `file_ids: optional array of string or null`

7152 

7153 An optional list of uploaded files to make available to your code.

7154 

7155 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

7156 

7157 The memory limit for the container.

7158 

7159 - `"1g"`

7160 

7161 - `"4g"`

7162 

7163 - `"16g"`

7164 

7165 - `"64g"`

7166 

7167 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

7168 

7169 Network access policy for the container.

7170 

7171 - `Disabled object { type }`

7172 

7173 - `type: "disabled"`

7174 

7175 Disable outbound network access. Always `disabled`.

7176 

7177 - `"disabled"`

7178 

7179 - `Allowlist object { allowed_domains, type }`

7180 

7181 - `allowed_domains: array of string`

7182 

7183 A list of allowed domains when type is `allowlist`.

7184 

7185 - `type: "allowlist"`

7186 

7187 Allow outbound network access only to specified domains. Always `allowlist`.

7188 

7189 - `"allowlist"`

7190 

7191 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

7192 

7193 An optional list of skills referenced by id or inline data.

7194 

7195 - `SkillReference object { skill_id, type, version }`

7196 

7197 - `skill_id: string`

7198 

7199 The ID of the referenced skill.

7200 

7201 - `type: "skill_reference"`

7202 

7203 References a skill created with the /v1/skills endpoint.

7204 

7205 - `"skill_reference"`

7206 

7207 - `version: optional string or null`

7208 

7209 Optional skill version. Use a positive integer or 'latest'. Omit for default.

7210 

7211 - `Inline object { description, name, source, type }`

7212 

7213 - `description: string`

7214 

7215 The description of the skill.

7216 

7217 - `name: string`

7218 

7219 The name of the skill.

7220 

7221 - `source: object { data, media_type, type }`

7222 

7223 Inline skill payload

7224 

7225 - `data: string`

7226 

7227 Base64-encoded skill zip bundle.

7228 

7229 - `media_type: "application/zip"`

7230 

7231 The media type of the inline skill payload. Must be `application/zip`.

7232 

7233 - `"application/zip"`

7234 

7235 - `type: "base64"`

7236 

7237 The type of the inline skill source. Must be `base64`.

7238 

7239 - `"base64"`

7240 

7241 - `type: "inline"`

7242 

7243 Defines an inline skill for this request.

7244 

7245 - `"inline"`

7246 

7247 - `ContainerReference object { container_id, type }`

7248 

7249 - `container_id: string`

7250 

7251 The ID of the referenced container.

6584 7252 

6585 - `LiveMCPToolChoiceParam object { name, server_label, type }`7253 - `type: "container_reference"`

6586 7254 

6587 - `name: string`7255 References a container created with the /v1/containers endpoint

6588 7256 

6589 - `server_label: string`7257 - `"container_reference"`

6590 7258 

6591 - `type: "mcp"`7259 - `Local object { type, skills }`

6592 7260 

6593 - `"mcp"`7261 - `type: "local"`

6594 7262 

6595 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`7263 Use a local computer environment.

6596 7264 

6597 Tools available to the Responses backend while it handles tasks delegated by the Live model.7265 - `"local"`

6598 7266 

6599 - `FunctionTool object { name, type, description, 2 more }`7267 - `skills: optional array of object { description, name, path } or null`

6600 7268 

6601 A function tool available to the Responses backend when the Live model delegates a task.7269 An optional list of skills.

6602 7270 

6603 - `name: string`7271 - `description: string`

6604 7272 

6605 The name the delegated Responses model uses when calling this function.7273 The description of the skill.

6606 7274 

6607 - `type: "function"`7275 - `name: string`

6608 7276 

6609 The tool type. Always `function`.7277 The name of the skill.

6610 7278 

6611 - `"function"`7279 - `path: string`

6612 7280 

6613 - `description: optional string or null`7281 The path to the directory containing the skill.

6614 7282 

6615 What the function does and when the delegated Responses model should call it.7283 - `ImageGeneration object { type }`

6616 7284 

6617 - `parameters: optional map[unknown] or null`7285 - `type: "image_generation"`

6618 7286 

6619 A JSON Schema object describing the arguments accepted by the function.7287 - `"image_generation"`

6620 7288 

6621 - `strict: optional boolean or null`7289 - `Mcp object { type }`

6622 7290 

6623 Whether the delegated Responses model must follow the function’s parameter schema exactly.7291 - `type: "mcp"`

6624 7292 

6625 - `WebSearch object { type }`7293 - `"mcp"`

6626 7294 

6627 A web search tool available to the Live session’s Responses backend.7295 - `Custom object { type }`

6628 7296 

6629 - `type: "web_search"`7297 - `type: "custom"`

6630 7298 

6631 The tool type. Always `web_search`.7299 - `"custom"`

6632 7300 

6633 - `"web_search"`7301 - `Namespace object { type }`

6634 7302 

6635 - `FileSearch object { type }`7303 - `type: "namespace"`

6636 7304 

6637 - `type: "file_search"`7305 - `"namespace"`

6638 7306 

6639 - `"file_search"`7307 - `ToolSearch object { type }`

6640 7308 

6641 - `CodeInterpreter object { type }`7309 - `type: "tool_search"`

6642 7310 

6643 - `type: "code_interpreter"`7311 - `"tool_search"`

6644 7312 

6645 - `"code_interpreter"`7313 - `ProgrammaticToolCalling object { type }`

6646 7314 

6647 - `Shell object { environment, type }`7315 - `type: "programmatic_tool_calling"`

6648 7316 

6649 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.7317 - `"programmatic_tool_calling"`

6650 7318 

6651 - `environment: map[unknown]`7319 - `Computer object { type }`

6652 7320 

6653 - `type: "shell"`7321 - `type: "computer"`

6654 7322 

6655 - `"shell"`7323 - `"computer"`

6656 7324 

6657 - `ImageGeneration object { type }`7325 - `ApplyPatch object { type }`

6658 7326 

6659 - `type: "image_generation"`7327 - `type: "apply_patch"`

6660 7328 

6661 - `"image_generation"`7329 - `"apply_patch"`

6662 7330 

6663 - `type: "responses"`7331 - `type: "responses"`

6664 7332 


7502 8170 

7503 The voice used for speech generated by the Live model.8171 The voice used for speech generated by the Live model.

7504 8172 

7505 - `voice: optional string or "alloy" or "ash" or "aube" or 29 more or CustomVoice`8173 - `voice: optional string or "alloy" or "ash" or "ballad" or 28 more or CustomVoice`

7506 8174 

7507 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.8175 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

7508 8176 

7509 - `string`8177 - `string`

7510 8178 

7511 - `"alloy" or "ash" or "aube" or 29 more`8179 - `"alloy" or "ash" or "ballad" or 28 more`

7512 8180 

7513 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.8181 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

7514 8182 


7516 8184 

7517 - `"ash"`8185 - `"ash"`

7518 8186 

7519 - `"aube"`

7520 

7521 - `"ballad"`8187 - `"ballad"`

7522 8188 

7523 - `"beacon"`8189 - `"beacon"`


7714 8380 

7715 - `"high"`8381 - `"high"`

7716 8382 

7717 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`8383 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

7718 8384 

7719 Controls which tool the Responses backend uses when handling a task delegated by the Live model.8385 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

7720 8386 

7721 - `LiveToolChoiceEnum = "auto" or "none" or "required"`8387 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

7722 8388 

8389 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

8390 

7723 - `"auto"`8391 - `"auto"`

7724 8392 

7725 - `"none"`8393 - `"none"`

7726 8394 

7727 - `"required"`8395 - `"required"`

7728 8396 

7729 - `LiveFunctionToolChoiceParam object { name, type }`8397 - `map[unknown]`

7730 

7731 - `name: string`

7732 

7733 - `type: "function"`

7734 

7735 - `"function"`

7736 

7737 - `LiveMCPToolChoiceParam object { name, server_label, type }`

7738 

7739 - `name: string`

7740 

7741 - `server_label: string`

7742 

7743 - `type: "mcp"`

7744 

7745 - `"mcp"`

7746 8398 

7747 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`8399 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

7748 8400 

7749 Tools available to the Responses backend while it handles tasks delegated by the Live model.8401 Tools available to the Responses backend while it handles tasks delegated by the Live model.

7750 8402 


7796 8448 

7797 - `"code_interpreter"`8449 - `"code_interpreter"`

7798 8450 

7799 - `Shell object { environment, type }`8451 - `Shell object { type, environment }`

7800 

7801 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.

7802 8452 

7803 - `environment: map[unknown]`8453 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

7804 8454 

7805 - `type: "shell"`8455 - `type: "shell"`

7806 8456 

7807 - `"shell"`8457 - `"shell"`

7808 8458 

8459 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

8460 

8461 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

8462 

8463 - `type: "container_auto"`

8464 

8465 Automatically creates a container for this request

8466 

8467 - `"container_auto"`

8468 

8469 - `file_ids: optional array of string or null`

8470 

8471 An optional list of uploaded files to make available to your code.

8472 

8473 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

8474 

8475 The memory limit for the container.

8476 

8477 - `"1g"`

8478 

8479 - `"4g"`

8480 

8481 - `"16g"`

8482 

8483 - `"64g"`

8484 

8485 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

8486 

8487 Network access policy for the container.

8488 

8489 - `Disabled object { type }`

8490 

8491 - `type: "disabled"`

8492 

8493 Disable outbound network access. Always `disabled`.

8494 

8495 - `"disabled"`

8496 

8497 - `Allowlist object { allowed_domains, type }`

8498 

8499 - `allowed_domains: array of string`

8500 

8501 A list of allowed domains when type is `allowlist`.

8502 

8503 - `type: "allowlist"`

8504 

8505 Allow outbound network access only to specified domains. Always `allowlist`.

8506 

8507 - `"allowlist"`

8508 

8509 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

8510 

8511 An optional list of skills referenced by id or inline data.

8512 

8513 - `SkillReference object { skill_id, type, version }`

8514 

8515 - `skill_id: string`

8516 

8517 The ID of the referenced skill.

8518 

8519 - `type: "skill_reference"`

8520 

8521 References a skill created with the /v1/skills endpoint.

8522 

8523 - `"skill_reference"`

8524 

8525 - `version: optional string or null`

8526 

8527 Optional skill version. Use a positive integer or 'latest'. Omit for default.

8528 

8529 - `Inline object { description, name, source, type }`

8530 

8531 - `description: string`

8532 

8533 The description of the skill.

8534 

8535 - `name: string`

8536 

8537 The name of the skill.

8538 

8539 - `source: object { data, media_type, type }`

8540 

8541 Inline skill payload

8542 

8543 - `data: string`

8544 

8545 Base64-encoded skill zip bundle.

8546 

8547 - `media_type: "application/zip"`

8548 

8549 The media type of the inline skill payload. Must be `application/zip`.

8550 

8551 - `"application/zip"`

8552 

8553 - `type: "base64"`

8554 

8555 The type of the inline skill source. Must be `base64`.

8556 

8557 - `"base64"`

8558 

8559 - `type: "inline"`

8560 

8561 Defines an inline skill for this request.

8562 

8563 - `"inline"`

8564 

8565 - `ContainerReference object { container_id, type }`

8566 

8567 - `container_id: string`

8568 

8569 The ID of the referenced container.

8570 

8571 - `type: "container_reference"`

8572 

8573 References a container created with the /v1/containers endpoint

8574 

8575 - `"container_reference"`

8576 

8577 - `Local object { type, skills }`

8578 

8579 - `type: "local"`

8580 

8581 Use a local computer environment.

8582 

8583 - `"local"`

8584 

8585 - `skills: optional array of object { description, name, path } or null`

8586 

8587 An optional list of skills.

8588 

8589 - `description: string`

8590 

8591 The description of the skill.

8592 

8593 - `name: string`

8594 

8595 The name of the skill.

8596 

8597 - `path: string`

8598 

8599 The path to the directory containing the skill.

8600 

7809 - `ImageGeneration object { type }`8601 - `ImageGeneration object { type }`

7810 8602 

7811 - `type: "image_generation"`8603 - `type: "image_generation"`

7812 8604 

7813 - `"image_generation"`8605 - `"image_generation"`

7814 8606 

8607 - `Mcp object { type }`

8608 

8609 - `type: "mcp"`

8610 

8611 - `"mcp"`

8612 

8613 - `Custom object { type }`

8614 

8615 - `type: "custom"`

8616 

8617 - `"custom"`

8618 

8619 - `Namespace object { type }`

8620 

8621 - `type: "namespace"`

8622 

8623 - `"namespace"`

8624 

8625 - `ToolSearch object { type }`

8626 

8627 - `type: "tool_search"`

8628 

8629 - `"tool_search"`

8630 

8631 - `ProgrammaticToolCalling object { type }`

8632 

8633 - `type: "programmatic_tool_calling"`

8634 

8635 - `"programmatic_tool_calling"`

8636 

8637 - `Computer object { type }`

8638 

8639 - `type: "computer"`

8640 

8641 - `"computer"`

8642 

8643 - `ApplyPatch object { type }`

8644 

8645 - `type: "apply_patch"`

8646 

8647 - `"apply_patch"`

8648 

7815 - `type: "responses"`8649 - `type: "responses"`

7816 8650 

7817 The delegation owner. Always `responses` for tasks handled by the Responses API.8651 The delegation owner. Always `responses` for tasks handled by the Responses API.

Details

185 185 

186 - `"high"`186 - `"high"`

187 187 

188 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`188 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

189 189 

190 Controls which tool the Responses backend uses when handling a task delegated by the Live model.190 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

191 191 

192 - `LiveToolChoiceEnum = "auto" or "none" or "required"`192 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

193 193 

194 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

195 

194 - `"auto"`196 - `"auto"`

195 197 

196 - `"none"`198 - `"none"`

197 199 

198 - `"required"`200 - `"required"`

199 201 

200 - `LiveFunctionToolChoiceParam object { name, type }`202 - `map[unknown]`

201 

202 - `name: string`

203 

204 - `type: "function"`

205 

206 - `"function"`

207 

208 - `LiveMCPToolChoiceParam object { name, server_label, type }`

209 

210 - `name: string`

211 

212 - `server_label: string`

213 

214 - `type: "mcp"`

215 

216 - `"mcp"`

217 203 

218 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`204 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

219 205 

220 Tools available to the Responses backend while it handles tasks delegated by the Live model.206 Tools available to the Responses backend while it handles tasks delegated by the Live model.

221 207 


267 253 

268 - `"code_interpreter"`254 - `"code_interpreter"`

269 255 

270 - `Shell object { environment, type }`256 - `Shell object { type, environment }`

271 

272 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.

273 257 

274 - `environment: map[unknown]`258 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

275 259 

276 - `type: "shell"`260 - `type: "shell"`

277 261 

278 - `"shell"`262 - `"shell"`

279 263 

264 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

265 

266 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

267 

268 - `type: "container_auto"`

269 

270 Automatically creates a container for this request

271 

272 - `"container_auto"`

273 

274 - `file_ids: optional array of string or null`

275 

276 An optional list of uploaded files to make available to your code.

277 

278 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

279 

280 The memory limit for the container.

281 

282 - `"1g"`

283 

284 - `"4g"`

285 

286 - `"16g"`

287 

288 - `"64g"`

289 

290 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

291 

292 Network access policy for the container.

293 

294 - `Disabled object { type }`

295 

296 - `type: "disabled"`

297 

298 Disable outbound network access. Always `disabled`.

299 

300 - `"disabled"`

301 

302 - `Allowlist object { allowed_domains, type }`

303 

304 - `allowed_domains: array of string`

305 

306 A list of allowed domains when type is `allowlist`.

307 

308 - `type: "allowlist"`

309 

310 Allow outbound network access only to specified domains. Always `allowlist`.

311 

312 - `"allowlist"`

313 

314 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

315 

316 An optional list of skills referenced by id or inline data.

317 

318 - `SkillReference object { skill_id, type, version }`

319 

320 - `skill_id: string`

321 

322 The ID of the referenced skill.

323 

324 - `type: "skill_reference"`

325 

326 References a skill created with the /v1/skills endpoint.

327 

328 - `"skill_reference"`

329 

330 - `version: optional string or null`

331 

332 Optional skill version. Use a positive integer or 'latest'. Omit for default.

333 

334 - `Inline object { description, name, source, type }`

335 

336 - `description: string`

337 

338 The description of the skill.

339 

340 - `name: string`

341 

342 The name of the skill.

343 

344 - `source: object { data, media_type, type }`

345 

346 Inline skill payload

347 

348 - `data: string`

349 

350 Base64-encoded skill zip bundle.

351 

352 - `media_type: "application/zip"`

353 

354 The media type of the inline skill payload. Must be `application/zip`.

355 

356 - `"application/zip"`

357 

358 - `type: "base64"`

359 

360 The type of the inline skill source. Must be `base64`.

361 

362 - `"base64"`

363 

364 - `type: "inline"`

365 

366 Defines an inline skill for this request.

367 

368 - `"inline"`

369 

370 - `ContainerReference object { container_id, type }`

371 

372 - `container_id: string`

373 

374 The ID of the referenced container.

375 

376 - `type: "container_reference"`

377 

378 References a container created with the /v1/containers endpoint

379 

380 - `"container_reference"`

381 

382 - `Local object { type, skills }`

383 

384 - `type: "local"`

385 

386 Use a local computer environment.

387 

388 - `"local"`

389 

390 - `skills: optional array of object { description, name, path } or null`

391 

392 An optional list of skills.

393 

394 - `description: string`

395 

396 The description of the skill.

397 

398 - `name: string`

399 

400 The name of the skill.

401 

402 - `path: string`

403 

404 The path to the directory containing the skill.

405 

280 - `ImageGeneration object { type }`406 - `ImageGeneration object { type }`

281 407 

282 - `type: "image_generation"`408 - `type: "image_generation"`

283 409 

284 - `"image_generation"`410 - `"image_generation"`

285 411 

412 - `Mcp object { type }`

413 

414 - `type: "mcp"`

415 

416 - `"mcp"`

417 

418 - `Custom object { type }`

419 

420 - `type: "custom"`

421 

422 - `"custom"`

423 

424 - `Namespace object { type }`

425 

426 - `type: "namespace"`

427 

428 - `"namespace"`

429 

430 - `ToolSearch object { type }`

431 

432 - `type: "tool_search"`

433 

434 - `"tool_search"`

435 

436 - `ProgrammaticToolCalling object { type }`

437 

438 - `type: "programmatic_tool_calling"`

439 

440 - `"programmatic_tool_calling"`

441 

442 - `Computer object { type }`

443 

444 - `type: "computer"`

445 

446 - `"computer"`

447 

448 - `ApplyPatch object { type }`

449 

450 - `type: "apply_patch"`

451 

452 - `"apply_patch"`

453 

286- `type: "session.update"`454- `type: "session.update"`

287 455 

288 The Live client event type. Always `session.update`.456 The Live client event type. Always `session.update`.


2606 2774 

2607 - `"grammar"`2775 - `"grammar"`

2608 2776 

2609 - `Namespace object { description, name, tools, type }`2777 - `ToolSearchOutputNamespaceTool object { description, name, tools, type }`

2610 2778 

2611 Groups function/custom tools under a shared namespace.2779 Groups function/custom tools under a shared namespace.

2612 2780 


2620 2788 

2621 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`2789 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`

2622 2790 

2623 The function/custom tools available inside this namespace.2791 The function/custom tools loaded inside this namespace.

2624 2792 

2625 - `Function object { name, type, allowed_callers, 6 more }`2793 - `Function object { name, type, allowed_callers, 6 more }`

2626 2794 

2627 - `name: string`2795 - `name: string`

2628 2796 

2797 The name of the loaded function tool.

2798 

2629 - `type: "function"`2799 - `type: "function"`

2630 2800 

2631 - `"function"`2801 - `"function"`


5107 5277 

5108 The voice used for speech generated by the Live model.5278 The voice used for speech generated by the Live model.

5109 5279 

5110 - `voice: optional string or "alloy" or "ash" or "aube" or 29 more or CustomVoice`5280 - `voice: optional string or "alloy" or "ash" or "ballad" or 28 more or CustomVoice`

5111 5281 

5112 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.5282 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

5113 5283 

5114 - `string`5284 - `string`

5115 5285 

5116 - `"alloy" or "ash" or "aube" or 29 more`5286 - `"alloy" or "ash" or "ballad" or 28 more`

5117 5287 

5118 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.5288 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

5119 5289 


5121 5291 

5122 - `"ash"`5292 - `"ash"`

5123 5293 

5124 - `"aube"`

5125 

5126 - `"ballad"`5294 - `"ballad"`

5127 5295 

5128 - `"beacon"`5296 - `"beacon"`


5319 5487 

5320 - `"high"`5488 - `"high"`

5321 5489 

5322 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`5490 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

5323 5491 

5324 Controls which tool the Responses backend uses when handling a task delegated by the Live model.5492 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

5325 5493 

5326 - `LiveToolChoiceEnum = "auto" or "none" or "required"`5494 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

5327 5495 

5496 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

5497 

5328 - `"auto"`5498 - `"auto"`

5329 5499 

5330 - `"none"`5500 - `"none"`

5331 5501 

5332 - `"required"`5502 - `"required"`

5333 5503 

5334 - `LiveFunctionToolChoiceParam object { name, type }`5504 - `map[unknown]`

5335 5505 

5336 - `name: string`5506 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

5337 

5338 - `type: "function"`

5339 

5340 - `"function"`

5341 

5342 - `LiveMCPToolChoiceParam object { name, server_label, type }`

5343 

5344 - `name: string`

5345 

5346 - `server_label: string`

5347 

5348 - `type: "mcp"`

5349 

5350 - `"mcp"`

5351 

5352 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`

5353 5507 

5354 Tools available to the Responses backend while it handles tasks delegated by the Live model.5508 Tools available to the Responses backend while it handles tasks delegated by the Live model.

5355 5509 


5401 5555 

5402 - `"code_interpreter"`5556 - `"code_interpreter"`

5403 5557 

5404 - `Shell object { environment, type }`5558 - `Shell object { type, environment }`

5405 

5406 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.

5407 5559 

5408 - `environment: map[unknown]`5560 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

5409 5561 

5410 - `type: "shell"`5562 - `type: "shell"`

5411 5563 

5412 - `"shell"`5564 - `"shell"`

5413 5565 

5414 - `ImageGeneration object { type }`5566 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

5415 5567 

5416 - `type: "image_generation"`5568 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

5417 5569 

5418 - `"image_generation"`5570 - `type: "container_auto"`

5419 5571 

5420 - `type: "responses"`5572 Automatically creates a container for this request

5421 5573 

5422 The delegation owner. Always `responses` for tasks handled by the Responses API.5574 - `"container_auto"`

5423 5575 

5424 - `"responses"`5576 - `file_ids: optional array of string or null`

5425 5577 

5426 - `input: optional array of InitialItem`5578 An optional list of uploaded files to make available to your code.

5427 5579 

5428 Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total.5580 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

5429 5581 

5430 - `Developer object { content, role, id, 2 more }`5582 The memory limit for the container.

5431 5583 

5432 A developer message included in the initial text history of a Live session.5584 - `"1g"`

5433 5585 

5434 - `content: array of object { text, type }`5586 - `"4g"`

5435 5587 

5436 The message content. Supply exactly one text part for the initial Live conversation history.5588 - `"16g"`

5437 5589 

5438 - `text: string`5590 - `"64g"`

5439 5591 

5440 The message text to include in the Live session’s initial conversation history.5592 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

5441 5593 

5442 - `type: optional "input_text"`5594 Network access policy for the container.

5443 5595 

5444 The text content type. Always `input_text`.5596 - `Disabled object { type }`

5445 5597 

5446 - `"input_text"`5598 - `type: "disabled"`

5447 5599 

5448 - `role: "developer"`5600 Disable outbound network access. Always `disabled`.

5449 5601 

5450 The author of this history message. Always `developer`.5602 - `"disabled"`

5451 5603 

5452 - `"developer"`5604 - `Allowlist object { allowed_domains, type }`

5453 5605 

5454 - `id: optional string or null`5606 - `allowed_domains: array of string`

5455 5607 

5456 An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation.5608 A list of allowed domains when type is `allowlist`.

5457 5609 

5458 - `status: optional "incomplete" or "completed" or null`5610 - `type: "allowlist"`

5459 5611 

5460 The supplied message’s status. Live uses its text as history and does not resume an incomplete message.5612 Allow outbound network access only to specified domains. Always `allowlist`.

5461 5613 

5462 - `"incomplete"`5614 - `"allowlist"`

5463 5615 

5464 - `"completed"`5616 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

5465 5617 

5466 - `type: optional "message"`5618 An optional list of skills referenced by id or inline data.

5619 

5620 - `SkillReference object { skill_id, type, version }`

5621 

5622 - `skill_id: string`

5623 

5624 The ID of the referenced skill.

5625 

5626 - `type: "skill_reference"`

5627 

5628 References a skill created with the /v1/skills endpoint.

5629 

5630 - `"skill_reference"`

5631 

5632 - `version: optional string or null`

5633 

5634 Optional skill version. Use a positive integer or 'latest'. Omit for default.

5635 

5636 - `Inline object { description, name, source, type }`

5637 

5638 - `description: string`

5639 

5640 The description of the skill.

5641 

5642 - `name: string`

5643 

5644 The name of the skill.

5645 

5646 - `source: object { data, media_type, type }`

5647 

5648 Inline skill payload

5649 

5650 - `data: string`

5651 

5652 Base64-encoded skill zip bundle.

5653 

5654 - `media_type: "application/zip"`

5655 

5656 The media type of the inline skill payload. Must be `application/zip`.

5657 

5658 - `"application/zip"`

5659 

5660 - `type: "base64"`

5661 

5662 The type of the inline skill source. Must be `base64`.

5663 

5664 - `"base64"`

5665 

5666 - `type: "inline"`

5667 

5668 Defines an inline skill for this request.

5669 

5670 - `"inline"`

5671 

5672 - `ContainerReference object { container_id, type }`

5673 

5674 - `container_id: string`

5675 

5676 The ID of the referenced container.

5677 

5678 - `type: "container_reference"`

5679 

5680 References a container created with the /v1/containers endpoint

5681 

5682 - `"container_reference"`

5683 

5684 - `Local object { type, skills }`

5685 

5686 - `type: "local"`

5687 

5688 Use a local computer environment.

5689 

5690 - `"local"`

5691 

5692 - `skills: optional array of object { description, name, path } or null`

5693 

5694 An optional list of skills.

5695 

5696 - `description: string`

5697 

5698 The description of the skill.

5699 

5700 - `name: string`

5701 

5702 The name of the skill.

5703 

5704 - `path: string`

5705 

5706 The path to the directory containing the skill.

5707 

5708 - `ImageGeneration object { type }`

5709 

5710 - `type: "image_generation"`

5711 

5712 - `"image_generation"`

5713 

5714 - `Mcp object { type }`

5715 

5716 - `type: "mcp"`

5717 

5718 - `"mcp"`

5719 

5720 - `Custom object { type }`

5721 

5722 - `type: "custom"`

5723 

5724 - `"custom"`

5725 

5726 - `Namespace object { type }`

5727 

5728 - `type: "namespace"`

5729 

5730 - `"namespace"`

5731 

5732 - `ToolSearch object { type }`

5733 

5734 - `type: "tool_search"`

5735 

5736 - `"tool_search"`

5737 

5738 - `ProgrammaticToolCalling object { type }`

5739 

5740 - `type: "programmatic_tool_calling"`

5741 

5742 - `"programmatic_tool_calling"`

5743 

5744 - `Computer object { type }`

5745 

5746 - `type: "computer"`

5747 

5748 - `"computer"`

5749 

5750 - `ApplyPatch object { type }`

5751 

5752 - `type: "apply_patch"`

5753 

5754 - `"apply_patch"`

5755 

5756 - `type: "responses"`

5757 

5758 The delegation owner. Always `responses` for tasks handled by the Responses API.

5759 

5760 - `"responses"`

5761 

5762 - `input: optional array of InitialItem`

5763 

5764 Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total.

5765 

5766 - `Developer object { content, role, id, 2 more }`

5767 

5768 A developer message included in the initial text history of a Live session.

5769 

5770 - `content: array of object { text, type }`

5771 

5772 The message content. Supply exactly one text part for the initial Live conversation history.

5773 

5774 - `text: string`

5775 

5776 The message text to include in the Live session’s initial conversation history.

5777 

5778 - `type: optional "input_text"`

5779 

5780 The text content type. Always `input_text`.

5781 

5782 - `"input_text"`

5783 

5784 - `role: "developer"`

5785 

5786 The author of this history message. Always `developer`.

5787 

5788 - `"developer"`

5789 

5790 - `id: optional string or null`

5791 

5792 An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation.

5793 

5794 - `status: optional "incomplete" or "completed" or null`

5795 

5796 The supplied message’s status. Live uses its text as history and does not resume an incomplete message.

5797 

5798 - `"incomplete"`

5799 

5800 - `"completed"`

5801 

5802 - `type: optional "message"`

5467 5803 

5468 The history item type. Always `message`.5804 The history item type. Always `message`.

5469 5805 


5721 6057 

5722 The voice used for speech generated by the Live model.6058 The voice used for speech generated by the Live model.

5723 6059 

5724 - `voice: optional string or "alloy" or "ash" or "aube" or 29 more or CustomVoice`6060 - `voice: optional string or "alloy" or "ash" or "ballad" or 28 more or CustomVoice`

5725 6061 

5726 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.6062 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

5727 6063 

5728 - `string`6064 - `string`

5729 6065 

5730 - `"alloy" or "ash" or "aube" or 29 more`6066 - `"alloy" or "ash" or "ballad" or 28 more`

5731 6067 

5732 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.6068 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

5733 6069 


5735 6071 

5736 - `"ash"`6072 - `"ash"`

5737 6073 

5738 - `"aube"`

5739 

5740 - `"ballad"`6074 - `"ballad"`

5741 6075 

5742 - `"beacon"`6076 - `"beacon"`


5933 6267 

5934 - `"high"`6268 - `"high"`

5935 6269 

5936 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`6270 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

5937 6271 

5938 Controls which tool the Responses backend uses when handling a task delegated by the Live model.6272 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

5939 6273 

5940 - `LiveToolChoiceEnum = "auto" or "none" or "required"`6274 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

5941 6275 

6276 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

6277 

5942 - `"auto"`6278 - `"auto"`

5943 6279 

5944 - `"none"`6280 - `"none"`

5945 6281 

5946 - `"required"`6282 - `"required"`

5947 6283 

5948 - `LiveFunctionToolChoiceParam object { name, type }`6284 - `map[unknown]`

6285 

6286 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

6287 

6288 Tools available to the Responses backend while it handles tasks delegated by the Live model.

6289 

6290 - `FunctionTool object { name, type, description, 2 more }`

6291 

6292 A function tool available to the Responses backend when the Live model delegates a task.

5949 6293 

5950 - `name: string`6294 - `name: string`

5951 6295 

6296 The name the delegated Responses model uses when calling this function.

6297 

5952 - `type: "function"`6298 - `type: "function"`

5953 6299 

5954 - `"function"`6300 The tool type. Always `function`.

6301 

6302 - `"function"`

6303 

6304 - `description: optional string or null`

6305 

6306 What the function does and when the delegated Responses model should call it.

6307 

6308 - `parameters: optional map[unknown] or null`

6309 

6310 A JSON Schema object describing the arguments accepted by the function.

6311 

6312 - `strict: optional boolean or null`

6313 

6314 Whether the delegated Responses model must follow the function’s parameter schema exactly.

6315 

6316 - `WebSearch object { type }`

6317 

6318 A web search tool available to the Live session’s Responses backend.

6319 

6320 - `type: "web_search"`

6321 

6322 The tool type. Always `web_search`.

6323 

6324 - `"web_search"`

6325 

6326 - `FileSearch object { type }`

6327 

6328 - `type: "file_search"`

6329 

6330 - `"file_search"`

6331 

6332 - `CodeInterpreter object { type }`

6333 

6334 - `type: "code_interpreter"`

6335 

6336 - `"code_interpreter"`

6337 

6338 - `Shell object { type, environment }`

6339 

6340 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

6341 

6342 - `type: "shell"`

6343 

6344 - `"shell"`

6345 

6346 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

6347 

6348 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

6349 

6350 - `type: "container_auto"`

6351 

6352 Automatically creates a container for this request

6353 

6354 - `"container_auto"`

6355 

6356 - `file_ids: optional array of string or null`

6357 

6358 An optional list of uploaded files to make available to your code.

6359 

6360 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

6361 

6362 The memory limit for the container.

6363 

6364 - `"1g"`

6365 

6366 - `"4g"`

6367 

6368 - `"16g"`

6369 

6370 - `"64g"`

6371 

6372 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

6373 

6374 Network access policy for the container.

6375 

6376 - `Disabled object { type }`

6377 

6378 - `type: "disabled"`

6379 

6380 Disable outbound network access. Always `disabled`.

6381 

6382 - `"disabled"`

6383 

6384 - `Allowlist object { allowed_domains, type }`

6385 

6386 - `allowed_domains: array of string`

6387 

6388 A list of allowed domains when type is `allowlist`.

6389 

6390 - `type: "allowlist"`

6391 

6392 Allow outbound network access only to specified domains. Always `allowlist`.

6393 

6394 - `"allowlist"`

6395 

6396 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

6397 

6398 An optional list of skills referenced by id or inline data.

6399 

6400 - `SkillReference object { skill_id, type, version }`

6401 

6402 - `skill_id: string`

6403 

6404 The ID of the referenced skill.

6405 

6406 - `type: "skill_reference"`

6407 

6408 References a skill created with the /v1/skills endpoint.

6409 

6410 - `"skill_reference"`

6411 

6412 - `version: optional string or null`

6413 

6414 Optional skill version. Use a positive integer or 'latest'. Omit for default.

6415 

6416 - `Inline object { description, name, source, type }`

6417 

6418 - `description: string`

6419 

6420 The description of the skill.

6421 

6422 - `name: string`

6423 

6424 The name of the skill.

6425 

6426 - `source: object { data, media_type, type }`

6427 

6428 Inline skill payload

6429 

6430 - `data: string`

6431 

6432 Base64-encoded skill zip bundle.

6433 

6434 - `media_type: "application/zip"`

6435 

6436 The media type of the inline skill payload. Must be `application/zip`.

6437 

6438 - `"application/zip"`

6439 

6440 - `type: "base64"`

6441 

6442 The type of the inline skill source. Must be `base64`.

6443 

6444 - `"base64"`

6445 

6446 - `type: "inline"`

6447 

6448 Defines an inline skill for this request.

6449 

6450 - `"inline"`

6451 

6452 - `ContainerReference object { container_id, type }`

6453 

6454 - `container_id: string`

6455 

6456 The ID of the referenced container.

5955 6457 

5956 - `LiveMCPToolChoiceParam object { name, server_label, type }`6458 - `type: "container_reference"`

5957 6459 

5958 - `name: string`6460 References a container created with the /v1/containers endpoint

5959 6461 

5960 - `server_label: string`6462 - `"container_reference"`

5961 6463 

5962 - `type: "mcp"`6464 - `Local object { type, skills }`

5963 6465 

5964 - `"mcp"`6466 - `type: "local"`

5965 6467 

5966 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`6468 Use a local computer environment.

5967 6469 

5968 Tools available to the Responses backend while it handles tasks delegated by the Live model.6470 - `"local"`

5969 6471 

5970 - `FunctionTool object { name, type, description, 2 more }`6472 - `skills: optional array of object { description, name, path } or null`

5971 6473 

5972 A function tool available to the Responses backend when the Live model delegates a task.6474 An optional list of skills.

5973 6475 

5974 - `name: string`6476 - `description: string`

5975 6477 

5976 The name the delegated Responses model uses when calling this function.6478 The description of the skill.

5977 6479 

5978 - `type: "function"`6480 - `name: string`

5979 6481 

5980 The tool type. Always `function`.6482 The name of the skill.

5981 6483 

5982 - `"function"`6484 - `path: string`

5983 6485 

5984 - `description: optional string or null`6486 The path to the directory containing the skill.

5985 6487 

5986 What the function does and when the delegated Responses model should call it.6488 - `ImageGeneration object { type }`

5987 6489 

5988 - `parameters: optional map[unknown] or null`6490 - `type: "image_generation"`

5989 6491 

5990 A JSON Schema object describing the arguments accepted by the function.6492 - `"image_generation"`

5991 6493 

5992 - `strict: optional boolean or null`6494 - `Mcp object { type }`

5993 6495 

5994 Whether the delegated Responses model must follow the function’s parameter schema exactly.6496 - `type: "mcp"`

5995 6497 

5996 - `WebSearch object { type }`6498 - `"mcp"`

5997 6499 

5998 A web search tool available to the Live session’s Responses backend.6500 - `Custom object { type }`

5999 6501 

6000 - `type: "web_search"`6502 - `type: "custom"`

6001 6503 

6002 The tool type. Always `web_search`.6504 - `"custom"`

6003 6505 

6004 - `"web_search"`6506 - `Namespace object { type }`

6005 6507 

6006 - `FileSearch object { type }`6508 - `type: "namespace"`

6007 6509 

6008 - `type: "file_search"`6510 - `"namespace"`

6009 6511 

6010 - `"file_search"`6512 - `ToolSearch object { type }`

6011 6513 

6012 - `CodeInterpreter object { type }`6514 - `type: "tool_search"`

6013 6515 

6014 - `type: "code_interpreter"`6516 - `"tool_search"`

6015 6517 

6016 - `"code_interpreter"`6518 - `ProgrammaticToolCalling object { type }`

6017 6519 

6018 - `Shell object { environment, type }`6520 - `type: "programmatic_tool_calling"`

6019 6521 

6020 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.6522 - `"programmatic_tool_calling"`

6021 6523 

6022 - `environment: map[unknown]`6524 - `Computer object { type }`

6023 6525 

6024 - `type: "shell"`6526 - `type: "computer"`

6025 6527 

6026 - `"shell"`6528 - `"computer"`

6027 6529 

6028 - `ImageGeneration object { type }`6530 - `ApplyPatch object { type }`

6029 6531 

6030 - `type: "image_generation"`6532 - `type: "apply_patch"`

6031 6533 

6032 - `"image_generation"`6534 - `"apply_patch"`

6033 6535 

6034 - `type: "responses"`6536 - `type: "responses"`

6035 6537 


6873 7375 

6874 The voice used for speech generated by the Live model.7376 The voice used for speech generated by the Live model.

6875 7377 

6876 - `voice: optional string or "alloy" or "ash" or "aube" or 29 more or CustomVoice`7378 - `voice: optional string or "alloy" or "ash" or "ballad" or 28 more or CustomVoice`

6877 7379 

6878 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.7380 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

6879 7381 

6880 - `string`7382 - `string`

6881 7383 

6882 - `"alloy" or "ash" or "aube" or 29 more`7384 - `"alloy" or "ash" or "ballad" or 28 more`

6883 7385 

6884 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.7386 The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup.

6885 7387 


6887 7389 

6888 - `"ash"`7390 - `"ash"`

6889 7391 

6890 - `"aube"`

6891 

6892 - `"ballad"`7392 - `"ballad"`

6893 7393 

6894 - `"beacon"`7394 - `"beacon"`


7085 7585 

7086 - `"high"`7586 - `"high"`

7087 7587 

7088 - `tool_choice: optional "auto" or "none" or "required" or object { name, type } or object { name, server_label, type }`7588 - `tool_choice: optional "auto" or "none" or "required" or map[unknown]`

7089 7589 

7090 Controls which tool the Responses backend uses when handling a task delegated by the Live model.7590 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

7091 7591 

7092 - `LiveToolChoiceEnum = "auto" or "none" or "required"`7592 - `LiveToolChoiceEnum = "auto" or "none" or "required"`

7093 7593 

7594 Controls which tool the Responses backend uses when handling a task delegated by the Live model.

7595 

7094 - `"auto"`7596 - `"auto"`

7095 7597 

7096 - `"none"`7598 - `"none"`

7097 7599 

7098 - `"required"`7600 - `"required"`

7099 7601 

7100 - `LiveFunctionToolChoiceParam object { name, type }`7602 - `map[unknown]`

7101 

7102 - `name: string`

7103 

7104 - `type: "function"`

7105 

7106 - `"function"`

7107 

7108 - `LiveMCPToolChoiceParam object { name, server_label, type }`

7109 

7110 - `name: string`

7111 

7112 - `server_label: string`

7113 

7114 - `type: "mcp"`

7115 

7116 - `"mcp"`

7117 7603 

7118 - `tools: optional array of FunctionTool or object { type } or object { type } or 3 more`7604 - `tools: optional array of FunctionTool or object { type } or object { type } or 10 more`

7119 7605 

7120 Tools available to the Responses backend while it handles tasks delegated by the Live model.7606 Tools available to the Responses backend while it handles tasks delegated by the Live model.

7121 7607 


7167 7653 

7168 - `"code_interpreter"`7654 - `"code_interpreter"`

7169 7655 

7170 - `Shell object { environment, type }`7656 - `Shell object { type, environment }`

7171 

7172 A Responses shell tool with a container_auto or container_reference environment. Local execution and domain secrets are not supported.

7173 7657 

7174 - `environment: map[unknown]`7658 A Responses shell tool. Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported.

7175 7659 

7176 - `type: "shell"`7660 - `type: "shell"`

7177 7661 

7178 - `"shell"`7662 - `"shell"`

7179 7663 

7664 - `environment: optional object { type, file_ids, memory_limit, 2 more } or object { container_id, type } or object { type, skills } or null`

7665 

7666 - `ContainerAuto object { type, file_ids, memory_limit, 2 more }`

7667 

7668 - `type: "container_auto"`

7669 

7670 Automatically creates a container for this request

7671 

7672 - `"container_auto"`

7673 

7674 - `file_ids: optional array of string or null`

7675 

7676 An optional list of uploaded files to make available to your code.

7677 

7678 - `memory_limit: optional "1g" or "4g" or "16g" or "64g" or null`

7679 

7680 The memory limit for the container.

7681 

7682 - `"1g"`

7683 

7684 - `"4g"`

7685 

7686 - `"16g"`

7687 

7688 - `"64g"`

7689 

7690 - `network_policy: optional object { type } or object { allowed_domains, type } or null`

7691 

7692 Network access policy for the container.

7693 

7694 - `Disabled object { type }`

7695 

7696 - `type: "disabled"`

7697 

7698 Disable outbound network access. Always `disabled`.

7699 

7700 - `"disabled"`

7701 

7702 - `Allowlist object { allowed_domains, type }`

7703 

7704 - `allowed_domains: array of string`

7705 

7706 A list of allowed domains when type is `allowlist`.

7707 

7708 - `type: "allowlist"`

7709 

7710 Allow outbound network access only to specified domains. Always `allowlist`.

7711 

7712 - `"allowlist"`

7713 

7714 - `skills: optional array of object { skill_id, type, version } or object { description, name, source, type } or null`

7715 

7716 An optional list of skills referenced by id or inline data.

7717 

7718 - `SkillReference object { skill_id, type, version }`

7719 

7720 - `skill_id: string`

7721 

7722 The ID of the referenced skill.

7723 

7724 - `type: "skill_reference"`

7725 

7726 References a skill created with the /v1/skills endpoint.

7727 

7728 - `"skill_reference"`

7729 

7730 - `version: optional string or null`

7731 

7732 Optional skill version. Use a positive integer or 'latest'. Omit for default.

7733 

7734 - `Inline object { description, name, source, type }`

7735 

7736 - `description: string`

7737 

7738 The description of the skill.

7739 

7740 - `name: string`

7741 

7742 The name of the skill.

7743 

7744 - `source: object { data, media_type, type }`

7745 

7746 Inline skill payload

7747 

7748 - `data: string`

7749 

7750 Base64-encoded skill zip bundle.

7751 

7752 - `media_type: "application/zip"`

7753 

7754 The media type of the inline skill payload. Must be `application/zip`.

7755 

7756 - `"application/zip"`

7757 

7758 - `type: "base64"`

7759 

7760 The type of the inline skill source. Must be `base64`.

7761 

7762 - `"base64"`

7763 

7764 - `type: "inline"`

7765 

7766 Defines an inline skill for this request.

7767 

7768 - `"inline"`

7769 

7770 - `ContainerReference object { container_id, type }`

7771 

7772 - `container_id: string`

7773 

7774 The ID of the referenced container.

7775 

7776 - `type: "container_reference"`

7777 

7778 References a container created with the /v1/containers endpoint

7779 

7780 - `"container_reference"`

7781 

7782 - `Local object { type, skills }`

7783 

7784 - `type: "local"`

7785 

7786 Use a local computer environment.

7787 

7788 - `"local"`

7789 

7790 - `skills: optional array of object { description, name, path } or null`

7791 

7792 An optional list of skills.

7793 

7794 - `description: string`

7795 

7796 The description of the skill.

7797 

7798 - `name: string`

7799 

7800 The name of the skill.

7801 

7802 - `path: string`

7803 

7804 The path to the directory containing the skill.

7805 

7180 - `ImageGeneration object { type }`7806 - `ImageGeneration object { type }`

7181 7807 

7182 - `type: "image_generation"`7808 - `type: "image_generation"`

7183 7809 

7184 - `"image_generation"`7810 - `"image_generation"`

7185 7811 

7812 - `Mcp object { type }`

7813 

7814 - `type: "mcp"`

7815 

7816 - `"mcp"`

7817 

7818 - `Custom object { type }`

7819 

7820 - `type: "custom"`

7821 

7822 - `"custom"`

7823 

7824 - `Namespace object { type }`

7825 

7826 - `type: "namespace"`

7827 

7828 - `"namespace"`

7829 

7830 - `ToolSearch object { type }`

7831 

7832 - `type: "tool_search"`

7833 

7834 - `"tool_search"`

7835 

7836 - `ProgrammaticToolCalling object { type }`

7837 

7838 - `type: "programmatic_tool_calling"`

7839 

7840 - `"programmatic_tool_calling"`

7841 

7842 - `Computer object { type }`

7843 

7844 - `type: "computer"`

7845 

7846 - `"computer"`

7847 

7848 - `ApplyPatch object { type }`

7849 

7850 - `type: "apply_patch"`

7851 

7852 - `"apply_patch"`

7853 

7186 - `type: "responses"`7854 - `type: "responses"`

7187 7855 

7188 The delegation owner. Always `responses` for tasks handled by the Responses API.7856 The delegation owner. Always `responses` for tasks handled by the Responses API.

Details

90 90 

91 A human-readable description of the error.91 A human-readable description of the error.

92 92 

93 - `misalignment: optional object { detailed_explanation, error_type, steer }`93 - `misalignment: optional object { detailed_explanation, error_type, review_target, steer }`

94 94 

95 - `detailed_explanation: optional string`95 - `detailed_explanation: optional string`

96 96 


114 114 

115 - `"other"`115 - `"other"`

116 116 

117 - `review_target: optional string or null`

118 

119 An opaque target for explicitly continuing this review, or null when unavailable.

120 

117 - `steer: optional object { message }`121 - `steer: optional object { message }`

118 122 

119 An optional public continuation instruction.123 An optional public continuation instruction.


2265 2269 

2266 - `"grammar"`2270 - `"grammar"`

2267 2271 

2268 - `Namespace object { description, name, tools, type }`2272 - `ToolSearchOutputNamespaceTool object { description, name, tools, type }`

2269 2273 

2270 Groups function/custom tools under a shared namespace.2274 Groups function/custom tools under a shared namespace.

2271 2275 


2279 2283 

2280 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`2284 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`

2281 2285 

2282 The function/custom tools available inside this namespace.2286 The function/custom tools loaded inside this namespace.

2283 2287 

2284 - `Function object { name, type, allowed_callers, 6 more }`2288 - `Function object { name, type, allowed_callers, 6 more }`

2285 2289 

2286 - `name: string`2290 - `name: string`

2287 2291 

2292 The name of the loaded function tool.

2293 

2288 - `type: "function"`2294 - `type: "function"`

2289 2295 

2290 - `"function"`2296 - `"function"`


9469 - `safety_identifier: optional string or null`9475 - `safety_identifier: optional string or null`

9470 9476 

9471 A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.9477 A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.

9472 The IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).9478 The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

9473 9479 

9474 - `service_tier: optional ServiceTier or null`9480 - `service_tier: optional ServiceTier or null`

9475 9481 

Details

2356 2356 

2357 - `"grammar"`2357 - `"grammar"`

2358 2358 

2359 - `Namespace object { description, name, tools, type }`2359 - `ToolSearchOutputNamespaceTool object { description, name, tools, type }`

2360 2360 

2361 Groups function/custom tools under a shared namespace.2361 Groups function/custom tools under a shared namespace.

2362 2362 


2370 2370 

2371 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`2371 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`

2372 2372 

2373 The function/custom tools available inside this namespace.2373 The function/custom tools loaded inside this namespace.

2374 2374 

2375 - `Function object { name, type, allowed_callers, 6 more }`2375 - `Function object { name, type, allowed_callers, 6 more }`

2376 2376 

2377 - `name: string`2377 - `name: string`

2378 2378 

2379 The name of the loaded function tool.

2380 

2379 - `type: "function"`2381 - `type: "function"`

2380 2382 

2381 - `"function"`2383 - `"function"`

Details

2218 2218 

2219 - `"grammar"`2219 - `"grammar"`

2220 2220 

2221 - `Namespace object { description, name, tools, type }`2221 - `ToolSearchOutputNamespaceTool object { description, name, tools, type }`

2222 2222 

2223 Groups function/custom tools under a shared namespace.2223 Groups function/custom tools under a shared namespace.

2224 2224 


2232 2232 

2233 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`2233 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`

2234 2234 

2235 The function/custom tools available inside this namespace.2235 The function/custom tools loaded inside this namespace.

2236 2236 

2237 - `Function object { name, type, allowed_callers, 6 more }`2237 - `Function object { name, type, allowed_callers, 6 more }`

2238 2238 

2239 - `name: string`2239 - `name: string`

2240 2240 

2241 The name of the loaded function tool.

2242 

2241 - `type: "function"`2243 - `type: "function"`

2242 2244 

2243 - `"function"`2245 - `"function"`


4874- `safety_identifier: optional string or null`4876- `safety_identifier: optional string or null`

4875 4877 

4876 A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.4878 A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.

4877 The IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).4879 The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

4878 4880 

4879- `service_tier: optional ServiceTier or null`4881- `service_tier: optional ServiceTier or null`

4880 4882 


6200 6202 

6201 A human-readable description of the error.6203 A human-readable description of the error.

6202 6204 

6203 - `misalignment: optional object { detailed_explanation, error_type, steer }`6205 - `misalignment: optional object { detailed_explanation, error_type, review_target, steer }`

6204 6206 

6205 - `detailed_explanation: optional string`6207 - `detailed_explanation: optional string`

6206 6208 


6224 6226 

6225 - `"other"`6227 - `"other"`

6226 6228 

6229 - `review_target: optional string or null`

6230 

6231 An opaque target for explicitly continuing this review, or null when unavailable.

6232 

6227 - `steer: optional object { message }`6233 - `steer: optional object { message }`

6228 6234 

6229 An optional public continuation instruction.6235 An optional public continuation instruction.


8375 8381 

8376 - `"grammar"`8382 - `"grammar"`

8377 8383 

8378 - `Namespace object { description, name, tools, type }`8384 - `ToolSearchOutputNamespaceTool object { description, name, tools, type }`

8379 8385 

8380 Groups function/custom tools under a shared namespace.8386 Groups function/custom tools under a shared namespace.

8381 8387 


8389 8395 

8390 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`8396 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`

8391 8397 

8392 The function/custom tools available inside this namespace.8398 The function/custom tools loaded inside this namespace.

8393 8399 

8394 - `Function object { name, type, allowed_callers, 6 more }`8400 - `Function object { name, type, allowed_callers, 6 more }`

8395 8401 

8396 - `name: string`8402 - `name: string`

8397 8403 

8404 The name of the loaded function tool.

8405 

8398 - `type: "function"`8406 - `type: "function"`

8399 8407 

8400 - `"function"`8408 - `"function"`


15579 - `safety_identifier: optional string or null`15587 - `safety_identifier: optional string or null`

15580 15588 

15581 A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.15589 A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.

15582 The IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).15590 The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

15583 15591 

15584 - `service_tier: optional ServiceTier or null`15592 - `service_tier: optional ServiceTier or null`

15585 15593 

Details

134 134 

135 A human-readable description of the error.135 A human-readable description of the error.

136 136 

137 - `misalignment: optional object { detailed_explanation, error_type, steer }`137 - `misalignment: optional object { detailed_explanation, error_type, review_target, steer }`

138 138 

139 - `detailed_explanation: optional string`139 - `detailed_explanation: optional string`

140 140 


158 158 

159 - `"other"`159 - `"other"`

160 160 

161 - `review_target: optional string or null`

162 

163 An opaque target for explicitly continuing this review, or null when unavailable.

164 

161 - `steer: optional object { message }`165 - `steer: optional object { message }`

162 166 

163 An optional public continuation instruction.167 An optional public continuation instruction.


2309 2313 

2310 - `"grammar"`2314 - `"grammar"`

2311 2315 

2312 - `Namespace object { description, name, tools, type }`2316 - `ToolSearchOutputNamespaceTool object { description, name, tools, type }`

2313 2317 

2314 Groups function/custom tools under a shared namespace.2318 Groups function/custom tools under a shared namespace.

2315 2319 


2323 2327 

2324 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`2328 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`

2325 2329 

2326 The function/custom tools available inside this namespace.2330 The function/custom tools loaded inside this namespace.

2327 2331 

2328 - `Function object { name, type, allowed_callers, 6 more }`2332 - `Function object { name, type, allowed_callers, 6 more }`

2329 2333 

2330 - `name: string`2334 - `name: string`

2331 2335 

2336 The name of the loaded function tool.

2337 

2332 - `type: "function"`2338 - `type: "function"`

2333 2339 

2334 - `"function"`2340 - `"function"`


9513 - `safety_identifier: optional string or null`9519 - `safety_identifier: optional string or null`

9514 9520 

9515 A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.9521 A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.

9516 The IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).9522 The IDs should be a string that uniquely identifies each user, with a maximum length of 128 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](/api/docs/guides/safety-best-practices#implement-safety-identifiers).

9517 9523 

9518 - `service_tier: optional ServiceTier or null`9524 - `service_tier: optional ServiceTier or null`

9519 9525 

Details

2147 2147 

2148 - `"grammar"`2148 - `"grammar"`

2149 2149 

2150 - `Namespace object { description, name, tools, type }`2150 - `ToolSearchOutputNamespaceTool object { description, name, tools, type }`

2151 2151 

2152 Groups function/custom tools under a shared namespace.2152 Groups function/custom tools under a shared namespace.

2153 2153 


2161 2161 

2162 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`2162 - `tools: array of object { name, type, allowed_callers, 6 more } or object { name, type, allowed_callers, 4 more }`

2163 2163 

2164 The function/custom tools available inside this namespace.2164 The function/custom tools loaded inside this namespace.

2165 2165 

2166 - `Function object { name, type, allowed_callers, 6 more }`2166 - `Function object { name, type, allowed_callers, 6 more }`

2167 2167 

2168 - `name: string`2168 - `name: string`

2169 2169 

2170 The name of the loaded function tool.

2171 

2170 - `type: "function"`2172 - `type: "function"`

2171 2173 

2172 - `"function"`2174 - `"function"`

Details

62 62 

63 The file identifier, which can be referenced in the API endpoints.63 The file identifier, which can be referenced in the API endpoints.

64 64 

65 - `bytes: number`65 - `bytes: number or null`

66 66 

67 The size of the file, in bytes. In a completed file upload response, this can67 The size of the file, in bytes. In a completed file upload response, this can

68 be null when the file size is not yet available.68 be null when the file size is not yet available.

Details

120 120 

121 The file identifier, which can be referenced in the API endpoints.121 The file identifier, which can be referenced in the API endpoints.

122 122 

123 - `bytes: number`123 - `bytes: number or null`

124 124 

125 The size of the file, in bytes. In a completed file upload response, this can125 The size of the file, in bytes. In a completed file upload response, this can

126 be null when the file size is not yet available.126 be null when the file size is not yet available.