Skip to main content
Sudo’s REST API closely mirrors the OpenAI Chat Completions specification.
If you already integrate with OpenAI you can usually swap the base URL, provide a Sudo API key, and you’re done.
Base URL: https://sudoapp.dev/api
Completions endpoint: /v1/chat/completions
Some third-party model providers do not support every OpenAI feature (for example tools or vision). Refer to their individual documentation when in doubt.

Requests

The request body you POST to /v1/chat/completions accepts the same fields you’re used to. Below is an example condensed TypeScript definition (non-exhaustive):
For a more exhaustive spec of supported request parameters, see the endpoints in the next section.

Headers

Only two headers are required:

Example

curl

Responses

Sudo normalises provider responses to match the OpenAI schema. A non-streaming response looks like this:
Example Response

Finish reasons

finish_reason is one of stop, length, tool_calls, content_filter, or error – mirroring OpenAI’s values.

Error handling

Errors follow the shape:
Error

Next steps

Headers & Auth

Read about authenticating requests

Streaming

See Streaming to deliver tokens to your UI in real-time.