Skip to main content
POST
/
ai
/
chat
/
v1
/
responses
chat responses
curl --request POST \
  --url https://ai.pmock.com/api/ai/chat/v1/responses \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "gpt-5.1",
  "input": "<unknown>",
  "instructions": "<string>",
  "stream": false,
  "temperature": 123,
  "maxOutputTokens": 123,
  "topP": 123,
  "tools": [
    "<unknown>"
  ],
  "toolChoice": "<unknown>",
  "text": "<unknown>"
}
'
{}

Maven

<dependency>
    <groupId>com.openai</groupId>
    <artifactId>openai-java</artifactId>
    <version>x.x.x</version>
</dependency>

Normal Request Example

@Test
void clientOpenClientTest() {
    OpenAIClient client = OpenAIOkHttpClient.builder()
            .apiKey(apiKey) // Your access key
            .baseUrl("https://ai.pmock.com/api/ai/chat/v1")
            .build();

    ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
            .model("gpt-5.2")
            .addMessage(ChatCompletionMessageParam.ofSystem(
                    ChatCompletionSystemMessageParam.builder().content("You are a helpful assistant.").build()))
            .addMessage(ChatCompletionMessageParam.ofUser(
                    ChatCompletionUserMessageParam.builder().content("Hello!").build()))
            .build();

    ChatCompletion chatCompletion = client.chat().completions().create(params);
    System.out.println(chatCompletion.choices().get(0).message().content());
}

Stream Response

    @Test
void streamClientOpenClientTest() {
    OpenAIClient client = OpenAIOkHttpClient.builder()
            .apiKey(apiKey) // Your access key
            .baseUrl("https://ai.pmock.com/api/ai/chat/v1")
            .build();

    ChatCompletionCreateParams streamParams = ChatCompletionCreateParams.builder()
            .model("gpt-5.2")
            .addMessage(ChatCompletionMessageParam.ofSystem(
                    ChatCompletionSystemMessageParam.builder().content("You are a helpful assistant.").build()))
            .addMessage(ChatCompletionMessageParam.ofUser(
                    ChatCompletionUserMessageParam.builder().content("Hello!").build()))
            .build();

    try (StreamResponse<ChatCompletionChunk> streaming = client.chat().completions().createStreaming(streamParams)) {
        streaming.stream().forEach(chunk -> {
            if (!chunk.choices().isEmpty()) {
                String content = chunk.choices().get(0).delta().content().orElse("");
                System.out.print(content);
            }
        });
    }
}

Body

application/json
model
enum<string>
required

model

Available options:
gpt-5.1,
gpt-5.1-all,
gpt-5.1-thinking,
gpt-5.1-thinking-all,
gpt-5.2,
gemini-3-pro,
gemini-2.5-pro,
gemini-2.5-flash,
gemini-3-flash,
gemini-3.1-pro,
claude-opus-4-6,
claude-haiku-4-5-20251001,
claude-sonnet-4-6,
gpt-5.4,
gpt-5.3,
gpt-5.3-codex
input
any
required

input messages

instructions
string

instructions

stream
boolean
default:false

streaming output

temperature
number<double>

Temperature (0-2)

maxOutputTokens
integer<int32>

Maximum token count

topP
number<double>

top P

tools
any[]

Tool List (Function Calling)

toolChoice
any

Tool selection strategy

text
any

Text

Response

200 - */*

OK

The response is of type object.