Repository Public
1# File search23> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.45File search is a tool available in the [Responses API](https://developers.openai.com/api/reference/resources/responses).6It enables models to retrieve information in a knowledge base of previously uploaded files through semantic and keyword search.7By creating vector stores and uploading files to them, you can augment the models' inherent knowledge by giving them access to these knowledge bases or `vector_stores`.89To learn more about how vector stores and semantic search work, refer to our10 [retrieval guide](https://developers.openai.com/api/docs/guides/retrieval).1112This is a hosted tool managed by OpenAI, meaning you don't have to implement code on your end to handle its execution.13When the model decides to use it, it will automatically call the tool, retrieve information from your files, and return an output.1415## How to use1617Prior to using file search with the Responses API, you need to have set up a knowledge base in a vector store and uploaded files to it.18192021### Create a vector store and upload a file222324Follow these steps to create a vector store and upload a file to it. You can use [this example file](https://cdn.openai.com/API/docs/deep_research_blog.pdf) or upload your own.2526#### Upload the file to the File API2728Upload a file2930```javascript31import fs from "fs";32import OpenAI from "openai";33const openai = new OpenAI();3435async function createFile(filePath) {36 let result;37 if (filePath.startsWith("http://") || filePath.startsWith("https://")) {38 // Download the file content from the URL39 const res = await fetch(filePath);40 const buffer = await res.arrayBuffer();41 const urlParts = filePath.split("/");42 const fileName = urlParts[urlParts.length - 1];43 const file = new File([buffer], fileName);44 result = await openai.files.create({45 file: file,46 purpose: "assistants",47 });48 } else {49 // Handle local file path50 const fileContent = fs.createReadStream(filePath);51 result = await openai.files.create({52 file: fileContent,53 purpose: "assistants",54 });55 }56 return result.id;57}5859// Replace with your own file path or URL60const fileId = await createFile(61 "https://cdn.openai.com/API/docs/deep_research_blog.pdf"62);6364console.log(fileId);65```6667```python68from io import BytesIO6970import requests71from openai import OpenAI7273client = OpenAI()747576def create_file(client, file_path):77 if file_path.startswith(("http://", "https://")):78 response = requests.get(file_path, timeout=30)79 response.raise_for_status()80 file_content = BytesIO(response.content)81 file_name = file_path.rsplit("/", 1)[-1]82 result = client.files.create(83 file=(file_name, file_content),84 purpose="assistants",85 )86 else:87 with open(file_path, "rb") as file_content:88 result = client.files.create(89 file=file_content,90 purpose="assistants",91 )92 return result.id939495file_id = create_file(96 client,97 "https://cdn.openai.com/API/docs/deep_research_blog.pdf",98)99print(file_id)100```101102```go103package main104105import (106 "context"107 "fmt"108 "os"109110 "github.com/openai/openai-go/v3"111)112113func main() {114 file, err := os.Open("customer_policies.txt")115 if err != nil {116 panic(err)117 }118 defer file.Close()119120 client := openai.NewClient()121 result, err := client.Files.New(context.Background(), openai.FileNewParams{122 File: openai.File(file, "customer_policies.txt", "text/plain"),123 Purpose: openai.FilePurposeAssistants,124 })125 if err != nil {126 panic(err)127 }128 fmt.Println(result.ID)129}130```131132```java133import com.openai.client.OpenAIClient;134import com.openai.client.okhttp.OpenAIOkHttpClient;135import com.openai.models.files.FileCreateParams;136import com.openai.models.files.FilePurpose;137import java.nio.file.Path;138139var file =140 client141 .files()142 .create(143 FileCreateParams.builder()144 .file(Path.of(System.getenv("OPENAI_EXAMPLE_FILE_PATH")))145 .purpose(FilePurpose.USER_DATA)146 .build());147148System.out.println(file.id());149```150151```ruby152require "openai"153require "pathname"154155client = OpenAI::Client.new156file = Pathname("customer_policies.txt")157uploaded = client.files.create(file: file, purpose: :user_data)158puts(uploaded.id)159```160161162#### Create a vector store163164Create a vector store165166```javascript167const vectorStore = await openai.vectorStores.create({168 name: "knowledge_base",169});170console.log(vectorStore.id);171```172173```python174vector_store = client.vector_stores.create(name="knowledge_base")175print(vector_store.id)176```177178```go179package main180181import (182 "context"183 "fmt"184185 "github.com/openai/openai-go/v3"186)187188func main() {189 client := openai.NewClient()190 vectorStore, err := client.VectorStores.New(context.Background(), openai.VectorStoreNewParams{191 Name: openai.String("knowledge_base"),192 })193 if err != nil {194 panic(err)195 }196 fmt.Println(vectorStore.ID)197}198```199200```java201import com.openai.client.OpenAIClient;202import com.openai.client.okhttp.OpenAIOkHttpClient;203import com.openai.models.vectorstores.VectorStoreCreateParams;204205var store =206 client207 .vectorStores()208 .create(VectorStoreCreateParams.builder().name("Product docs").build());209210System.out.println(store.id());211```212213```ruby214require "openai"215216client = OpenAI::Client.new217store = client.vector_stores.create(name: "Product docs")218puts(store.id)219```220221222#### Add the file to the vector store223224Add a file to a vector store225226```javascript227// Use vectorStore and fileId from the earlier create and upload steps.228await openai.vectorStores.files.create(vectorStore.id, {229 file_id: fileId,230});231```232233```python234result = client.vector_stores.files.create(235 vector_store_id=vector_store.id,236 file_id=file_id,237)238print(result)239```240241```go242package main243244import (245 "context"246 "fmt"247248 "github.com/openai/openai-go/v3"249)250251func main() {252 client := openai.NewClient()253 file, err := client.VectorStores.Files.New(context.Background(), "<vector_store_id>", openai.VectorStoreFileNewParams{254 FileID: "file_abc123",255 })256 if err != nil {257 panic(err)258 }259 fmt.Println(file.ID)260}261```262263```java264import com.openai.client.OpenAIClient;265import com.openai.client.okhttp.OpenAIOkHttpClient;266import com.openai.models.vectorstores.files.FileCreateParams;267268String vectorStoreId = "<vector_store_id>";269270String fileId = "file_abc123";271272var file =273 client274 .vectorStores()275 .files()276 .create(vectorStoreId, FileCreateParams.builder().fileId(fileId).build());277278System.out.println(file.id());279```280281```ruby282require "openai"283284client = OpenAI::Client.new285file = client.vector_stores.files.create("<vector_store_id>", file_id: "file_abc123")286puts(file.id)287```288289290#### Check status291292Run this code until the file is ready to be used (i.e., when the status is `completed`).293294Check status295296```javascript297// Use vectorStore from the earlier create step.298const result = await openai.vectorStores.files.list(vectorStore.id);299console.log(result);300```301302```python303result = client.vector_stores.files.list(vector_store_id=vector_store.id)304print(result)305```306307```go308package main309310import (311 "context"312 "fmt"313314 "github.com/openai/openai-go/v3"315)316317func main() {318 client := openai.NewClient()319 files, err := client.VectorStores.Files.List(context.Background(), "<vector_store_id>", openai.VectorStoreFileListParams{})320 if err != nil {321 panic(err)322 }323 fmt.Println(files.Data)324}325```326327```java328import com.openai.client.OpenAIClient;329import com.openai.client.okhttp.OpenAIOkHttpClient;330331String vectorStoreId = "<vector_store_id>";332333System.out.println(client.vectorStores().files().list(vectorStoreId).data());334```335336```ruby337require "openai"338339client = OpenAI::Client.new340files = client.vector_stores.files.list("<vector_store_id>")341puts(files.data&.map(&:status))342```343344345346347348349Once your knowledge base is set up, you can include the `file_search` tool in the list of tools available to the model, along with the list of vector stores in which to search.350351File search tool352353```javascript354import OpenAI from "openai";355const openai = new OpenAI();356357const response = await openai.responses.create({358 model: "gpt-6-astra",359 input: "What is deep research by OpenAI?",360 tools: [361 {362 type: "file_search",363 vector_store_ids: ["<vector_store_id>"],364 },365 ],366});367console.log(response);368```369370```python371from openai import OpenAI372373client = OpenAI()374375response = client.responses.create(376 model="gpt-6-astra",377 input="What is deep research by OpenAI?",378 tools=[{"type": "file_search", "vector_store_ids": ["<vector_store_id>"]}],379)380print(response)381```382383```go384package main385386import (387 "context"388 "fmt"389390 "github.com/openai/openai-go/v3"391 "github.com/openai/openai-go/v3/responses"392)393394func main() {395 client := openai.NewClient()396 response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{397 Model: "gpt-6-astra",398 Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("What is deep research by OpenAI?")},399 Tools: []responses.ToolUnionParam{responses.ToolParamOfFileSearch([]string{"<vector_store_id>"})},400 })401 if err != nil {402 panic(err)403 }404 fmt.Println(response)405}406```407408```java409import com.openai.client.OpenAIClient;410import com.openai.client.okhttp.OpenAIOkHttpClient;411import com.openai.models.responses.ResponseCreateParams;412import java.util.List;413414String vectorStoreId = "<vector_store_id>";415416ResponseCreateParams params =417 ResponseCreateParams.builder()418 .model("gpt-6-astra")419 .input("What is deep research by OpenAI?")420 .addFileSearchTool(List.of(vectorStoreId))421 .build();422423client.responses().create(params).output().stream()424 .flatMap(item -> item.message().stream())425 .flatMap(message -> message.content().stream())426 .flatMap(content -> content.outputText().stream())427 .forEach(text -> System.out.println(text.text()));428```429430```csharp431using OpenAI.Responses;432#pragma warning disable OPENAI001433434string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;435string vectorStoreId = "<vector_store_id>";436ResponsesClient client = new(key);437438CreateResponseOptions options = new() { Model = "gpt-6-astra" };439options.Tools.Add(440 ResponseTool.CreateFileSearchTool([vectorStoreId])441);442options.InputItems.Add(443 ResponseItem.CreateUserMessageItem("What is deep research by OpenAI?")444);445446ResponseResult response = await client.CreateResponseAsync(options);447448Console.WriteLine(response.GetOutputText());449```450451```ruby452require "openai"453454openai = OpenAI::Client.new455456response = openai.responses.create(457 model: "gpt-6-astra",458 input: "What is deep research by OpenAI?",459 tools: [460 {461 type: "file_search",462 vector_store_ids: ["<vector_store_id>"]463 }464 ]465)466467puts(response)468```469470471When this tool is called by the model, you will receive a response with multiple outputs:4724731. A `file_search_call` output item, which contains the id of the file search call.4742. A `message` output item, which contains the response from the model, along with the file citations.475476File search response477478```json479{480 "output": [481 {482 "type": "file_search_call",483 "id": "fs_67c09ccea8c48191ade9367e3ba71515",484 "status": "completed",485 "queries": ["What is deep research?"],486 "search_results": null487 },488 {489 "id": "msg_67c09cd3091c819185af2be5d13d87de",490 "type": "message",491 "role": "assistant",492 "content": [493 {494 "type": "output_text",495 "text": "Deep research is a sophisticated capability that allows for extensive inquiry and synthesis of information across various domains. It is designed to conduct multi-step research tasks, gather data from multiple online sources, and provide comprehensive reports similar to what a research analyst would produce. This functionality is particularly useful in fields requiring detailed and accurate information...",496 "annotations": [497 {498 "type": "file_citation",499 "index": 992,500 "file_id": "file-2dtbBZdjtDKS8eqWxqbgDi",501 "filename": "deep_research_blog.pdf"502 },503 {504 "type": "file_citation",505 "index": 992,506 "file_id": "file-2dtbBZdjtDKS8eqWxqbgDi",507 "filename": "deep_research_blog.pdf"508 },509 {510 "type": "file_citation",511 "index": 1176,512 "file_id": "file-2dtbBZdjtDKS8eqWxqbgDi",513 "filename": "deep_research_blog.pdf"514 },515 {516 "type": "file_citation",517 "index": 1176,518 "file_id": "file-2dtbBZdjtDKS8eqWxqbgDi",519 "filename": "deep_research_blog.pdf"520 }521 ]522 }523 ]524 }525 ]526}527```528529530## Retrieval customization531532### Limiting the number of results533534Using the file search tool with the Responses API, you can customize the number of results you want to retrieve from the vector stores. This can help reduce both token usage and latency, but may come at the cost of reduced answer quality.535536Limit the number of results537538```javascript539const response = await openai.responses.create({540 model: "gpt-6-astra",541 input: "What is deep research by OpenAI?",542 tools: [543 {544 type: "file_search",545 vector_store_ids: ["<vector_store_id>"],546 // highlight-start547 max_num_results: 2,548 // highlight-end549 },550 ],551});552console.log(response);553```554555```python556response = client.responses.create(557 model="gpt-6-astra",558 input="What is deep research by OpenAI?",559 tools=[560 {561 "type": "file_search",562 "vector_store_ids": ["<vector_store_id>"],563 # highlight-start564 "max_num_results": 2,565 # highlight-end566 }567 ],568)569print(response)570```571572```go573package main574575import (576 "context"577 "fmt"578579 "github.com/openai/openai-go/v3"580 "github.com/openai/openai-go/v3/responses"581)582583func main() {584 client := openai.NewClient()585 tool := responses.ToolParamOfFileSearch([]string{"<vector_store_id>"})586 tool.OfFileSearch.MaxNumResults = openai.Int(2)587 response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{588 Model: "gpt-6-astra",589 Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("What is deep research by OpenAI?")},590 Tools: []responses.ToolUnionParam{tool},591 })592 if err != nil {593 panic(err)594 }595 fmt.Println(response)596}597```598599```java600import com.openai.client.OpenAIClient;601import com.openai.client.okhttp.OpenAIOkHttpClient;602import com.openai.models.responses.FileSearchTool;603import com.openai.models.responses.ResponseCreateParams;604605String vectorStoreId = "<vector_store_id>";606607ResponseCreateParams params =608 ResponseCreateParams.builder()609 .model("gpt-6-astra")610 .input("What is deep research by OpenAI?")611 .addTool(612 FileSearchTool.builder().addVectorStoreId(vectorStoreId).maxNumResults(2).build())613 .build();614615client.responses().create(params).output().stream()616 .flatMap(item -> item.message().stream())617 .flatMap(message -> message.content().stream())618 .flatMap(content -> content.outputText().stream())619 .forEach(text -> System.out.println(text.text()));620```621622```csharp623using OpenAI.Responses;624#pragma warning disable OPENAI001625626string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;627// Replace this illustrative ID with your vector store ID.628string vectorStoreId = "<vector_store_id>";629ResponsesClient client = new(key);630631CreateResponseOptions options = new() { Model = "gpt-6-astra" };632options.Tools.Add(633 ResponseTool.CreateFileSearchTool([vectorStoreId], maxResultCount: 2)634);635options.InputItems.Add(636 ResponseItem.CreateUserMessageItem("What is deep research by OpenAI?")637);638639ResponseResult response = await client.CreateResponseAsync(options);640Console.WriteLine(response.GetOutputText());641```642643```ruby644require "openai"645646client = OpenAI::Client.new647648response = client.responses.create(649 model: "gpt-6-astra",650 input: "What is deep research by OpenAI?",651 tools: [652 {653 type: :file_search,654 vector_store_ids: ["<vector_store_id>"],655 max_num_results: 2656 }657 ]658)659660puts(response)661```662663664### Include search results in the response665666While you can see annotations (references to files) in the output text, the file search call will not return search results by default.667668To include search results in the response, you can use the `include` parameter when creating the response.669670Include search results671672```javascript673const response = await openai.responses.create({674 model: "gpt-6-astra",675 input: "What is deep research by OpenAI?",676 tools: [677 {678 type: "file_search",679 vector_store_ids: ["<vector_store_id>"],680 },681 ],682 // highlight-start683 include: ["file_search_call.results"],684 // highlight-end685});686console.log(response);687```688689```python690response = client.responses.create(691 model="gpt-6-astra",692 input="What is deep research by OpenAI?",693 tools=[694 {695 "type": "file_search",696 "vector_store_ids": ["<vector_store_id>"],697 }698 ],699 # highlight-start700 include=["file_search_call.results"],701 # highlight-end702)703print(response)704```705706```go707package main708709import (710 "context"711 "fmt"712713 "github.com/openai/openai-go/v3"714 "github.com/openai/openai-go/v3/responses"715)716717func main() {718 client := openai.NewClient()719 response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{720 Model: "gpt-6-astra",721 Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("What is deep research by OpenAI?")},722 Tools: []responses.ToolUnionParam{responses.ToolParamOfFileSearch([]string{"<vector_store_id>"})},723 Include: []responses.ResponseIncludable{responses.ResponseIncludableFileSearchCallResults},724 })725 if err != nil {726 panic(err)727 }728 fmt.Println(response)729}730```731732```java733import com.openai.client.OpenAIClient;734import com.openai.client.okhttp.OpenAIOkHttpClient;735import com.openai.models.responses.ResponseCreateParams;736import com.openai.models.responses.ResponseIncludable;737import java.util.List;738739String vectorStoreId = "<vector_store_id>";740741ResponseCreateParams params =742 ResponseCreateParams.builder()743 .model("gpt-6-astra")744 .input("What is deep research by OpenAI?")745 .addInclude(ResponseIncludable.of("file_search_call.results"))746 .addFileSearchTool(List.of(vectorStoreId))747 .build();748749client.responses().create(params).output().stream()750 .flatMap(item -> item.fileSearchCall().stream())751 .flatMap(call -> call.results().stream())752 .flatMap(List::stream)753 .forEach(System.out::println);754```755756```csharp757using OpenAI.Responses;758#pragma warning disable OPENAI001759760string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;761// Replace this illustrative ID with your vector store ID.762string vectorStoreId = "<vector_store_id>";763ResponsesClient client = new(key);764765CreateResponseOptions options = new() { Model = "gpt-6-astra" };766options.Tools.Add(ResponseTool.CreateFileSearchTool([vectorStoreId]));767options.IncludedProperties.Add(IncludedResponseProperty.FileSearchCallResults);768options.InputItems.Add(769 ResponseItem.CreateUserMessageItem("What is deep research by OpenAI?")770);771772ResponseResult response = await client.CreateResponseAsync(options);773foreach (FileSearchCallResponseItem search in response.OutputItems.OfType<FileSearchCallResponseItem>())774{775 foreach (FileSearchCallResult result in search.Results)776 {777 Console.WriteLine($"{result.Filename}: {result.Text}");778 }779}780```781782```ruby783require "openai"784785client = OpenAI::Client.new786787response = client.responses.create(788 model: "gpt-6-astra",789 input: "What is deep research by OpenAI?",790 include: ["file_search_call.results"],791 tools: [792 {793 type: :file_search,794 vector_store_ids: ["<vector_store_id>"]795 }796 ]797)798799puts(response)800```801802803### Metadata filtering804805You can filter the search results based on the metadata of the files. For more details, refer to our [retrieval guide](https://developers.openai.com/api/docs/guides/retrieval), which covers:806807- How to [set attributes on vector store files](https://developers.openai.com/api/docs/guides/retrieval#attributes)808- How to [define filters](https://developers.openai.com/api/docs/guides/retrieval#attribute-filtering)809810Metadata filtering811812```javascript813const response = await openai.responses.create({814 model: "gpt-6-astra",815 input: "What is deep research by OpenAI?",816 tools: [817 {818 type: "file_search",819 vector_store_ids: ["<vector_store_id>"],820 // highlight-start821 filters: {822 type: "in",823 key: "category",824 value: ["blog", "announcement"],825 },826 // highlight-end827 },828 ],829});830console.log(response);831```832833```python834response = client.responses.create(835 model="gpt-6-astra",836 input="What is deep research by OpenAI?",837 tools=[838 {839 "type": "file_search",840 "vector_store_ids": ["<vector_store_id>"],841 # highlight-start842 "filters": {843 "type": "in",844 "key": "category",845 "value": ["blog", "announcement"],846 },847 # highlight-end848 }849 ],850)851print(response)852```853854```go855package main856857import (858 "context"859 "fmt"860861 "github.com/openai/openai-go/v3"862 "github.com/openai/openai-go/v3/responses"863 "github.com/openai/openai-go/v3/shared"864)865866func main() {867 client := openai.NewClient()868 tool := responses.ToolParamOfFileSearch([]string{"<vector_store_id>"})869 tool.OfFileSearch.Filters = responses.FileSearchToolFiltersUnionParam{870 OfComparisonFilter: &shared.ComparisonFilterParam{871 Type: shared.ComparisonFilterTypeIn,872 Key: "category",873 Value: shared.ComparisonFilterValueUnionParam{OfComparisonFilterValueArray: []shared.ComparisonFilterValueArrayItemUnionParam{874 {OfString: openai.String("blog")},875 {OfString: openai.String("announcement")},876 }},877 },878 }879 response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{880 Model: "gpt-6-astra",881 Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("What is deep research by OpenAI?")},882 Tools: []responses.ToolUnionParam{tool},883 })884 if err != nil {885 panic(err)886 }887 fmt.Println(response)888}889```890891```java892import com.openai.client.OpenAIClient;893import com.openai.client.okhttp.OpenAIOkHttpClient;894import com.openai.models.ComparisonFilter;895import com.openai.models.responses.FileSearchTool;896import com.openai.models.responses.ResponseCreateParams;897import java.util.List;898899String vectorStoreId = "<vector_store_id>";900901ResponseCreateParams params =902 ResponseCreateParams.builder()903 .model("gpt-6-astra")904 .input("What is deep research by OpenAI?")905 .addTool(906 FileSearchTool.builder()907 .addVectorStoreId(vectorStoreId)908 .filters(909 ComparisonFilter.builder()910 .type(ComparisonFilter.Type.IN)911 .key("category")912 .valueOfComparisonFilterValueItems(913 List.of(914 ComparisonFilter.Value.ComparisonFilterValueItem.ofString(915 "blog"),916 ComparisonFilter.Value.ComparisonFilterValueItem.ofString(917 "announcement")))918 .build())919 .build())920 .build();921922client.responses().create(params).output().stream()923 .flatMap(item -> item.message().stream())924 .flatMap(message -> message.content().stream())925 .flatMap(content -> content.outputText().stream())926 .forEach(text -> System.out.println(text.text()));927```928929```csharp930using OpenAI.Responses;931#pragma warning disable OPENAI001932933string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;934// Replace this illustrative ID with your vector store ID.935string vectorStoreId = "<vector_store_id>";936ResponsesClient client = new(key);937938BinaryData filters = BinaryData.FromString(939 """940 { "type": "in", "key": "category", "value": ["blog", "announcement"] }941 """942);943CreateResponseOptions options = new() { Model = "gpt-6-astra" };944options.Tools.Add(945 ResponseTool.CreateFileSearchTool([vectorStoreId], filters: filters)946);947options.InputItems.Add(948 ResponseItem.CreateUserMessageItem("What is deep research by OpenAI?")949);950951ResponseResult response = await client.CreateResponseAsync(options);952Console.WriteLine(response.GetOutputText());953```954955```ruby956require "openai"957958client = OpenAI::Client.new959960response = client.responses.create(961 model: "gpt-6-astra",962 input: "What is deep research by OpenAI?",963 tools: [964 {965 type: :file_search,966 vector_store_ids: ["<vector_store_id>"],967 filters: {968 type: :in,969 key: "category",970 value: ["blog", "announcement"]971 }972 }973 ]974)975976puts(response)977```978979980## Supported files981982_For `text/` MIME types, the encoding must be one of `utf-8`, `utf-16`, or `ascii`._983984| File format | MIME type |985| ----------- | --------------------------------------------------------------------------- |986| `.c` | `text/x-c` |987| `.cpp` | `text/x-c++` |988| `.cs` | `text/x-csharp` |989| `.css` | `text/css` |990| `.doc` | `application/msword` |991| `.docx` | `application/vnd.openxmlformats-officedocument.wordprocessingml.document` |992| `.go` | `text/x-golang` |993| `.html` | `text/html` |994| `.java` | `text/x-java` |995| `.js` | `text/javascript` |996| `.json` | `application/json` |997| `.md` | `text/markdown` |998| `.pdf` | `application/pdf` |999| `.php` | `text/x-php` |1000| `.pptx` | `application/vnd.openxmlformats-officedocument.presentationml.presentation` |1001| `.py` | `text/x-python` |1002| `.py` | `text/x-script.python` |1003| `.rb` | `text/x-ruby` |1004| `.sh` | `application/x-sh` |1005| `.tex` | `text/x-tex` |1006| `.ts` | `application/typescript` |1007| `.txt` | `text/plain` |10081009## Usage notes10101011<table>1012<tbody>10131014<tr>1015 <th>API Availability</th>1016 <th>Rate limits</th>1017 <th>Notes</th>1018</tr>10191020<tr>1021<td>102210231024 [Responses](https://developers.openai.com/api/reference/resources/responses)10251026102710281029 [Chat Completions](https://developers.openai.com/api/reference/resources/chat)10301031103210331034 [Assistants](https://developers.openai.com/api/reference/resources/beta/subresources/assistants)103510361037</td>1038<td style={{"maxWidth": "150px"}}>1039**Tier 1**10401041100 RPM10421043**Tier 2 and 3**10441045500 RPM10461047**Tier 4 and 5**104810491000 RPM10501051</td>1052<td style={{"maxWidth": "150px"}}>1053[Pricing](https://developers.openai.com/api/docs/pricing#built-in-tools) 10541055[ZDR and data residency](https://developers.openai.com/api/docs/guides/your-data)1056</td>1057</tr>10581059</tbody>1060</table>