> For the complete documentation index, see [llms.txt](https://guides.ia.numerique.gouv.fr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guides.ia.numerique.gouv.fr/albert-api/api-reference/liste-des-endpoint/chat.md).

# Chat

## Chat Completions

> Creates a model response for the given chat conversation.

```json
{"openapi":"3.1.0","info":{"title":"Albert API","version":"0.4.9"},"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}},"schemas":{"CreateChatCompletion":{"properties":{"messages":{"items":{},"type":"array","title":"Messages","description":"A list of messages comprising the conversation so far."},"model":{"type":"string","title":"Model","description":"ID of the model to use. Call `/v1/models` endpoint to get the list of available models, only `text-generation` model type is supported."},"frequency_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Frequency Penalty","description":"Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.","default":0},"logit_bias":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Logit Bias","description":"Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token."},"logprobs":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Logprobs","description":"Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`.","default":false},"top_logprobs":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Top Logprobs","description":"An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used."},"presence_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Presence Penalty","description":"Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.","default":0},"max_completion_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Completion Tokens","description":"An upper bound for the number of tokens that can be generated for a completion."},"n":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N","description":"How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs.","default":1},"response_format":{"anyOf":[{},{"type":"null"}],"title":"Response Format","description":"Setting to `{ \"type\": \"json_schema\", \"json_schema\": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which ensures the message the model generates is valid JSON.<br>**Important**: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly \"stuck\" request. Also note that the message content may be partially cut off if `finish_reason=\"length\"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length."},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seed","description":"If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. Determinism is not guaranteed, and you should refer to the system_fingerprint response parameter to monitor changes in the backend."},"stop":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Stop","description":"Up to 4 sequences where the API will stop generating further tokens."},"stream":{"anyOf":[{"type":"boolean","enum":[true,false]},{"type":"null"}],"title":"Stream","description":"If set, partial message deltas will be sent. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.","default":false},"stream_options":{"anyOf":[{},{"type":"null"}],"title":"Stream Options","description":"Options for streaming response. Only set this when you set `stream: true`."},"temperature":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Temperature","description":"What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both."},"top_p":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top P","description":"An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.<br>We generally recommend altering this or `temperature` but not both."},"tools":{"anyOf":[{"anyOf":[{"items":{"anyOf":[{"additionalProperties":true,"type":"object"},{"$ref":"#/components/schemas/SearchTool"}]},"type":"array"},{"type":"null"}],"description":"A list of tools the model may call. Currently, only functions are supported as a tool. Support function calling and build-in tools (currently only SearchTool). Use this to provide a list of functions the model may generate JSON inputs for."},{"type":"null"}],"title":"Tools"},"tool_choice":{"title":"Tool Choice","description":"Controls which (if any) tool is called by the model. `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. Specifying a particular tool via `{\"type\": \"function\", \"function\": {\"name\": \"my_function\"}}` forces the model to call that tool.<br>`none` is the default when no tools are present. `auto` is the default if tools are present.","default":"none"},"parallel_tool_calls":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Parallel Tool Calls","description":"Whether to call tools in parallel or sequentially. If true, the model will call tools in parallel. If false, the model will call tools sequentially. If None, the model will call tools in parallel if the model supports it, otherwise it will call tools sequentially.","default":false},"user":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User","description":"A unique identifier representing the user."},"search":{"type":"boolean","title":"Search","default":false,"deprecated":true},"search_args":{"anyOf":[{"$ref":"#/components/schemas/SearchArgs"},{"type":"null"}],"deprecated":true}},"additionalProperties":true,"type":"object","required":["messages","model"],"title":"CreateChatCompletion"},"SearchTool":{"properties":{"collection_ids":{"items":{"type":"integer","exclusiveMinimum":0},"type":"array","maxItems":100,"minItems":0,"title":"Collection Ids","description":"List of collections ID.","default":[]},"document_ids":{"items":{"type":"integer","exclusiveMinimum":0},"type":"array","maxItems":100,"minItems":0,"title":"Document Ids","description":"List of document IDs","default":[]},"metadata_filters":{"anyOf":[{"$ref":"#/components/schemas/ComparisonFilter"},{"$ref":"#/components/schemas/CompoundFilter"},{"type":"null"}],"title":"Metadata Filters","description":"Metadata filters to apply to the search."},"limit":{"type":"integer","maximum":100,"exclusiveMinimum":0,"title":"Limit","description":"Number of results to return.","default":10},"offset":{"type":"integer","minimum":0,"title":"Offset","description":"Offset for pagination, specifying how many results to skip from the beginning.","default":0},"method":{"$ref":"#/components/schemas/SearchMethod","description":"Search method to use.","default":"semantic"},"rff_k":{"type":"integer","maximum":16384,"minimum":0,"title":"Rff K","description":"Smoothing constant for Reciprocal Rank Fusion (RRF) algorithm in hybrid search (recommended: from 10 to 100).","default":60},"score_threshold":{"type":"number","maximum":1,"minimum":0,"title":"Score Threshold","description":"Score of cosine similarity threshold for filtering results, only available for semantic search method.","default":0},"type":{"type":"string","const":"search","title":"Type","description":"The type of tool to call.","default":"search"}},"additionalProperties":true,"type":"object","title":"SearchTool","description":"Built-in search tool available in `tools`.\n\nUse `type=\"search\"` to trigger retrieval over indexed documents.\nAll additional parameters are inherited from `SearchArgs`."},"ComparisonFilter":{"properties":{"key":{"type":"string","maxLength":255,"minLength":1,"title":"Key"},"type":{"$ref":"#/components/schemas/ComparisonFilterType"},"value":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"integer","maximum":10000000000000000,"minimum":-10000000000000000},{"type":"number","maximum":10000000000000000,"minimum":-10000000000000000},{"type":"boolean"}],"title":"Value"}},"additionalProperties":true,"type":"object","required":["key","type","value"],"title":"ComparisonFilter"},"ComparisonFilterType":{"type":"string","enum":["eq","sw","ew","co"],"title":"ComparisonFilterType","description":"Comparison filter type for metadata filters."},"CompoundFilter":{"properties":{"filters":{"items":{"$ref":"#/components/schemas/ComparisonFilter"},"type":"array","maxItems":4,"minItems":2,"title":"Filters","description":"List of filters to apply to the search."},"operator":{"$ref":"#/components/schemas/CompoundFilterOperator","description":"Operator to use for the compound filter."}},"additionalProperties":true,"type":"object","required":["filters","operator"],"title":"CompoundFilter"},"CompoundFilterOperator":{"type":"string","enum":["and","or"],"title":"CompoundFilterOperator","description":"Compound filter operator for metadata filters."},"SearchMethod":{"type":"string","enum":["hybrid","semantic","lexical"],"title":"SearchMethod"},"SearchArgs":{"properties":{"collection_ids":{"items":{"type":"integer","exclusiveMinimum":0},"type":"array","maxItems":100,"minItems":0,"title":"Collection Ids","description":"List of collections ID.","default":[]},"document_ids":{"items":{"type":"integer","exclusiveMinimum":0},"type":"array","maxItems":100,"minItems":0,"title":"Document Ids","description":"List of document IDs","default":[]},"metadata_filters":{"anyOf":[{"$ref":"#/components/schemas/ComparisonFilter"},{"$ref":"#/components/schemas/CompoundFilter"},{"type":"null"}],"title":"Metadata Filters","description":"Metadata filters to apply to the search."},"limit":{"type":"integer","maximum":100,"exclusiveMinimum":0,"title":"Limit","description":"Number of results to return.","default":10},"offset":{"type":"integer","minimum":0,"title":"Offset","description":"Offset for pagination, specifying how many results to skip from the beginning.","default":0},"method":{"$ref":"#/components/schemas/SearchMethod","description":"Search method to use.","default":"semantic"},"rff_k":{"type":"integer","maximum":16384,"minimum":0,"title":"Rff K","description":"Smoothing constant for Reciprocal Rank Fusion (RRF) algorithm in hybrid search (recommended: from 10 to 100).","default":60},"score_threshold":{"type":"number","maximum":1,"minimum":0,"title":"Score Threshold","description":"Score of cosine similarity threshold for filtering results, only available for semantic search method.","default":0}},"additionalProperties":true,"type":"object","title":"SearchArgs"},"ChatCompletion":{"properties":{"id":{"type":"string","title":"Id","description":"A unique identifier for the chat completion."},"choices":{"items":{"$ref":"#/components/schemas/openai__types__chat__chat_completion__Choice"},"type":"array","title":"Choices"},"created":{"type":"integer","title":"Created"},"model":{"type":"string","title":"Model"},"object":{"type":"string","const":"chat.completion","title":"Object"},"service_tier":{"anyOf":[{"type":"string","enum":["auto","default","flex","scale","priority"]},{"type":"null"}],"title":"Service Tier"},"system_fingerprint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Fingerprint"},"usage":{"$ref":"#/components/schemas/api__schemas__usage__Usage","description":"Usage information for the request."},"search_results":{"items":{"$ref":"#/components/schemas/Search"},"type":"array","title":"Search Results","default":[]}},"additionalProperties":true,"type":"object","required":["choices","created","model","object"],"title":"ChatCompletion"},"openai__types__chat__chat_completion__Choice":{"properties":{"finish_reason":{"type":"string","enum":["stop","length","tool_calls","content_filter","function_call"],"title":"Finish Reason"},"index":{"type":"integer","title":"Index"},"logprobs":{"anyOf":[{"$ref":"#/components/schemas/ChoiceLogprobs"},{"type":"null"}]},"message":{"$ref":"#/components/schemas/ChatCompletionMessage"}},"additionalProperties":true,"type":"object","required":["finish_reason","index","message"],"title":"Choice"},"ChoiceLogprobs":{"properties":{"content":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionTokenLogprob"},"type":"array"},{"type":"null"}],"title":"Content"},"refusal":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChatCompletionTokenLogprob"},"type":"array"},{"type":"null"}],"title":"Refusal"}},"additionalProperties":true,"type":"object","title":"ChoiceLogprobs","description":"Log probability information for the choice."},"ChatCompletionTokenLogprob":{"properties":{"token":{"type":"string","title":"Token"},"bytes":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Bytes"},"logprob":{"type":"number","title":"Logprob"},"top_logprobs":{"items":{"$ref":"#/components/schemas/TopLogprob"},"type":"array","title":"Top Logprobs"}},"additionalProperties":true,"type":"object","required":["token","logprob","top_logprobs"],"title":"ChatCompletionTokenLogprob"},"TopLogprob":{"properties":{"token":{"type":"string","title":"Token"},"bytes":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Bytes"},"logprob":{"type":"number","title":"Logprob"}},"additionalProperties":true,"type":"object","required":["token","logprob"],"title":"TopLogprob"},"ChatCompletionMessage":{"properties":{"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"refusal":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Refusal"},"role":{"type":"string","const":"assistant","title":"Role"},"annotations":{"anyOf":[{"items":{"$ref":"#/components/schemas/Annotation"},"type":"array"},{"type":"null"}],"title":"Annotations"},"audio":{"anyOf":[{"$ref":"#/components/schemas/ChatCompletionAudio"},{"type":"null"}]},"function_call":{"anyOf":[{"$ref":"#/components/schemas/FunctionCall"},{"type":"null"}]},"tool_calls":{"anyOf":[{"items":{"anyOf":[{"$ref":"#/components/schemas/ChatCompletionMessageFunctionToolCall"},{"$ref":"#/components/schemas/ChatCompletionMessageCustomToolCall"}]},"type":"array"},{"type":"null"}],"title":"Tool Calls"}},"additionalProperties":true,"type":"object","required":["role"],"title":"ChatCompletionMessage","description":"A chat completion message generated by the model."},"Annotation":{"properties":{"type":{"type":"string","const":"url_citation","title":"Type"},"url_citation":{"$ref":"#/components/schemas/AnnotationURLCitation"}},"additionalProperties":true,"type":"object","required":["type","url_citation"],"title":"Annotation","description":"A URL citation when using web search."},"AnnotationURLCitation":{"properties":{"end_index":{"type":"integer","title":"End Index"},"start_index":{"type":"integer","title":"Start Index"},"title":{"type":"string","title":"Title"},"url":{"type":"string","title":"Url"}},"additionalProperties":true,"type":"object","required":["end_index","start_index","title","url"],"title":"AnnotationURLCitation","description":"A URL citation when using web search."},"ChatCompletionAudio":{"properties":{"id":{"type":"string","title":"Id"},"data":{"type":"string","title":"Data"},"expires_at":{"type":"integer","title":"Expires At"},"transcript":{"type":"string","title":"Transcript"}},"additionalProperties":true,"type":"object","required":["id","data","expires_at","transcript"],"title":"ChatCompletionAudio","description":"If the audio output modality is requested, this object contains data\nabout the audio response from the model. [Learn more](https://platform.openai.com/docs/guides/audio)."},"FunctionCall":{"properties":{"arguments":{"type":"string","title":"Arguments"},"name":{"type":"string","title":"Name"}},"additionalProperties":true,"type":"object","required":["arguments","name"],"title":"FunctionCall","description":"Deprecated and replaced by `tool_calls`.\n\nThe name and arguments of a function that should be called, as generated by the model."},"ChatCompletionMessageFunctionToolCall":{"properties":{"id":{"type":"string","title":"Id"},"function":{"$ref":"#/components/schemas/Function"},"type":{"type":"string","const":"function","title":"Type"}},"additionalProperties":true,"type":"object","required":["id","function","type"],"title":"ChatCompletionMessageFunctionToolCall","description":"A call to a function tool created by the model."},"Function":{"properties":{"arguments":{"type":"string","title":"Arguments"},"name":{"type":"string","title":"Name"}},"additionalProperties":true,"type":"object","required":["arguments","name"],"title":"Function","description":"The function that the model called."},"ChatCompletionMessageCustomToolCall":{"properties":{"id":{"type":"string","title":"Id"},"custom":{"$ref":"#/components/schemas/Custom"},"type":{"type":"string","const":"custom","title":"Type"}},"additionalProperties":true,"type":"object","required":["id","custom","type"],"title":"ChatCompletionMessageCustomToolCall","description":"A call to a custom tool created by the model."},"Custom":{"properties":{"input":{"type":"string","title":"Input"},"name":{"type":"string","title":"Name"}},"additionalProperties":true,"type":"object","required":["input","name"],"title":"Custom","description":"The custom tool that the model called."},"api__schemas__usage__Usage":{"properties":{"prompt_tokens":{"type":"integer","title":"Prompt Tokens","description":"Number of prompt tokens (e.g. input tokens).","default":0},"completion_tokens":{"type":"integer","title":"Completion Tokens","description":"Number of completion tokens (e.g. output tokens).","default":0},"total_tokens":{"type":"integer","title":"Total Tokens","description":"Total number of tokens (e.g. input and output tokens).","default":0},"cost":{"type":"number","title":"Cost","description":"Total cost of the request.","default":0},"carbon":{"$ref":"#/components/schemas/CarbonFootprintUsage","deprecated":true},"impacts":{"$ref":"#/components/schemas/api__schemas__usage__EnvironmentalImpacts"},"requests":{"type":"integer","title":"Requests","description":"Number of model requests.","default":0}},"additionalProperties":true,"type":"object","title":"Usage"},"CarbonFootprintUsage":{"properties":{"kWh":{"$ref":"#/components/schemas/CarbonFootprintUsageKWh","deprecated":true},"kgCO2eq":{"$ref":"#/components/schemas/CarbonFootprintUsageKgCO2eq","deprecated":true}},"additionalProperties":true,"type":"object","title":"CarbonFootprintUsage"},"CarbonFootprintUsageKWh":{"properties":{"min":{"type":"number","title":"Min","description":"Minimum carbon footprint in kWh.","default":0,"deprecated":true},"max":{"type":"number","title":"Max","description":"Maximum carbon footprint in kWh.","default":0,"deprecated":true}},"additionalProperties":true,"type":"object","title":"CarbonFootprintUsageKWh"},"CarbonFootprintUsageKgCO2eq":{"properties":{"min":{"type":"number","title":"Min","description":"Minimum carbon footprint in kgCO2eq (global warming potential).","default":0,"deprecated":true},"max":{"type":"number","title":"Max","description":"Maximum carbon footprint in kgCO2eq (global warming potential).","default":0,"deprecated":true}},"additionalProperties":true,"type":"object","title":"CarbonFootprintUsageKgCO2eq"},"api__schemas__usage__EnvironmentalImpacts":{"properties":{"kWh":{"type":"number","title":"Kwh","description":"Carbon footprint in kWh.","default":0},"kgCO2eq":{"type":"number","title":"Kgco2Eq","description":"Carbon footprint in kgCO2eq (global warming potential).","default":0}},"additionalProperties":true,"type":"object","title":"EnvironmentalImpacts"},"Search":{"properties":{"method":{"$ref":"#/components/schemas/SearchMethod","description":"Search method used."},"score":{"type":"number","title":"Score","description":"Score of the search result."},"chunk":{"$ref":"#/components/schemas/Chunk","description":"Chunk of the search result."}},"additionalProperties":true,"type":"object","required":["method","score","chunk"],"title":"Search"},"Chunk":{"properties":{"object":{"type":"string","const":"chunk","title":"Object","description":"The type of the object.","default":"chunk"},"id":{"type":"integer","minimum":0,"title":"Id","description":"The ID of the chunk."},"collection_id":{"type":"integer","minimum":0,"title":"Collection Id","description":"The ID of the collection the chunk belongs to."},"document_id":{"type":"integer","minimum":0,"title":"Document Id","description":"The ID of the document the chunk belongs to."},"content":{"type":"string","minLength":1,"title":"Content","description":"The content of the chunk."},"metadata":{"anyOf":[{"additionalProperties":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"integer","maximum":10000000000000000,"minimum":-10000000000000000},{"type":"number","maximum":10000000000000000,"minimum":-10000000000000000},{"type":"boolean"}]},"propertyNames":{"maxLength":255,"minLength":1},"type":"object","maxProperties":10,"minProperties":1,"description":"Extra metadata for the source"},{"type":"null"}],"title":"Metadata","description":"Metadata of the chunk"},"created":{"type":"integer","title":"Created","description":"The date of the chunk creation."}},"additionalProperties":true,"type":"object","required":["id","collection_id","document_id","content"],"title":"Chunk"},"ChatCompletionChunk":{"properties":{"id":{"type":"string","title":"Id"},"choices":{"items":{"$ref":"#/components/schemas/openai__types__chat__chat_completion_chunk__Choice"},"type":"array","title":"Choices"},"created":{"type":"integer","title":"Created"},"model":{"type":"string","title":"Model"},"object":{"type":"string","const":"chat.completion.chunk","title":"Object"},"service_tier":{"anyOf":[{"type":"string","enum":["auto","default","flex","scale","priority"]},{"type":"null"}],"title":"Service Tier"},"system_fingerprint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Fingerprint"},"usage":{"anyOf":[{"$ref":"#/components/schemas/CompletionUsage"},{"type":"null"}]},"search_results":{"items":{"$ref":"#/components/schemas/Search"},"type":"array","title":"Search Results","default":[]}},"additionalProperties":true,"type":"object","required":["id","choices","created","model","object"],"title":"ChatCompletionChunk"},"openai__types__chat__chat_completion_chunk__Choice":{"properties":{"delta":{"$ref":"#/components/schemas/ChoiceDelta"},"finish_reason":{"anyOf":[{"type":"string","enum":["stop","length","tool_calls","content_filter","function_call"]},{"type":"null"}],"title":"Finish Reason"},"index":{"type":"integer","title":"Index"},"logprobs":{"anyOf":[{"$ref":"#/components/schemas/ChoiceLogprobs"},{"type":"null"}]}},"additionalProperties":true,"type":"object","required":["delta","index"],"title":"Choice"},"ChoiceDelta":{"properties":{"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"function_call":{"anyOf":[{"$ref":"#/components/schemas/ChoiceDeltaFunctionCall"},{"type":"null"}]},"refusal":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Refusal"},"role":{"anyOf":[{"type":"string","enum":["developer","system","user","assistant","tool"]},{"type":"null"}],"title":"Role"},"tool_calls":{"anyOf":[{"items":{"$ref":"#/components/schemas/ChoiceDeltaToolCall"},"type":"array"},{"type":"null"}],"title":"Tool Calls"}},"additionalProperties":true,"type":"object","title":"ChoiceDelta","description":"A chat completion delta generated by streamed model responses."},"ChoiceDeltaFunctionCall":{"properties":{"arguments":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Arguments"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},"additionalProperties":true,"type":"object","title":"ChoiceDeltaFunctionCall","description":"Deprecated and replaced by `tool_calls`.\n\nThe name and arguments of a function that should be called, as generated by the model."},"ChoiceDeltaToolCall":{"properties":{"index":{"type":"integer","title":"Index"},"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"function":{"anyOf":[{"$ref":"#/components/schemas/ChoiceDeltaToolCallFunction"},{"type":"null"}]},"type":{"anyOf":[{"type":"string","const":"function"},{"type":"null"}],"title":"Type"}},"additionalProperties":true,"type":"object","required":["index"],"title":"ChoiceDeltaToolCall"},"ChoiceDeltaToolCallFunction":{"properties":{"arguments":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Arguments"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},"additionalProperties":true,"type":"object","title":"ChoiceDeltaToolCallFunction"},"CompletionUsage":{"properties":{"completion_tokens":{"type":"integer","title":"Completion Tokens"},"prompt_tokens":{"type":"integer","title":"Prompt Tokens"},"total_tokens":{"type":"integer","title":"Total Tokens"},"completion_tokens_details":{"anyOf":[{"$ref":"#/components/schemas/CompletionTokensDetails"},{"type":"null"}]},"prompt_tokens_details":{"anyOf":[{"$ref":"#/components/schemas/PromptTokensDetails"},{"type":"null"}]}},"additionalProperties":true,"type":"object","required":["completion_tokens","prompt_tokens","total_tokens"],"title":"CompletionUsage","description":"Usage statistics for the completion request."},"CompletionTokensDetails":{"properties":{"accepted_prediction_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Accepted Prediction Tokens"},"audio_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Audio Tokens"},"reasoning_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Reasoning Tokens"},"rejected_prediction_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rejected Prediction Tokens"}},"additionalProperties":true,"type":"object","title":"CompletionTokensDetails","description":"Breakdown of tokens used in a completion."},"PromptTokensDetails":{"properties":{"audio_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Audio Tokens"},"cached_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cached Tokens"}},"additionalProperties":true,"type":"object","title":"PromptTokensDetails","description":"Breakdown of tokens used in the prompt."},"api__schemas__exception__HTTPExceptionModel":{"properties":{"status_code":{"type":"integer","maximum":599,"minimum":100,"title":"Status Code","description":"HTTP status code to send to the client."},"detail":{"title":"Detail","description":"Any data to be sent to the client in the `detail` key of the JSON response."},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers","description":"Any headers to send to the client in the response."}},"type":"object","required":["status_code","detail","headers"],"title":"HTTPExceptionModel"}}},"paths":{"/v1/chat/completions":{"post":{"tags":["Chat"],"summary":"Chat Completions","description":"Creates a model response for the given chat conversation.","operationId":"chat_completions_v1_chat_completions_post","parameters":[{"name":"required","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Required"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateChatCompletion"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ChatCompletion"},{"$ref":"#/components/schemas/ChatCompletionChunk"}],"title":"Response Chat Completions V1 Chat Completions Post"}}}},"404":{"description":"Model not found. Collection not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__schemas__exception__HTTPExceptionModel"}}}},"422":{"description":"Wrong model type.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__schemas__exception__HTTPExceptionModel"}}}},"503":{"description":"Model is too busy, please try again later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__schemas__exception__HTTPExceptionModel"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://guides.ia.numerique.gouv.fr/albert-api/api-reference/liste-des-endpoint/chat.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
