Text Generation
The gateway exposes the following public text entrypoints. Prefer POST /v1/responses for new integrations, and use the others for SDK compatibility or native Claude clients.
| Protocol | Method and path | Use |
|---|---|---|
| OpenAI | POST /v1/responses | Preferred unified text generation API for new projects |
| OpenAI | POST /v1/chat/completions | Widely compatible chat completion endpoint |
| OpenAI | POST /v1/completions | Legacy text completions, only for compatibility |
| Anthropic | POST /v1/messages | Claude native message format |
| OpenAI | GET /v1/models | List logical models available under the current routing |
OpenAI Responses
curl https://api.modelgo.ai/v1/responses \
-H "Authorization: Bearer $MODELGO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model":"<model>",
"input":"Introduce ModelGo in three sentences."
}'Use this entrypoint when you want a single OpenAI-compatible response API with a forward-looking request shape.
OpenAI Chat Completions compatibility
curl https://api.modelgo.ai/v1/chat/completions \
-H "Authorization: Bearer $MODELGO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model":"<model>",
"messages":[{"role":"user","content":"hello"}]
}'Use this for existing OpenAI SDK flows that still depend on chat completions. New projects should usually start from POST /v1/responses.
OpenAI Completions (legacy)
curl https://api.modelgo.ai/v1/completions \
-H "Authorization: Bearer $MODELGO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model":"<model>",
"prompt":"Introduce ModelGo in three sentences.",
"max_tokens":256
}'The legacy text-completions endpoint, only for call chains that still use a prompt. New projects should use Responses or Chat Completions above. stream is likewise delivered over SSE. Most current chat models do not offer this protocol: qwen3.6-flash returns HTTP 400 model_protocol_not_offered.
Anthropic Messages
curl https://api.modelgo.ai/v1/messages \
-H "x-api-key: $MODELGO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model":"<model>",
"max_tokens":1024,
"messages":[{"role":"user","content":"hello"}]
}'Use this when the client already speaks Claude's native /v1/messages schema. The gateway preserves the native event-stream framing for streamed Anthropic responses.
Listing models
curl https://api.modelgo.ai/v1/models \
-H "Authorization: Bearer $MODELGO_API_KEY"GET /v1/models returns the logical models allowed by the API key's bound policy (resolved against the platform model catalog). It does not probe upstream capabilities at request time and may differ from the console; billing and policy follow the console and bound policies.
Key conventions
modelmust be the platform logical model name.GET /v1/modelsis available; the list is derived from the API key's bound policy and the platform model catalog.- Both OpenAI and Anthropic style endpoints may return upstream-native
usage. - Stream failures may arrive as error chunks; do not rely only on
data: [DONE].
See Authentication and Errors & Rate Limits.