GET
/v1/schemas/cohere/chat/v1%2Fchat?kind=output
Accept:
Response body
0 properties · 0 required · 0 $defsThis schema isn’t a plain object with properties — showing the raw JSON instead.
application/json
{
"provider": "cohere",
"activity": "chat",
"endpointId": "v1/chat",
"kind": "output",
"contentHash": "05da63da8aef8074b943b962720fef6c571c16b2a5c64367afa41cb575e9800d",
"specRevision": null,
"provenance": {
"sourceUrl": "https://raw.githubusercontent.com/cohere-ai/cohere-developer-experience/main/cohere-openapi.yaml",
"sourceHash": "2a018e8f34bfd1ee4203c69583349290c7eedc2f0fbfe52bc65b061a70b7dec4",
"fetchedAt": 1793770244,
"extractorVersion": "1",
"derivation": "upstream-spec",
"verifiedAt": null
},
"createdAt": 1793770244,
"supersededAt": null,
"schema": {
"oneOf": [
{
"$ref": "#/$defs/NonStreamedChatResponse"
},
{
"$ref": "#/$defs/StreamedChatResponse"
}
],
"$defs": {
"ApiMeta": {
"type": "object",
"properties": {
"api_version": {
"type": "object",
"x-fern-audiences": [
"public"
],
"properties": {
"version": {
"type": "string",
"x-fern-audiences": [
"public"
]
},
"is_deprecated": {
"type": "boolean",
"x-fern-audiences": [
"public"
]
},
"is_experimental": {
"type": "boolean",
"x-fern-audiences": [
"public"
]
}
},
"required": [
"version"
],
"x-fern-type-name": "ApiMetaApiVersion"
},
"billed_units": {
"type": "object",
"x-fern-audiences": [
"public"
],
"properties": {
"images": {
"type": "number",
"x-fern-audiences": [
"public"
],
"description": "The number of billed images.\n"
},
"input_tokens": {
"type": "number",
"x-fern-audiences": [
"public"
],
"description": "The number of billed input tokens.\n"
},
"image_tokens": {
"type": "number",
"x-fern-audiences": [
"public"
],
"description": "The number of billed image tokens.\n"
},
"text_tokens": {
"type": "number",
"x-fern-audiences": [
"public"
],
"description": "The number of billed text tokens.\n"
},
"output_tokens": {
"type": "number",
"x-fern-audiences": [
"public"
],
"description": "The number of billed output tokens.\n"
},
"search_units": {
"type": "number",
"x-fern-audiences": [
"public"
],
"description": "The number of billed search units.\n"
},
"classifications": {
"type": "number",
"x-fern-audiences": [
"public"
],
"description": "The number of billed classifications units.\n"
},
"pages": {
"type": "number",
"x-fern-audiences": [
"public"
],
"description": "The number of billed pages parsed.\n"
}
},
"x-fern-type-name": "ApiMetaBilledUnits"
},
"tokens": {
"type": "object",
"x-fern-audiences": [
"public"
],
"properties": {
"input_tokens": {
"type": "number",
"x-fern-audiences": [
"public"
],
"description": "The number of tokens used as input to the model.\n"
},
"output_tokens": {
"type": "number",
"x-fern-audiences": [
"public"
],
"description": "The number of tokens produced by the model.\n"
}
},
"x-fern-type-name": "ApiMetaTokens"
},
"cached_tokens": {
"type": "number",
"x-fern-audiences": [
"public"
],
"description": "The number of prompt tokens that hit the inference cache.\n"
},
"warnings": {
"type": "array",
"x-fern-audiences": [
"public"
],
"items": {
"type": "string",
"x-fern-audiences": [
"public"
]
}
}
},
"x-fern-type-name": "ApiMeta"
},
"ChatCitation": {
"description": "A section of the generated reply which cites external knowledge.\n",
"required": [
"start",
"end",
"text",
"document_ids"
],
"properties": {
"start": {
"description": "The index of text that the citation starts at, counting from zero. For example, a generation of `Hello, world!` with a citation on `world` would have a start value of `7`. This is because the citation starts at `w`, which is the seventh character.\n",
"type": "integer",
"x-fern-audiences": [
"public"
]
},
"end": {
"description": "The index of text that the citation ends after, counting from zero. For example, a generation of `Hello, world!` with a citation on `world` would have an end value of `11`. This is because the citation ends after `d`, which is the eleventh character.\n",
"type": "integer",
"x-fern-audiences": [
"public"
]
},
"text": {
"description": "The text of the citation. For example, a generation of `Hello, world!` with a citation of `world` would have a text value of `world`.\n",
"type": "string",
"x-fern-audiences": [
"public"
],
"minLength": 1
},
"document_ids": {
"description": "Identifiers of documents cited by this section of the generated reply.\n",
"type": "array",
"x-fern-audiences": [
"public"
],
"items": {
"type": "string",
"x-fern-audiences": [
"public"
]
},
"minItems": 1
},
"type": {
"description": "The type of citation which indicates what part of the response the citation is for.\n",
"type": "string",
"x-fern-audiences": [
"public"
],
"enum": [
"TEXT_CONTENT",
"PLAN"
]
}
},
"x-fern-type-name": "ChatCitation"
},
"ChatCitationGenerationEvent": {
"allOf": [
{
"$ref": "#/$defs/ChatStreamEvent"
},
{
"type": "object",
"required": [
"citations"
],
"properties": {
"citations": {
"description": "Citations for the generated reply.\n",
"type": "array",
"x-fern-audiences": [
"public"
],
"items": {
"$ref": "#/$defs/ChatCitation"
}
}
},
"x-fern-type-name": "ChatCitationGenerationEvent-lg3v2o"
}
],
"x-fern-type-name": "ChatCitationGenerationEvent"
},
"ChatDebugEvent": {
"allOf": [
{
"$ref": "#/$defs/ChatStreamEvent"
},
{
"type": "object",
"properties": {
"prompt": {
"type": "string",
"x-fern-audiences": [
"public"
]
}
},
"x-fern-type-name": "ChatDebugEvent-352j0t"
}
],
"x-fern-type-name": "ChatDebugEvent"
},
"ChatDocument": {
"description": "Relevant information that could be used by the model to generate a more accurate reply.\nThe contents of each document are generally short (under 300 words), and are passed in the form of a\ndictionary of strings. Some suggested keys are \"text\", \"author\", \"date\". Both the key name and the value will be\npassed to the model.\n",
"type": "object",
"properties": {
"id": {
"description": "Unique identifier for this document.",
"type": "string",
"x-fern-audiences": [
"public"
]
}
},
"additionalProperties": {
"type": "string",
"x-fern-audiences": [
"public"
]
},
"x-fern-type": "map<string, string>",
"x-fern-type-name": "ChatDocument"
},
"ChatMessage": {
"description": "Represents a single message in the chat history, excluding the current user turn. It has two properties: `role` and `message`. The `role` identifies the sender (`CHATBOT`, `SYSTEM`, or `USER`), while the `message` contains the text content.\n\nThe chat_history parameter should not be used for `SYSTEM` messages in most cases. Instead, to add a `SYSTEM` role message at the beginning of a conversation, the `preamble` parameter should be used.\n",
"required": [
"role",
"message"
],
"properties": {
"role": {
"$ref": "#/$defs/ChatRole",
"x-fern-audiences": [
"public"
]
},
"message": {
"type": "string",
"description": "Contents of the chat message.\n",
"minLength": 1,
"x-fern-audiences": [
"public"
]
},
"tool_calls": {
"x-fern-audiences": [
"public"
],
"type": "array",
"items": {
"$ref": "#/$defs/ToolCall"
}
}
},
"x-fern-type-name": "ChatMessage"
},
"ChatRole": {
"type": "string",
"description": "One of `CHATBOT`, `SYSTEM`, `TOOL` or `USER` to identify who the message is coming from.\n",
"enum": [
"CHATBOT",
"SYSTEM",
"USER",
"TOOL"
],
"x-fern-type-name": "ChatRole"
},
"ChatSearchQueriesGenerationEvent": {
"allOf": [
{
"$ref": "#/$defs/ChatStreamEvent"
},
{
"type": "object",
"required": [
"search_queries"
],
"properties": {
"search_queries": {
"type": "array",
"x-fern-audiences": [
"public"
],
"description": "Generated search queries, meant to be used as part of the RAG flow.",
"items": {
"$ref": "#/$defs/ChatSearchQuery"
}
}
},
"x-fern-type-name": "ChatSearchQueriesGenerationEvent-6evypd"
}
],
"x-fern-type-name": "ChatSearchQueriesGenerationEvent"
},
"ChatSearchQuery": {
"description": "The generated search query. Contains the text of the query and a unique identifier for the query.\n",
"type": "object",
"required": [
"text",
"generation_id"
],
"properties": {
"text": {
"description": "The text of the search query.\n",
"type": "string",
"x-fern-audiences": [
"public"
]
},
"generation_id": {
"description": "Unique identifier for the generated search query. Useful for submitting feedback.\n",
"type": "string",
"x-fern-audiences": [
"public"
],
"format": "uuid"
}
},
"x-fern-type-name": "ChatSearchQuery"
},
"ChatSearchResult": {
"type": "object",
"required": [
"connector",
"document_ids"
],
"properties": {
"search_query": {
"$ref": "#/$defs/ChatSearchQuery",
"x-fern-audiences": [
"public"
]
},
"connector": {
"description": "The connector from which this result comes from.\n",
"$ref": "#/$defs/ChatSearchResultConnector",
"x-fern-audiences": [
"public"
]
},
"document_ids": {
"description": "Identifiers of documents found by this search query.\n",
"type": "array",
"x-fern-audiences": [
"public"
],
"minLength": 0,
"items": {
"type": "string",
"x-fern-audiences": [
"public"
],
"minLength": 1
}
},
"error_message": {
"description": "An error message if the search failed.\n",
"type": "string",
"x-fern-audiences": [
"public"
]
},
"continue_on_failure": {
"description": "Whether a chat request should continue or not if the request to this connector fails.\n",
"type": "boolean",
"x-fern-audiences": [
"public"
]
}
},
"x-fern-type-name": "ChatSearchResult"
},
"ChatSearchResultConnector": {
"description": "The connector used for fetching documents.\n",
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"description": "The identifier of the connector.\n",
"type": "string",
"x-fern-audiences": [
"public"
],
"minLength": 1
}
},
"x-fern-type-name": "ChatSearchResultConnector"
},
"ChatSearchResultsEvent": {
"allOf": [
{
"$ref": "#/$defs/ChatStreamEvent"
},
{
"type": "object",
"properties": {
"search_results": {
"description": "Conducted searches and the ids of documents retrieved from each of them.\n",
"type": "array",
"x-fern-audiences": [
"public"
],
"minItems": 0,
"items": {
"$ref": "#/$defs/ChatSearchResult"
}
},
"documents": {
"description": "Documents fetched from searches or provided by the user.\n",
"type": "array",
"x-fern-audiences": [
"public"
],
"minItems": 0,
"items": {
"$ref": "#/$defs/ChatDocument"
}
}
},
"x-fern-type-name": "ChatSearchResultsEvent-44axt5"
}
],
"x-fern-type-name": "ChatSearchResultsEvent"
},
"ChatStreamEndEvent": {
"allOf": [
{
"$ref": "#/$defs/ChatStreamEvent"
},
{
"type": "object",
"required": [
"finish_reason",
"response"
],
"properties": {
"finish_reason": {
"description": "- `COMPLETE` - the model sent back a finished reply\n- `ERROR_LIMIT` - the reply was cut off because the model reached the maximum number of tokens for its context length\n- `MAX_TOKENS` - the reply was cut off because the model reached the maximum number of tokens specified by the max_tokens parameter\n- `ERROR` - something went wrong when generating the reply\n- `ERROR_TOXIC` - the model generated a reply that was deemed toxic\n",
"type": "string",
"x-fern-type-name": "ChatStreamEndEventFinishReason",
"x-fern-audiences": [
"public"
],
"enum": [
"COMPLETE",
"ERROR_LIMIT",
"MAX_TOKENS",
"ERROR",
"ERROR_TOXIC"
]
},
"response": {
"x-fern-audiences": [
"public"
],
"description": "The consolidated response from the model. Contains the generated reply and all the other information streamed back in the previous events.\n",
"$ref": "#/$defs/NonStreamedChatResponse"
}
},
"x-fern-type-name": "ChatStreamEndEvent-y8gq2x"
}
],
"x-fern-type-name": "ChatStreamEndEvent"
},
"ChatStreamEvent": {
"required": [
"event_type"
],
"properties": {
"event_type": {
"type": "string",
"x-fern-audiences": [
"public"
],
"enum": [
"stream-start",
"search-queries-generation",
"search-results",
"text-generation",
"citation-generation",
"stream-end",
"debug"
]
}
},
"x-fern-type-name": "ChatStreamEvent"
},
"ChatStreamStartEvent": {
"allOf": [
{
"$ref": "#/$defs/ChatStreamEvent"
},
{
"type": "object",
"required": [
"generation_id"
],
"properties": {
"generation_id": {
"description": "Unique identifier for the generated reply. Useful for submitting feedback.\n",
"type": "string",
"x-fern-audiences": [
"public"
],
"format": "uuid",
"minLength": 1
}
},
"x-fern-type-name": "ChatStreamStartEvent-5v9jyv"
}
],
"x-fern-type-name": "ChatStreamStartEvent"
},
"ChatTextGenerationEvent": {
"allOf": [
{
"$ref": "#/$defs/ChatStreamEvent"
},
{
"type": "object",
"required": [
"text"
],
"properties": {
"text": {
"description": "The next batch of text generated by the model.\n",
"type": "string",
"x-fern-audiences": [
"public"
],
"minLength": 1
}
},
"x-fern-type-name": "ChatTextGenerationEvent-8yyj22"
}
],
"x-fern-type-name": "ChatTextGenerationEvent"
},
"ChatToolCallsChunkEvent": {
"allOf": [
{
"$ref": "#/$defs/ChatStreamEvent"
},
{
"type": "object",
"required": [
"tool_call_delta"
],
"properties": {
"tool_call_delta": {
"$ref": "#/$defs/ToolCallDelta",
"x-fern-audiences": [
"public"
]
},
"text": {
"type": "string",
"x-fern-audiences": [
"public"
]
}
},
"x-fern-type-name": "ChatToolCallsChunkEvent-t7lliu"
}
],
"x-fern-type-name": "ChatToolCallsChunkEvent"
},
"ChatToolCallsGenerationEvent": {
"allOf": [
{
"$ref": "#/$defs/ChatStreamEvent"
},
{
"type": "object",
"required": [
"tool_calls"
],
"properties": {
"text": {
"description": "The text generated related to the tool calls generated\n",
"type": "string",
"x-fern-audiences": [
"public"
]
},
"tool_calls": {
"x-fern-audiences": [
"public"
],
"type": "array",
"items": {
"$ref": "#/$defs/ToolCall"
}
}
},
"x-fern-type-name": "ChatToolCallsGenerationEvent-nykiww"
}
],
"x-fern-type-name": "ChatToolCallsGenerationEvent"
},
"ChatToolMessage": {
"description": "Represents tool result in the chat history.\n",
"required": [
"role"
],
"properties": {
"role": {
"$ref": "#/$defs/ChatRole"
},
"tool_results": {
"type": "array",
"items": {
"$ref": "#/$defs/ToolResult"
}
}
},
"x-fern-type-name": "ChatToolMessage"
},
"FinishReason": {
"type": "string",
"enum": [
"COMPLETE",
"STOP_SEQUENCE",
"ERROR",
"ERROR_TOXIC",
"ERROR_LIMIT",
"USER_CANCEL",
"MAX_TOKENS",
"TIMEOUT"
],
"x-fern-type-name": "FinishReason"
},
"Message": {
"oneOf": [
{
"$ref": "#/$defs/ChatMessage"
},
{
"$ref": "#/$defs/ChatToolMessage"
}
],
"discriminator": {
"propertyName": "role",
"mapping": {
"CHATBOT": "#/components/schemas/ChatMessage",
"SYSTEM": "#/components/schemas/ChatMessage",
"USER": "#/components/schemas/ChatMessage",
"TOOL": "#/components/schemas/ChatToolMessage"
}
},
"x-fern-type-name": "Message"
},
"NonStreamedChatResponse": {
"required": [
"text"
],
"x-fern-type-name": "NonStreamedChatResponse",
"properties": {
"text": {
"type": "string",
"x-fern-audiences": [
"public"
],
"minLength": 1,
"description": "Contents of the reply generated by the model."
},
"generation_id": {
"type": "string",
"x-fern-audiences": [
"public"
],
"format": "uuid",
"description": "Unique identifier for the generated reply. Useful for submitting feedback."
},
"response_id": {
"type": "string",
"x-fern-audiences": [
"public"
],
"format": "uuid",
"description": "Unique identifier for the response."
},
"citations": {
"type": "array",
"x-fern-audiences": [
"public"
],
"minItems": 0,
"description": "Inline citations for the generated reply.",
"items": {
"$ref": "#/$defs/ChatCitation"
}
},
"documents": {
"type": "array",
"x-fern-audiences": [
"public"
],
"minItems": 0,
"description": "Documents seen by the model when generating the reply.",
"items": {
"$ref": "#/$defs/ChatDocument"
}
},
"is_search_required": {
"type": "boolean",
"x-fern-audiences": [
"public"
],
"description": "Denotes that a search for documents is required during the RAG flow."
},
"search_queries": {
"type": "array",
"x-fern-audiences": [
"public"
],
"description": "Generated search queries, meant to be used as part of the RAG flow.",
"items": {
"$ref": "#/$defs/ChatSearchQuery"
}
},
"search_results": {
"type": "array",
"x-fern-audiences": [
"public"
],
"minItems": 0,
"description": "Documents retrieved from each of the conducted searches.",
"items": {
"$ref": "#/$defs/ChatSearchResult"
}
},
"finish_reason": {
"x-fern-audiences": [
"public"
],
"$ref": "#/$defs/FinishReason"
},
"tool_calls": {
"x-fern-audiences": [
"public"
],
"type": "array",
"items": {
"$ref": "#/$defs/ToolCall"
}
},
"chat_history": {
"type": "array",
"x-fern-audiences": [
"public"
],
"minItems": 0,
"items": {
"$ref": "#/$defs/Message"
},
"description": "A list of previous messages between the user and the model, meant to give the model conversational context for responding to the user's `message`.\n"
},
"meta": {
"$ref": "#/$defs/ApiMeta",
"x-fern-audiences": [
"public"
]
}
}
},
"StreamedChatResponse": {
"description": "StreamedChatResponse is returned in streaming mode (specified with `stream=True` in the request).",
"x-fern-type-name": "StreamedChatResponse",
"oneOf": [
{
"$ref": "#/$defs/ChatStreamStartEvent"
},
{
"$ref": "#/$defs/ChatSearchQueriesGenerationEvent"
},
{
"$ref": "#/$defs/ChatSearchResultsEvent"
},
{
"$ref": "#/$defs/ChatTextGenerationEvent"
},
{
"$ref": "#/$defs/ChatCitationGenerationEvent"
},
{
"$ref": "#/$defs/ChatToolCallsGenerationEvent"
},
{
"$ref": "#/$defs/ChatStreamEndEvent"
},
{
"$ref": "#/$defs/ChatToolCallsChunkEvent"
},
{
"$ref": "#/$defs/ChatDebugEvent"
}
],
"discriminator": {
"propertyName": "event_type",
"mapping": {
"stream-start": "#/components/schemas/ChatStreamStartEvent",
"search-queries-generation": "#/components/schemas/ChatSearchQueriesGenerationEvent",
"search-results": "#/components/schemas/ChatSearchResultsEvent",
"text-generation": "#/components/schemas/ChatTextGenerationEvent",
"citation-generation": "#/components/schemas/ChatCitationGenerationEvent",
"tool-calls-generation": "#/components/schemas/ChatToolCallsGenerationEvent",
"stream-end": "#/components/schemas/ChatStreamEndEvent",
"tool-calls-chunk": "#/components/schemas/ChatToolCallsChunkEvent",
"debug": "#/components/schemas/ChatDebugEvent"
}
}
},
"ToolCall": {
"description": "Contains the tool calls generated by the model. Use it to invoke your tools.\n",
"type": "object",
"required": [
"name",
"parameters"
],
"properties": {
"name": {
"x-fern-audiences": [
"public"
],
"description": "Name of the tool to call.",
"type": "string"
},
"parameters": {
"x-fern-audiences": [
"public"
],
"description": "The name and value of the parameters to use when invoking a tool.",
"type": "object",
"additionalProperties": true,
"x-fern-type-name": "ToolCall-iovxf2"
}
},
"x-fern-type-name": "ToolCall"
},
"ToolCallDelta": {
"description": "Contains the chunk of the tool call generation in the stream.\n",
"type": "object",
"properties": {
"name": {
"description": "Name of the tool call\n",
"type": "string",
"x-fern-audiences": [
"public"
]
},
"index": {
"description": "Index of the tool call generated\n",
"type": "number",
"x-fern-audiences": [
"public"
]
},
"parameters": {
"description": "Chunk of the tool parameters\n",
"type": "string",
"x-fern-audiences": [
"public"
]
},
"text": {
"description": "Chunk of the tool plan text\n",
"type": "string",
"x-fern-audiences": [
"public"
]
}
},
"x-fern-type-name": "ToolCallDelta"
},
"ToolResult": {
"type": "object",
"required": [
"call",
"outputs"
],
"properties": {
"call": {
"$ref": "#/$defs/ToolCall"
},
"outputs": {
"type": "array",
"minItems": 0,
"items": {
"type": "object",
"additionalProperties": true,
"x-fern-type-name": "ToolResult-68w0tx"
}
}
},
"x-fern-type-name": "ToolResult"
}
}
}
}Validate a payload
before you spend tokensshell
$ curl -X POST https://modelschemas.com/v1/validate \
-d '{"provider":"cohere","endpointId":"v1/chat","payload":{…}}'
→ {"valid": false, "errors": [{"path": "#", "keyword": "required", …}]}