> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fortytwo.network/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI compatibility

> Use the OpenAI SDKs with the Fortytwo API, and the fields that differ from the OpenAI Chat Completions API.

The Fortytwo API implements the OpenAI Chat Completions API. Point an OpenAI SDK or client at it with two settings:

| Setting | Value |
| - | - |
| Base URL | `https://api.fortytwo.network/v1` |
| API key | A Fortytwo API key — see [Get access](/docs/access) |

Clients that read environment variables can use `OPENAI_BASE_URL` and `OPENAI_API_KEY`.

The API rejects fields it does not support with `400 invalid_request`. It does not ignore them. Check that your client does not add the fields listed as not supported below.

## Endpoints

| Endpoint | Status |
| - | - |
| `POST /v1/chat/completions` | Supported |
| `GET /v1/models` | Supported. Entries have `id`, `object`, `created`, `owned_by` |
| `GET /v1/models/{id}` | Not supported (`404`) |
| Responses, Completions, Embeddings, Audio, Images, Files, Batches, Fine-tuning, Moderations, Assistants | Not supported (`404`) |

## Request fields

| Field | Status | Difference |
| - | - | - |
| `model` | Supported | A model ID from [Models](/docs/models) |
| `messages` | Supported | See [Messages](#messages) |
| `stream` | Supported | |
| `stream_options` | Partly | Only `include_usage`, and only with `stream: true` |
| `max_tokens`, `max_completion_tokens` | Supported | Send one of the two. Maximum: the model's max output |
| `reasoning_effort` | Supported | `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`. Default `medium` |
| `tools` | Partly | Function tools only, up to 128 |
| `tool_choice` | Supported | `auto`, `none`, `required` or a named function |
| `parallel_tool_calls` | Supported | |
| `response_format` | Partly | `text`, `json_object`, or `json_schema` with `strict: true` only |
| `n` | Partly | Only `1` |
| `store` | Partly | Only `false` — see [Data handling](/docs/data-handling) |
| `temperature`, `top_p`, `presence_penalty`, `stop`, `seed` | Per model | Accepted only if the model supports it; otherwise `400` — see [Models](/docs/models) |
| `frequency_penalty`, `logit_bias`, `logprobs`, `top_logprobs`, `top_a` | Not supported | `400`, whatever the value |
| `reasoning` object | Not supported | Use `reasoning_effort` |
| `user`, `metadata`, `service_tier`, `prompt_cache_key`, `safety_identifier`, `verbosity` | Not supported | `400` |
| `modalities`, `audio`, `prediction`, `web_search_options` | Not supported | `400` |
| `functions`, `function_call` (legacy) | Not supported | Use `tools` and `tool_choice` |

The API also accepts `top_k`, `min_p` and `repetition_penalty` for models that support them — see [Chat completions](/docs/chat-completions#sampling-controls).

## Messages

| Item | Status | Difference |
| - | - | - |
| Roles `developer`, `system`, `user`, `assistant`, `tool` | Supported | The legacy `function` role is not supported |
| Message fields `role`, `content`, `name`, `tool_calls`, `tool_call_id` | Supported | Any other field returns `400` |
| `reasoning`, `reasoning_details`, `refusal` in an `assistant` message | Not supported | Remove them before you send a reply back — `400` otherwise |
| Content parts `text` | Supported | |
| Content parts `image_url` | Supported | `user` messages only; PNG, JPEG, WebP — see [Image input](/docs/images) |
| Content parts `input_audio`, `file` | Not supported | `400 unsupported_content_type` |
| `cache_control` on content parts | Not supported | Caching is automatic — see [Prompt caching](/docs/data-handling#prompt-caching) |

## Response

| Item | Difference |
| - | - |
| `choices[].message.reasoning`, `reasoning_details` | Added: the model's reasoning. Billed as output |
| `usage.prompt_tokens_details.cached_tokens` | Prompt tokens served from the prompt cache |
| `model` | The model ID from the request |
| Errors | The OpenAI error envelope plus a top-level `request_id`. Codes differ — see [Errors](/docs/errors) |
| Stream errors | After a stream starts, every failure is one event with the code `upstream_error` — see [Streaming](/docs/streaming#errors-during-a-stream) |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.