Create an Anthropic message
POST
https://api.respan.ai/api/anthropic/v1/messagesSend native Anthropic Messages requests through Respan using provider credentials configured in Respan. Authenticate with your Respan key in x-api-key for Anthropic SDKs or Authorization: Bearer for bearer clients.
Servers
https://api.respan.ai: Respan API Server
Authentication
Use the authentication headers documented below.
Headers
Parameter Type Required Description and constraints
x-api-key string RequiredYour Respan API key in Anthropic’s native authentication header. Bearer authentication is also accepted.
Example:
Example:
"YOUR_RESPAN_API_KEY"anthropic-version string OptionalDefault:
2023-06-01anthropic-beta string Optional-
Request body
A request body is required.
application/json
Field Type Requirement Description and constraints
$ object Required body
Additional properties are allowed
model string Required in parent-
max_tokens integer Required in parentMinimum:
1messages array<object> Required in parent
Minimum items:
1messages[] object Array itemAdditional properties are allowed
stream boolean OptionalDefault:
falserespan_params object OptionalAdditional properties are allowed
OpenAPI request schema
{
"type": "object",
"required": [
"model",
"max_tokens",
"messages"
],
"properties": {
"model": {
"type": "string"
},
"max_tokens": {
"type": "integer",
"minimum": 1
},
"messages": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": true
}
},
"stream": {
"type": "boolean",
"default": false
},
"respan_params": {
"type": "object",
"additionalProperties": true
}
},
"additionalProperties": true
}Example
{
"model": "claude-sonnet-5-5",
"max_tokens": 32,
"messages": [
{
"role": "user",
"content": "Reply with exactly ok."
}
]
}Responses
200
Anthropic response or event stream.
application/json
Field Type Requirement Description and constraints
$ object BodyAdditional properties are allowed
OpenAPI response schema
{
"type": "object",
"additionalProperties": true
}Example
{
"id": "msg_example",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-5-5",
"content": [
{
"type": "text",
"text": "ok"
}
],
"stop_reason": "end_turn",
"stop_sequence": null
}text/event-stream
Field Type Requirement Description and constraints
$ string Body-
OpenAPI response schema
{
"type": "string"
}400
Invalid request.
application/json
Field Type Requirement Description and constraints
$ object BodyAdditional properties are allowed
OpenAPI response schema
{
"type": "object",
"additionalProperties": true
}402
Insufficient credits.
application/json
Field Type Requirement Description and constraints
$ object BodyAdditional properties are allowed
OpenAPI response schema
{
"type": "object",
"additionalProperties": true
}403
The API key is missing, invalid or expired.
application/json
Field Type Requirement Description and constraints
$ object Body
-
detail string Required in parent-
OpenAPI response schema
{
"type": "object",
"required": [
"detail"
],
"properties": {
"detail": {
"type": "string"
}
}
}Example
{
"detail": "Your API key is invalid or expired, please check your API key in the platform settings."
}424
Upstream provider failed.
application/json
Field Type Requirement Description and constraints
$ object BodyAdditional properties are allowed
OpenAPI response schema
{
"type": "object",
"additionalProperties": true
}429
Rate limit exceeded.
application/json
Field Type Requirement Description and constraints
$ object BodyAdditional properties are allowed
OpenAPI response schema
{
"type": "object",
"additionalProperties": true
}OpenAPI source
The operation and referenced components below retain the complete OpenAPI definitions, including constraints and examples.
OpenAPI operation
{
"summary": "Create an Anthropic message",
"operationId": "api_anthropic_v1_messages_create",
"tags": [
"Anthropic Gateway"
],
"description": "Send native Anthropic Messages requests through Respan using provider credentials configured in Respan. Authenticate with your Respan key in `x-api-key` for Anthropic SDKs or `Authorization: Bearer` for bearer clients.",
"parameters": [
{
"name": "x-api-key",
"in": "header",
"required": true,
"schema": {
"type": "string"
},
"description": "Your Respan API key in Anthropic's native authentication header. Bearer authentication is also accepted.",
"example": "YOUR_RESPAN_API_KEY"
},
{
"name": "anthropic-version",
"in": "header",
"required": false,
"schema": {
"type": "string",
"default": "2023-06-01"
}
},
{
"name": "anthropic-beta",
"in": "header",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"model",
"max_tokens",
"messages"
],
"properties": {
"model": {
"type": "string"
},
"max_tokens": {
"type": "integer",
"minimum": 1
},
"messages": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": true
}
},
"stream": {
"type": "boolean",
"default": false
},
"respan_params": {
"type": "object",
"additionalProperties": true
}
},
"additionalProperties": true
},
"example": {
"model": "claude-sonnet-5-5",
"max_tokens": 32,
"messages": [
{
"role": "user",
"content": "Reply with exactly ok."
}
]
}
}
}
},
"responses": {
"200": {
"description": "Anthropic response or event stream.",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": true
},
"example": {
"id": "msg_example",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-5-5",
"content": [
{
"type": "text",
"text": "ok"
}
],
"stop_reason": "end_turn",
"stop_sequence": null
}
},
"text/event-stream": {
"schema": {
"type": "string"
}
}
}
},
"400": {
"description": "Invalid request.",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
},
"402": {
"description": "Insufficient credits.",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
},
"403": {
"$ref": "#/components/responses/InvalidApiKey"
},
"424": {
"description": "Upstream provider failed.",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
},
"429": {
"description": "Rate limit exceeded.",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"security": []
}OpenAPI path metadata
{}Referenced OpenAPI components
{
"responses": {
"InvalidApiKey": {
"description": "The API key is missing, invalid or expired.",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"detail"
],
"properties": {
"detail": {
"type": "string"
}
}
},
"example": {
"detail": "Your API key is invalid or expired, please check your API key in the platform settings."
}
}
}
}
}
}