404 lines
8.5 KiB
YAML
404 lines
8.5 KiB
YAML
# Anthropic Integration Messages API Schemas
|
|
|
|
AnthropicMessageRequest:
|
|
type: object
|
|
required:
|
|
- model
|
|
- max_tokens
|
|
- messages
|
|
properties:
|
|
model:
|
|
type: string
|
|
description: Model identifier (e.g., claude-3-opus-20240229)
|
|
example: claude-3-opus-20240229
|
|
max_tokens:
|
|
type: integer
|
|
description: Maximum tokens to generate
|
|
messages:
|
|
type: array
|
|
items:
|
|
$ref: '#/AnthropicMessage'
|
|
description: List of messages in the conversation
|
|
system:
|
|
$ref: '#/AnthropicContent'
|
|
description: System prompt
|
|
cache_control:
|
|
$ref: '../../inference/common.yaml#/CacheControl'
|
|
description: Automatic caching directives for the whole request
|
|
metadata:
|
|
$ref: '#/AnthropicMetadata'
|
|
stream:
|
|
type: boolean
|
|
description: Whether to stream the response
|
|
temperature:
|
|
type: number
|
|
minimum: 0
|
|
maximum: 1
|
|
top_p:
|
|
type: number
|
|
top_k:
|
|
type: integer
|
|
stop_sequences:
|
|
type: array
|
|
items:
|
|
type: string
|
|
tools:
|
|
type: array
|
|
items:
|
|
$ref: '#/AnthropicTool'
|
|
tool_choice:
|
|
$ref: '#/AnthropicToolChoice'
|
|
mcp_servers:
|
|
type: array
|
|
items:
|
|
$ref: '#/AnthropicMCPServer'
|
|
description: MCP servers configuration (requires beta header)
|
|
thinking:
|
|
$ref: '#/AnthropicThinking'
|
|
output_format:
|
|
type: object
|
|
description: Structured output format (requires beta header)
|
|
# Bifrost-specific
|
|
fallbacks:
|
|
type: array
|
|
items:
|
|
type: string
|
|
|
|
AnthropicMessage:
|
|
type: object
|
|
required:
|
|
- role
|
|
- content
|
|
properties:
|
|
role:
|
|
$ref: './common.yaml#/AnthropicMessageRole'
|
|
content:
|
|
$ref: '#/AnthropicContent'
|
|
|
|
AnthropicContent:
|
|
oneOf:
|
|
- type: string
|
|
- type: array
|
|
items:
|
|
$ref: '#/AnthropicContentBlock'
|
|
description: Content - can be a string or array of content blocks
|
|
|
|
AnthropicContentBlock:
|
|
type: object
|
|
required:
|
|
- type
|
|
properties:
|
|
type:
|
|
type: string
|
|
enum:
|
|
- text
|
|
- image
|
|
- document
|
|
- tool_use
|
|
- server_tool_use
|
|
- tool_result
|
|
- web_search_result
|
|
- mcp_tool_use
|
|
- mcp_tool_result
|
|
- thinking
|
|
- redacted_thinking
|
|
text:
|
|
type: string
|
|
description: For text content
|
|
thinking:
|
|
type: string
|
|
description: For thinking content
|
|
signature:
|
|
type: string
|
|
description: For signature content
|
|
data:
|
|
type: string
|
|
description: For data content (encrypted data for redacted thinking)
|
|
tool_use_id:
|
|
type: string
|
|
description: For tool_result content
|
|
id:
|
|
type: string
|
|
description: For tool_use content
|
|
name:
|
|
type: string
|
|
description: For tool_use content
|
|
input:
|
|
type: object
|
|
description: For tool_use content
|
|
server_name:
|
|
type: string
|
|
description: For mcp_tool_use content
|
|
content:
|
|
$ref: '#/AnthropicContent'
|
|
description: For tool_result content
|
|
source:
|
|
$ref: '#/AnthropicSource'
|
|
description: For image/document content
|
|
cache_control:
|
|
$ref: '../../inference/common.yaml#/CacheControl'
|
|
citations:
|
|
$ref: '#/AnthropicCitationsConfig'
|
|
description: For document content
|
|
context:
|
|
type: string
|
|
description: For document content
|
|
title:
|
|
type: string
|
|
description: For document content
|
|
|
|
AnthropicSource:
|
|
type: object
|
|
required:
|
|
- type
|
|
properties:
|
|
type:
|
|
type: string
|
|
enum: [base64, url, text, content_block]
|
|
media_type:
|
|
type: string
|
|
description: MIME type (e.g., image/jpeg, application/pdf)
|
|
data:
|
|
type: string
|
|
description: Base64-encoded data (for base64 type)
|
|
url:
|
|
type: string
|
|
description: URL (for url type)
|
|
|
|
AnthropicCitationsConfig:
|
|
type: object
|
|
properties:
|
|
enabled:
|
|
type: boolean
|
|
|
|
AnthropicMetadata:
|
|
type: object
|
|
properties:
|
|
user_id:
|
|
type: string
|
|
|
|
AnthropicThinking:
|
|
type: object
|
|
properties:
|
|
type:
|
|
type: string
|
|
enum: [enabled, disabled]
|
|
budget_tokens:
|
|
type: integer
|
|
|
|
AnthropicTool:
|
|
type: object
|
|
properties:
|
|
type:
|
|
type: string
|
|
enum:
|
|
- custom
|
|
- bash_20250124
|
|
- computer_20250124
|
|
- computer_20251124
|
|
- code_execution_20250522
|
|
- code_execution_20250825
|
|
- code_execution_20260120
|
|
- text_editor_20250124
|
|
- text_editor_20250429
|
|
- text_editor_20250728
|
|
- web_search_20250305
|
|
- web_search_20260209
|
|
- web_fetch_20250910
|
|
- web_fetch_20260209
|
|
- web_fetch_20260309
|
|
- memory_20250818
|
|
- tool_search_tool_bm25
|
|
- tool_search_tool_bm25_20251119
|
|
- tool_search_tool_regex
|
|
- tool_search_tool_regex_20251119
|
|
name:
|
|
type: string
|
|
description: Tool name (for custom tools)
|
|
description:
|
|
type: string
|
|
input_schema:
|
|
type: object
|
|
description: JSON Schema for tool input
|
|
cache_control:
|
|
$ref: '../../inference/common.yaml#/CacheControl'
|
|
# Computer use tool settings
|
|
display_width_px:
|
|
type: integer
|
|
display_height_px:
|
|
type: integer
|
|
display_number:
|
|
type: integer
|
|
enable_zoom:
|
|
type: boolean
|
|
# Web search settings
|
|
max_uses:
|
|
type: integer
|
|
allowed_domains:
|
|
type: array
|
|
items:
|
|
type: string
|
|
blocked_domains:
|
|
type: array
|
|
items:
|
|
type: string
|
|
user_location:
|
|
$ref: '#/AnthropicToolWebSearchUserLocation'
|
|
|
|
AnthropicToolWebSearchUserLocation:
|
|
type: object
|
|
properties:
|
|
type:
|
|
type: string
|
|
enum: [approximate]
|
|
city:
|
|
type: string
|
|
country:
|
|
type: string
|
|
timezone:
|
|
type: string
|
|
|
|
AnthropicToolChoice:
|
|
oneOf:
|
|
- type: object
|
|
properties:
|
|
type:
|
|
type: string
|
|
enum: [auto, any, tool, none]
|
|
name:
|
|
type: string
|
|
description: Required when type is 'tool'
|
|
disable_parallel_tool_use:
|
|
type: boolean
|
|
|
|
AnthropicMCPServer:
|
|
type: object
|
|
properties:
|
|
type:
|
|
type: string
|
|
name:
|
|
type: string
|
|
url:
|
|
type: string
|
|
authorization_token:
|
|
type: string
|
|
description: Authorization token for the MCP server
|
|
tool_configuration:
|
|
$ref: '#/AnthropicMCPToolConfig'
|
|
|
|
AnthropicMCPToolConfig:
|
|
type: object
|
|
properties:
|
|
enabled:
|
|
type: boolean
|
|
allowed_tools:
|
|
type: array
|
|
items:
|
|
type: string
|
|
|
|
# Response types
|
|
AnthropicMessageResponse:
|
|
type: object
|
|
properties:
|
|
id:
|
|
type: string
|
|
type:
|
|
type: string
|
|
default: message
|
|
role:
|
|
type: string
|
|
default: assistant
|
|
content:
|
|
type: array
|
|
items:
|
|
$ref: '#/AnthropicContentBlock'
|
|
model:
|
|
type: string
|
|
stop_reason:
|
|
type: string
|
|
enum: [end_turn, max_tokens, stop_sequence, tool_use, pause_turn, refusal, model_context_window_exceeded, null]
|
|
stop_sequence:
|
|
type: string
|
|
nullable: true
|
|
usage:
|
|
$ref: '#/AnthropicUsage'
|
|
|
|
AnthropicUsage:
|
|
type: object
|
|
properties:
|
|
input_tokens:
|
|
type: integer
|
|
output_tokens:
|
|
type: integer
|
|
cache_creation_input_tokens:
|
|
type: integer
|
|
cache_read_input_tokens:
|
|
type: integer
|
|
cache_creation:
|
|
$ref: '#/AnthropicUsageCacheCreation'
|
|
|
|
AnthropicUsageCacheCreation:
|
|
type: object
|
|
properties:
|
|
ephemeral_5m_input_tokens:
|
|
type: integer
|
|
ephemeral_1h_input_tokens:
|
|
type: integer
|
|
|
|
# Stream event types
|
|
AnthropicStreamEvent:
|
|
type: object
|
|
properties:
|
|
id:
|
|
type: string
|
|
type:
|
|
type: string
|
|
enum:
|
|
- message_start
|
|
- content_block_start
|
|
- content_block_delta
|
|
- content_block_stop
|
|
- message_delta
|
|
- message_stop
|
|
- ping
|
|
- error
|
|
message:
|
|
$ref: '#/AnthropicMessageResponse'
|
|
index:
|
|
type: integer
|
|
content_block:
|
|
$ref: '#/AnthropicContentBlock'
|
|
delta:
|
|
$ref: '#/AnthropicStreamDelta'
|
|
usage:
|
|
$ref: '#/AnthropicUsage'
|
|
error:
|
|
$ref: '#/AnthropicStreamError'
|
|
|
|
AnthropicStreamDelta:
|
|
type: object
|
|
properties:
|
|
type:
|
|
type: string
|
|
enum: [text_delta, input_json_delta, thinking_delta, signature_delta]
|
|
text:
|
|
type: string
|
|
partial_json:
|
|
type: string
|
|
thinking:
|
|
type: string
|
|
signature:
|
|
type: string
|
|
stop_reason:
|
|
type: string
|
|
stop_sequence:
|
|
type: string
|
|
|
|
AnthropicStreamError:
|
|
type: object
|
|
properties:
|
|
type:
|
|
type: string
|
|
message:
|
|
type: string
|