---
title: "API Endpoints: Chat, Responses & Messages | Straitly Docs"
description: "Base URLs and request paths for /v1/chat/completions, /v1/responses, /v1/messages and /v1/models on Straitly's OpenAI-compatible AI gateway."
url: https://straitly.ai/docs/endpoints
updated: 2026-11-25
publisher: Straitly (https://straitly.ai)
---

Docs

Get started

# Endpoints

Copy docs

**On this page**

Choose the request format your application already uses. Straitly accepts OpenAI Chat Completions and Anthropic Messages through the same base URL and API key.

Base URL: `https://api.straitly.ai/v1`

### Authentication

Send your Straitly key in the `Authorization` header as a bearer token. The examples below read it from `STRAITLY_API_KEY` in your terminal environment. Create a key on the [API keys](https://straitly.ai/app/keys) page. Keep it on your server, not in browser code or a public repository.

export STRAITLY_API_KEY="YOUR_STRAITLY_API_KEY"

Copy Copied Failed

bash

For POST requests, send a JSON body with `Content-Type: application/json`.

### Chat completions

POST `/chat/completions`

Use this with the OpenAI SDK or a client that accepts an OpenAI-compatible base URL. Send a `model` ID and a `messages` array containing the conversation.

curl https://api.straitly.ai/v1/chat/completions \
  -H "Authorization: Bearer $STRAITLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5-5",
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'

Copy Copied Failed

bash

Read the reply from `choices[0].message.content`. Token counts are returned in `usage`. Add `"stream": true` for incremental output; see the [streaming guide](https://straitly.ai/docs/streaming) for chunk handling.

### Messages

POST `/messages`

Use this for Anthropic-format requests. Include `model`, `messages`, and `max_tokens`, the maximum number of output tokens to generate. A system prompt belongs in the top-level `system` field.

curl https://api.straitly.ai/v1/messages \
  -H "Authorization: Bearer $STRAITLY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "claude-sonnet-5-5",
    "max_tokens": 256,
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'

Copy Copied Failed

bash

The reply is an array of `content` blocks. For text blocks, read `text`; tool-use blocks have a different shape. Token counts are in `usage`.

**Using the Anthropic SDK?** Set its base URL to `https://api.straitly.ai`. The SDK adds `/v1/messages` itself. The OpenAI SDK uses the full base URL above, including `/v1`. [SDK examples](https://straitly.ai/docs/sdks)

### List models

GET `/models`

Fetch the live model list before choosing a model. This request has no body. Use an entry’s `id` from the response’s `data` array in your inference request.

curl https://api.straitly.ai/v1/models \
  -H "Authorization: Bearer $STRAITLY_API_KEY"

Copy Copied Failed

bash

Browse prices and capabilities on the [models page](https://straitly.ai/models). Support for tools, images, and [structured outputs](https://straitly.ai/docs/structured-outputs) depends on the model you choose. Before shipping to production, check the [production checklist](https://straitly.ai/docs/production) and [prompt caching guide](https://straitly.ai/docs/caching).

### Errors and next steps

- **401:** check that you supplied an active Straitly key.
- **402:** check your balance and the key’s spending cap.
- **404 model\_not\_found:** check the ID against `/models`.
- **429:** wait for the duration in `Retry-After` before retrying.

See [Errors & limits](https://straitly.ai/docs/errors) for error codes and budgets, or [Logs & exports](https://straitly.ai/docs/logs) to inspect requests and charges.

[API keys & authentication](https://straitly.ai/docs/authentication) [SDKs & frameworks](https://straitly.ai/docs/sdks)

---
Markdown version of https://straitly.ai/docs/endpoints.
