# Create public — POST /v1/chat/public

URL: https://docs.hanzo.ai/docs/openapi/ai/post-chat-public

> Serves one completion to a caller with no account.

`POST /v1/chat/public`

> [AI →](https://docs.hanzo.ai/docs/openapi/ai) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/chat/public`  |
| **Method**    | `POST`                                 |
| **Operation** | `post_chat_public`                     |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Serves one completion to a caller with no account.

## Request

67 fields, body `application/json` (required).

| Field                                        | In   | Type                                          | Required | Description |
| -------------------------------------------- | ---- | --------------------------------------------- | -------- | ----------- |
| `frequency_penalty`                          | body | number                                        | —        |             |
| `function_call`                              | body | any                                           | —        |             |
| `functions`                                  | body | openai.FunctionDefinition\[]                  | —        |             |
| `functions[].description`                    | body | string                                        | —        |             |
| `functions[].name`                           | body | string                                        | —        |             |
| `functions[].parameters`                     | body | any                                           | —        |             |
| `functions[].strict`                         | body | boolean                                       | —        |             |
| `logit_bias`                                 | body | object                                        | —        |             |
| `logit_bias.*`                               | body | integer                                       | —        |             |
| `logprobs`                                   | body | boolean                                       | —        |             |
| `max_completion_tokens`                      | body | integer                                       | —        |             |
| `max_tokens`                                 | body | integer                                       | —        |             |
| `messages`                                   | body | openai.ChatCompletionMessage\[]               | —        |             |
| `messages[].MultiContent`                    | body | openai.ChatMessagePart\[]                     | —        |             |
| `messages[].MultiContent[].image_url`        | body | openai.ChatMessageImageURL                    | —        |             |
| `messages[].MultiContent[].image_url.detail` | body | string                                        | —        |             |
| `messages[].MultiContent[].image_url.url`    | body | string                                        | —        |             |
| `messages[].MultiContent[].text`             | body | string                                        | —        |             |
| `messages[].MultiContent[].type`             | body | string                                        | —        |             |
| `messages[].content`                         | body | string                                        | —        |             |
| `messages[].function_call`                   | body | openai.FunctionCall                           | —        |             |
| `messages[].function_call.arguments`         | body | string                                        | —        |             |
| `messages[].function_call.name`              | body | string                                        | —        |             |
| `messages[].name`                            | body | string                                        | —        |             |
| `messages[].reasoning_content`               | body | string                                        | —        |             |
| `messages[].refusal`                         | body | string                                        | —        |             |
| `messages[].role`                            | body | string                                        | —        |             |
| `messages[].tool_call_id`                    | body | string                                        | —        |             |
| `messages[].tool_calls`                      | body | openai.ToolCall\[]                            | —        |             |
| `messages[].tool_calls[].function`           | body | openai.FunctionCall                           | —        |             |
| `messages[].tool_calls[].function.arguments` | body | string                                        | —        |             |
| `messages[].tool_calls[].function.name`      | body | string                                        | —        |             |
| `messages[].tool_calls[].id`                 | body | string                                        | —        |             |
| `messages[].tool_calls[].index`              | body | integer                                       | —        |             |
| `messages[].tool_calls[].type`               | body | string                                        | —        |             |
| `metadata`                                   | body | object                                        | —        |             |
| `metadata.*`                                 | body | string                                        | —        |             |
| `model`                                      | body | string                                        | —        |             |
| `n`                                          | body | integer                                       | —        |             |
| `parallel_tool_calls`                        | body | any                                           | —        |             |
| `presence_penalty`                           | body | number                                        | —        |             |
| `reasoning_effort`                           | body | string                                        | —        |             |
| `response_format`                            | body | openai.ChatCompletionResponseFormat           | —        |             |
| `response_format.json_schema`                | body | openai.ChatCompletionResponseFormatJSONSchema | —        |             |
| `response_format.json_schema.description`    | body | string                                        | —        |             |
| `response_format.json_schema.name`           | body | string                                        | —        |             |
| `response_format.json_schema.schema`         | body | any                                           | —        |             |
| `response_format.json_schema.strict`         | body | boolean                                       | —        |             |
| `response_format.type`                       | body | string                                        | —        |             |
| `seed`                                       | body | integer                                       | —        |             |
| `stop`                                       | body | string\[]                                     | —        |             |
| `store`                                      | body | boolean                                       | —        |             |
| `stream`                                     | body | boolean                                       | —        |             |
| `stream_options`                             | body | openai.StreamOptions                          | —        |             |
| `stream_options.include_usage`               | body | boolean                                       | —        |             |
| `temperature`                                | body | number                                        | —        |             |
| `tool_choice`                                | body | any                                           | —        |             |
| `tools`                                      | body | openai.Tool\[]                                | —        |             |
| `tools[].function`                           | body | openai.FunctionDefinition                     | —        |             |
| `tools[].function.description`               | body | string                                        | —        |             |
| `tools[].function.name`                      | body | string                                        | —        |             |
| `tools[].function.parameters`                | body | any                                           | —        |             |
| `tools[].function.strict`                    | body | boolean                                       | —        |             |
| `tools[].type`                               | body | string                                        | —        |             |
| `top_logprobs`                               | body | integer                                       | —        |             |
| `top_p`                                      | body | number                                        | —        |             |
| `user`                                       | body | string                                        | —        |             |

## Response

| Status | Body                          | Meaning                                             |
| ------ | ----------------------------- | --------------------------------------------------- |
| `200`  | openai.ChatCompletionResponse | Success.                                            |
| `401`  | —                             | No credential, or one this service does not accept. |
| `403`  | —                             | A valid credential that may not do this.            |

`200` body — 90 fields.

| Field                                                               | In   | Type                           | Always | Description |
| ------------------------------------------------------------------- | ---- | ------------------------------ | ------ | ----------- |
| `choices`                                                           | body | openai.ChatCompletionChoice\[] | —      |             |
| `choices[].content_filter_results`                                  | body | openai.ContentFilterResults    | —      |             |
| `choices[].content_filter_results.hate`                             | body | openai.Hate                    | —      |             |
| `choices[].content_filter_results.hate.filtered`                    | body | boolean                        | —      |             |
| `choices[].content_filter_results.hate.severity`                    | body | string                         | —      |             |
| `choices[].content_filter_results.jailbreak`                        | body | openai.JailBreak               | —      |             |
| `choices[].content_filter_results.jailbreak.detected`               | body | boolean                        | —      |             |
| `choices[].content_filter_results.jailbreak.filtered`               | body | boolean                        | —      |             |
| `choices[].content_filter_results.profanity`                        | body | openai.Profanity               | —      |             |
| `choices[].content_filter_results.profanity.detected`               | body | boolean                        | —      |             |
| `choices[].content_filter_results.profanity.filtered`               | body | boolean                        | —      |             |
| `choices[].content_filter_results.self_harm`                        | body | openai.SelfHarm                | —      |             |
| `choices[].content_filter_results.self_harm.filtered`               | body | boolean                        | —      |             |
| `choices[].content_filter_results.self_harm.severity`               | body | string                         | —      |             |
| `choices[].content_filter_results.sexual`                           | body | openai.Sexual                  | —      |             |
| `choices[].content_filter_results.sexual.filtered`                  | body | boolean                        | —      |             |
| `choices[].content_filter_results.sexual.severity`                  | body | string                         | —      |             |
| `choices[].content_filter_results.violence`                         | body | openai.Violence                | —      |             |
| `choices[].content_filter_results.violence.filtered`                | body | boolean                        | —      |             |
| `choices[].content_filter_results.violence.severity`                | body | string                         | —      |             |
| `choices[].finish_reason`                                           | body | string                         | —      |             |
| `choices[].index`                                                   | body | integer                        | —      |             |
| `choices[].logprobs`                                                | body | openai.LogProbs                | —      |             |
| `choices[].logprobs.content`                                        | body | openai.LogProb\[]              | —      |             |
| `choices[].logprobs.content[].bytes`                                | body | string (byte)                  | —      |             |
| `choices[].logprobs.content[].logprob`                              | body | number                         | —      |             |
| `choices[].logprobs.content[].token`                                | body | string                         | —      |             |
| `choices[].logprobs.content[].top_logprobs`                         | body | openai.TopLogProbs\[]          | —      |             |
| `choices[].logprobs.content[].top_logprobs[].bytes`                 | body | string (byte)                  | —      |             |
| `choices[].logprobs.content[].top_logprobs[].logprob`               | body | number                         | —      |             |
| `choices[].logprobs.content[].top_logprobs[].token`                 | body | string                         | —      |             |
| `choices[].message`                                                 | body | openai.ChatCompletionMessage   | —      |             |
| `choices[].message.MultiContent`                                    | body | openai.ChatMessagePart\[]      | —      |             |
| `choices[].message.MultiContent[].image_url`                        | body | openai.ChatMessageImageURL     | —      |             |
| `choices[].message.MultiContent[].image_url.detail`                 | body | string                         | —      |             |
| `choices[].message.MultiContent[].image_url.url`                    | body | string                         | —      |             |
| `choices[].message.MultiContent[].text`                             | body | string                         | —      |             |
| `choices[].message.MultiContent[].type`                             | body | string                         | —      |             |
| `choices[].message.content`                                         | body | string                         | —      |             |
| `choices[].message.function_call`                                   | body | openai.FunctionCall            | —      |             |
| `choices[].message.function_call.arguments`                         | body | string                         | —      |             |
| `choices[].message.function_call.name`                              | body | string                         | —      |             |
| `choices[].message.name`                                            | body | string                         | —      |             |
| `choices[].message.reasoning_content`                               | body | string                         | —      |             |
| `choices[].message.refusal`                                         | body | string                         | —      |             |
| `choices[].message.role`                                            | body | string                         | —      |             |
| `choices[].message.tool_call_id`                                    | body | string                         | —      |             |
| `choices[].message.tool_calls`                                      | body | openai.ToolCall\[]             | —      |             |
| `choices[].message.tool_calls[].function`                           | body | openai.FunctionCall            | —      |             |
| `choices[].message.tool_calls[].function.arguments`                 | body | string                         | —      |             |
| `choices[].message.tool_calls[].function.name`                      | body | string                         | —      |             |
| `choices[].message.tool_calls[].id`                                 | body | string                         | —      |             |
| `choices[].message.tool_calls[].index`                              | body | integer                        | —      |             |
| `choices[].message.tool_calls[].type`                               | body | string                         | —      |             |
| `created`                                                           | body | integer                        | —      |             |
| `id`                                                                | body | string                         | —      |             |
| `model`                                                             | body | string                         | —      |             |
| `object`                                                            | body | string                         | —      |             |
| `prompt_filter_results`                                             | body | openai.PromptFilterResult\[]   | —      |             |
| `prompt_filter_results[].content_filter_results`                    | body | openai.ContentFilterResults    | —      |             |
| `prompt_filter_results[].content_filter_results.hate`               | body | openai.Hate                    | —      |             |
| `prompt_filter_results[].content_filter_results.hate.filtered`      | body | boolean                        | —      |             |
| `prompt_filter_results[].content_filter_results.hate.severity`      | body | string                         | —      |             |
| `prompt_filter_results[].content_filter_results.jailbreak`          | body | openai.JailBreak               | —      |             |
| `prompt_filter_results[].content_filter_results.jailbreak.detected` | body | boolean                        | —      |             |
| `prompt_filter_results[].content_filter_results.jailbreak.filtered` | body | boolean                        | —      |             |
| `prompt_filter_results[].content_filter_results.profanity`          | body | openai.Profanity               | —      |             |
| `prompt_filter_results[].content_filter_results.profanity.detected` | body | boolean                        | —      |             |
| `prompt_filter_results[].content_filter_results.profanity.filtered` | body | boolean                        | —      |             |
| `prompt_filter_results[].content_filter_results.self_harm`          | body | openai.SelfHarm                | —      |             |
| `prompt_filter_results[].content_filter_results.self_harm.filtered` | body | boolean                        | —      |             |
| `prompt_filter_results[].content_filter_results.self_harm.severity` | body | string                         | —      |             |
| `prompt_filter_results[].content_filter_results.sexual`             | body | openai.Sexual                  | —      |             |
| `prompt_filter_results[].content_filter_results.sexual.filtered`    | body | boolean                        | —      |             |
| `prompt_filter_results[].content_filter_results.sexual.severity`    | body | string                         | —      |             |
| `prompt_filter_results[].content_filter_results.violence`           | body | openai.Violence                | —      |             |
| `prompt_filter_results[].content_filter_results.violence.filtered`  | body | boolean                        | —      |             |
| `prompt_filter_results[].content_filter_results.violence.severity`  | body | string                         | —      |             |
| `prompt_filter_results[].index`                                     | body | integer                        | —      |             |
| `system_fingerprint`                                                | body | string                         | —      |             |
| `usage`                                                             | body | openai.Usage                   | —      |             |
| `usage.completion_tokens`                                           | body | integer                        | —      |             |
| `usage.completion_tokens_details`                                   | body | openai.CompletionTokensDetails | —      |             |
| `usage.completion_tokens_details.audio_tokens`                      | body | integer                        | —      |             |
| `usage.completion_tokens_details.reasoning_tokens`                  | body | integer                        | —      |             |
| `usage.prompt_tokens`                                               | body | integer                        | —      |             |
| `usage.prompt_tokens_details`                                       | body | openai.PromptTokensDetails     | —      |             |
| `usage.prompt_tokens_details.audio_tokens`                          | body | integer                        | —      |             |
| `usage.prompt_tokens_details.cached_tokens`                         | body | integer                        | —      |             |
| `usage.total_tokens`                                                | body | integer                        | —      |             |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo chat public
```

**SDK**

**.ts**

```ts
import { Configuration, AiApi } from 'hanzoai';

const api = new AiApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postChatPublic({ frequency_penalty: 0, function_call: "<function_call>" });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AiApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AiApi(client).post_chat_public(frequency_penalty=0, function_call="<function_call>")
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.AiAPI.PostChatPublic(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, ai_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = ai_api::post_chat_public(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AiApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new AiApi(client).postChatPublic();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/chat/public \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "frequency_penalty": 0,
       "function_call": "<function_call>"
     }'
```

**MCP**

MCP declares no tool for **ai** — `tools/list` on `https://api.hanzo.ai/v1/mcp` names the products it does reach. Use HTTP or an SDK.

---

[AI API](https://docs.hanzo.ai/docs/openapi/ai) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
